diff options
Diffstat (limited to 'ospfd/ospfd.c')
| -rw-r--r-- | ospfd/ospfd.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index faec868b2a..cc1404e5e9 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -648,7 +648,6 @@ void ospf_terminate(void) if (listcount(om->ospf) == 0) goto done; - bfd_gbl_exit(); for (ALL_LIST_ELEMENTS(om->ospf, node, nnode, ospf)) ospf_finish(ospf); @@ -697,6 +696,7 @@ static void ospf_finish_final(struct ospf *ospf) struct ospf_area *area; struct ospf_vl_data *vl_data; struct listnode *node, *nnode; + struct ospf_redist *red; int i; QOBJ_UNREG(ospf); @@ -710,7 +710,6 @@ static void ospf_finish_final(struct ospf *ospf) /* Unregister redistribution */ for (i = 0; i < ZEBRA_ROUTE_MAX; i++) { struct list *red_list; - struct ospf_redist *red; red_list = ospf->redist[i]; if (!red_list) @@ -721,7 +720,12 @@ static void ospf_finish_final(struct ospf *ospf) ospf_redist_del(ospf, i, red->instance); } } - ospf_redistribute_default_set(ospf, DEFAULT_ORIGINATE_NONE, 0, 0); + red = ospf_redist_lookup(ospf, DEFAULT_ROUTE, 0); + if (red) { + ospf_routemap_unset(red); + ospf_redist_del(ospf, DEFAULT_ROUTE, 0); + ospf_redistribute_default_set(ospf, DEFAULT_ORIGINATE_NONE, 0, 0); + } for (ALL_LIST_ELEMENTS(ospf->areas, node, nnode, area)) ospf_remove_vls_through_area(ospf, area); @@ -2158,7 +2162,7 @@ static int ospf_vrf_delete(struct vrf *vrf) return 0; } -static void ospf_set_redist_vrf_bitmaps(struct ospf *ospf) +static void ospf_set_redist_vrf_bitmaps(struct ospf *ospf, bool set) { int type; struct list *red_list; @@ -2171,7 +2175,12 @@ static void ospf_set_redist_vrf_bitmaps(struct ospf *ospf) zlog_debug( "%s: setting redist vrf %d bitmap for type %d", __func__, ospf->vrf_id, type); - vrf_bitmap_set(zclient->redist[AFI_IP][type], ospf->vrf_id); + if (set) + vrf_bitmap_set(zclient->redist[AFI_IP][type], + ospf->vrf_id); + else + vrf_bitmap_unset(zclient->redist[AFI_IP][type], + ospf->vrf_id); } } @@ -2201,18 +2210,12 @@ static int ospf_vrf_enable(struct vrf *vrf) __func__, vrf->name, ospf->vrf_id, old_vrf_id); if (old_vrf_id != ospf->vrf_id) { - frr_with_privs(&ospfd_privs) { - /* stop zebra redist to us for old vrf */ - zclient_send_dereg_requests(zclient, - old_vrf_id); - - ospf_set_redist_vrf_bitmaps(ospf); + ospf_set_redist_vrf_bitmaps(ospf, true); - /* start zebra redist to us for new vrf */ - ospf_zebra_vrf_register(ospf); + /* start zebra redist to us for new vrf */ + ospf_zebra_vrf_register(ospf); - ret = ospf_sock_init(ospf); - } + ret = ospf_sock_init(ospf); if (ret < 0 || ospf->fd <= 0) return 0; thread_add_read(master, ospf_read, ospf, ospf->fd, @@ -2242,6 +2245,10 @@ static int ospf_vrf_disable(struct vrf *vrf) if (ospf) { old_vrf_id = ospf->vrf_id; + ospf_zebra_vrf_deregister(ospf); + + ospf_set_redist_vrf_bitmaps(ospf, false); + /* We have instance configured, unlink * from VRF and make it "down". */ |
