]> git.proxmox.com Git - mirror_frr.git/commitdiff
ospfd: Remove oi field from LSA, have network_lsa_refresh look up when needed
authorPaul Jakma <paul@quagga.net>
Thu, 15 Apr 2010 07:11:51 +0000 (08:11 +0100)
committerPaul Jakma <paul@quagga.net>
Wed, 8 Dec 2010 17:13:19 +0000 (17:13 +0000)
* ospf_lsa.h: (struct ospf_lsa) remove oi pointer
* ospf_lsa.c: (ospf_network_lsa_refresh) instead of keeping a pointer, just
  lookup the oi when it's needed. This decouples network LSA from oi lifetime
  and avoids having to invalidate pointers in LSAs when an oi changes,
  simplifying the code.

ospfd/ospf_lsa.c
ospfd/ospf_lsa.h

index 7e71b5d78c1b0e3f6ee6a207e33fabacccaeb71b..842df49c0c9afebd63359be74927cdd64b733041 100644 (file)
@@ -1045,7 +1045,6 @@ ospf_network_lsa_new (struct ospf_interface *oi)
     }
   
   new->area = oi->area;
-  new->oi = oi;
   SET_FLAG (new->flags, OSPF_LSA_SELF | OSPF_LSA_SELF_CHECKED);
 
   /* Copy LSA to store. */
@@ -1114,10 +1113,23 @@ ospf_network_lsa_refresh (struct ospf_lsa *lsa)
   struct ospf_area *area = lsa->area;
   struct ospf_lsa *new, *new2;
   struct ospf_if_params *oip;
-  struct ospf_interface *oi = lsa->oi;
+  struct ospf_interface *oi;
   
   assert (lsa->data);
-
+  
+  /* Retrieve the oi for the network LSA */
+  oi = ospf_if_lookup_by_local_addr (area->ospf, NULL, lsa->data->id);
+  if (oi == NULL)
+    {
+      if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
+        {
+          zlog_debug ("LSA[Type%d:%s]: network-LSA refresh: "
+                      "no oi found, ick, ignoring.",
+                     lsa->data->type, inet_ntoa (lsa->data->id));
+          ospf_lsa_header_dump (lsa->data);
+        }
+      return NULL;
+    }
   /* Delete LSA from neighbor retransmit-list. */
   ospf_ls_retransmit_delete_nbr_area (area, lsa);
 
index 0959a6382b3da2f178c3f66db4b505fb03f3cac2..fee34708b8b411500be57e15db560bfac41dc2cf 100644 (file)
@@ -114,9 +114,6 @@ struct ospf_lsa
 
   /* Refreshement List or Queue */
   int refresh_list;
-
-  /* For Type-9 Opaque-LSAs or Type-2 Network-LSAs */
-  struct ospf_interface *oi;
 };
 
 /* OSPF LSA Link Type. */