]> git.puffer.fish Git - mirror/frr.git/commitdiff
BGP: Ensure correct sequence of processing at exit
authorvivek <vivek@cumulusnetworks.com>
Wed, 17 Feb 2016 16:41:33 +0000 (08:41 -0800)
committervivek <vivek@cumulusnetworks.com>
Wed, 17 Feb 2016 18:05:24 +0000 (10:05 -0800)
With VRF support, certain objects are now maintained per BGP instance. At
exit, the list of BGP instances has to be freed only after processing the
per-instance objects.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Fixes: ad4cbda1a32f0bf49d794ab5b156d49f95645871
Ticket: CM-9340
Reviewed By:
Testing Done:

bgpd/bgp_main.c
bgpd/bgpd.c

index 7c1a9ea4a64b6e7159b51da0edc4cb5a7f26c56e..3ea74f2bdbd66252aa88cd05f6651b10245e45f0 100644 (file)
@@ -231,17 +231,17 @@ bgp_exit (int status)
 
   bgp_close();
 
-  /* reverse bgp_master_init */
-  for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
-    bgp_delete (bgp);
-  list_free (bm->bgp);
-
   if (retain_mode)
     if_add_hook (IF_DELETE_HOOK, NULL);
 
   /* free interface and connected route information. */
   bgp_if_finish ();
 
+  /* reverse bgp_master_init */
+  for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
+    bgp_delete (bgp);
+  list_free (bm->bgp);
+
   /* reverse bgp_attr_init */
   bgp_attr_finish ();
 
index ef2004295e3cafe0c4c4db799aae93a243793559..55320179e12da8745484192487b9e960be94f64d 100644 (file)
@@ -7182,13 +7182,13 @@ bgp_if_finish (void)
 
   for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
     {
-      struct listnode *ifnode;
+      struct listnode *ifnode, *ifnnode;
       struct interface *ifp;
   
       if (bgp->inst_type == BGP_INSTANCE_TYPE_VIEW)
         continue;
 
-      for (ALL_LIST_ELEMENTS_RO (vrf_iflist(bgp->vrf_id), ifnode, ifp))
+      for (ALL_LIST_ELEMENTS (vrf_iflist(bgp->vrf_id), ifnode, ifnnode, ifp))
         {
           struct listnode *c_node, *c_nnode;
           struct connected *c;