summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ospfd/ospfd.c27
1 files changed, 26 insertions, 1 deletions
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);
}
}