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: ad4cbda1a3

Ticket: CM-9340
Reviewed By:
Testing Done:
This commit is contained in:
vivek 2016-02-17 08:41:33 -08:00
parent 71f610777c
commit 46abd3e3e6
2 changed files with 7 additions and 7 deletions

View 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 ();

View 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;