From: G. Paul Ziemba Date: Wed, 28 Feb 2018 08:01:13 +0000 (-0800) Subject: ospfd: resend redistribute request to zebra after ospf gets notified of vrf_id X-Git-Tag: frr-5.0-dev~153^2~6 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=3d9f730216e49e10f44cbb7f2237e22bd8368834;p=matthieu%2Ffrr.git ospfd: resend redistribute request to zebra after ospf gets notified of vrf_id Signed-off-by: G. Paul Ziemba --- diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index c8a4dc12cd..26bbc5ee11 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -2049,6 +2049,23 @@ static int ospf_vrf_delete(struct vrf *vrf) return 0; } +static void ospf_set_redist_vrf_bitmaps(struct ospf *ospf) +{ + int type; + struct list *red_list; + + for (type = 0; type < ZEBRA_ROUTE_MAX; type++) { + red_list = ospf->redist[type]; + if (!red_list) + continue; + if (IS_DEBUG_OSPF_EVENT) + 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); + } +} + /* Enable OSPF VRF instance */ static int ospf_vrf_enable(struct vrf *vrf) { @@ -2077,6 +2094,15 @@ static int ospf_vrf_enable(struct vrf *vrf) "ospf_sock_init: could not raise privs, %s", safe_strerror(errno)); } + + /* stop zebra redist to us for old vrf */ + zclient_send_dereg_requests(zclient, old_vrf_id); + + ospf_set_redist_vrf_bitmaps(ospf); + + /* start zebra redist to us for new vrf */ + ospf_zebra_vrf_register(ospf); + ret = ospf_sock_init(ospf); if (ospfd_privs.change(ZPRIVS_LOWER)) { zlog_err( @@ -2088,7 +2114,6 @@ static int ospf_vrf_enable(struct vrf *vrf) thread_add_read(master, ospf_read, ospf, ospf->fd, &ospf->t_read); ospf->oi_running = 1; - ospf_zebra_vrf_register(ospf); ospf_router_id_update(ospf); } }