]> git.puffer.fish Git - mirror/frr.git/commitdiff
2005-05-19 Paul Jakma <paul.jakma@sun.com>
authorpaul <paul>
Wed, 18 May 2005 23:29:57 +0000 (23:29 +0000)
committerpaul <paul>
Wed, 18 May 2005 23:29:57 +0000 (23:29 +0000)
* ospf_interface.c: (ospf_if_table_lookup) Fix a serious bug
  a less serious one.
  1: this function is supposed to lookup
  entries in the oifs ospf_interface route_table and return either
  an existing oi or NULL to indicate not found, its caller depends
  on this, yet this function uses route_node_get which /always/
  returns a route_node - one is created if none exists. Use
  route_node_lookup instead. This should fix root cause of the
  reports of the (ospf_add_to_if) assert being hit.
  2: oi's are inserted into this table with prefixlength set to
  /32 (indeed, it should be a hash table, not a route_table),
  however prefixlength to lookup was not changed, if no valid entry
  can be inserted other than /32, then nothng but /32 should be
  looked up. This possibly only worked by fluke..
  Fix confirmed by 2 reporters (one list, one IRC), definitely a
  backport candidate once it has been incubated in HEAD for a while.
  Thanks to Patrick Friedel and Ivan Warren for testing.

ospfd/ChangeLog
ospfd/ospf_interface.c

index 774658ce520e928b16bcca2ac50f1a50e72ff7b5..ec6608ba65686e882e551c66a8dbd58c83d4563f 100644 (file)
@@ -1,3 +1,23 @@
+2005-05-19 Paul Jakma <paul.jakma@sun.com>
+
+       * ospf_interface.c: (ospf_if_table_lookup) Fix a serious bug
+         a less serious one. 
+         1: this function is supposed to lookup
+         entries in the oifs ospf_interface route_table and return either
+         an existing oi or NULL to indicate not found, its caller depends
+         on this, yet this function uses route_node_get which /always/
+         returns a route_node - one is created if none exists. Use
+         route_node_lookup instead. This should fix root cause of the
+         reports of the (ospf_add_to_if) assert being hit.
+         2: oi's are inserted into this table with prefixlength set to
+         /32 (indeed, it should be a hash table, not a route_table),
+         however prefixlength to lookup was not changed, if no valid entry
+         can be inserted other than /32, then nothng but /32 should be
+         looked up. This possibly only worked by fluke..
+         Fix confirmed by 2 reporters (one list, one IRC), definitely a
+         backport candidate once it has been incubated in HEAD for a while.
+         Thanks to Patrick Friedel and Ivan Warren for testing.
+         
 2005-05-11 Paul Jakma <paul.jakma@sun.com>
 
        * (general) Fix memory leaks in opaque AS-scope LSAs, reported and
index 35351b57983c1ccea0e8effbc95cd8e8a13ab177..45fa023836508ee1c4c814d10830b6fec035d52a 100644 (file)
@@ -150,14 +150,18 @@ ospf_if_table_lookup (struct interface *ifp, struct prefix *prefix)
 {
   struct prefix p;
   struct route_node *rn;
-  struct ospf_interface *rninfo;
+  struct ospf_interface *rninfo = NULL;
   
   p = *prefix;
-
-  rn = route_node_get (IF_OIFS (ifp), &p);
+  p.prefixlen = IPV4_MAX_PREFIXLEN;
+  
   /* route_node_get implicitely locks */
-  rninfo = (struct ospf_interface *) rn->info;
-  route_unlock_node (rn);
+  if (rn = route_node_lookup (IF_OIFS (ifp), &p))
+    {
+      rninfo = (struct ospf_interface *) rn->info;
+      route_unlock_node (rn);
+    }
+  
   return rninfo;
 }