]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospfd: resend redistribute request to zebra after ospf gets notified of vrf_id
authorG. Paul Ziemba <paulz@labn.net>
Wed, 28 Feb 2018 08:01:13 +0000 (00:01 -0800)
committerLou Berger <lberger@labn.net>
Fri, 9 Mar 2018 21:42:40 +0000 (16:42 -0500)
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
ospfd/ospfd.c

index c8a4dc12cdc6991d7ccbb19ee08bbd70159ec0cf..26bbc5ee11cd9d4133b7d4ff1613f26ec8fe0d49 100644 (file)
@@ -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);
                }
        }