[quagga-dev 7845] [PATCH 1/8] ospfd: route_node_unlock fixes in ospf_lsdb.c.

Joakim Tjernlund Joakim.Tjernlund at transmode.se
Mon Mar 8 12:58:08 GMT 2010


Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund at transmode.se>
---
 ospfd/ospf_lsdb.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/ospfd/ospf_lsdb.c b/ospfd/ospf_lsdb.c
index c906f05..4d81916 100644
--- a/ospfd/ospf_lsdb.c
+++ b/ospfd/ospf_lsdb.c
@@ -120,8 +120,11 @@ ospf_lsdb_add (struct ospf_lsdb *lsdb, struct ospf_lsa *lsa)
   
   /* nothing to do? */
   if (rn->info && rn->info == lsa)
-    return;
-  
+    {
+      route_unlock_node (rn); /* route_node_lookup */
+      return;
+    }
+
   /* purge old entry? */
   if (rn->info)
     ospf_lsdb_delete_entry (lsdb, rn);
@@ -165,9 +168,10 @@ ospf_lsdb_delete (struct ospf_lsdb *lsdb, struct ospf_lsa *lsa)
   table = lsdb->type[lsa->data->type].db;
   lsdb_prefix_set (&lp, lsa);
   rn = route_node_lookup (table, (struct prefix *) &lp);
-  if (rn && (rn->info == lsa))
+  if (rn)
     {
-      ospf_lsdb_delete_entry (lsdb, rn);
+      if (rn->info == lsa)
+	ospf_lsdb_delete_entry (lsdb, rn);
       route_unlock_node (rn); /* route_node_lookup */
     }
 }
@@ -274,7 +278,9 @@ ospf_lsdb_lookup_by_id_next (struct ospf_lsdb *lsdb, u_char type,
       rn = route_top (table);
   else
     {
-      rn = route_node_get (table, (struct prefix *) &lp);
+      rn = route_node_lookup (table, (struct prefix *) &lp);
+      if (!rn)
+	return NULL;
       rn = route_next (rn);
     }
 
-- 
1.6.4.4




More information about the Quagga-dev mailing list