summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvivek <vivek@cumulusnetworks.com>2016-02-17 08:41:33 -0800
committervivek <vivek@cumulusnetworks.com>2016-02-17 10:05:24 -0800
commit46abd3e3e6eb1f723ea7905c9919b65f1a76f385 (patch)
tree29340d31a5543be2a21f7ca1a9127b26002b6e6b
parent71f610777c64442c415b1835f8a69d4afca40988 (diff)
BGP: Ensure correct sequence of processing at exit
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:
-rw-r--r--bgpd/bgp_main.c10
-rw-r--r--bgpd/bgpd.c4
2 files changed, 7 insertions, 7 deletions
diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c
index 7c1a9ea4a6..3ea74f2bdb 100644
--- a/bgpd/bgp_main.c
+++ b/bgpd/bgp_main.c
@@ -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 ();
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index ef2004295e..55320179e1 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -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;