]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Prevent installation for a nexthop vrf that is not configed yet
authorDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 27 Mar 2018 18:50:41 +0000 (14:50 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 27 Mar 2018 19:52:26 +0000 (15:52 -0400)
There are many callpaths to get to static_install_route.  The nexthops
each have their own vrf that may or may not be up yet.  If it is
allow the installation.

Doing this check here to avoid having to add this all over the place.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
zebra/zebra_static.c

index 75d625c6b5ccb2b6ac8a8822aeef1b53f3016ad9..c8e49cb293793785b9b0d3435cb292c0c4a66d3f 100644 (file)
@@ -46,12 +46,26 @@ void static_install_route(afi_t afi, safi_t safi, struct prefix *p,
        struct prefix nh_p;
        struct nexthop *nexthop = NULL;
        enum blackhole_type bh_type = 0;
+       struct vrf *nh_vrf;
 
        /* Lookup table.  */
        table = zebra_vrf_table(afi, safi, si->vrf_id);
        if (!table)
                return;
 
+       /*
+        * If a specific vrf is coming up and the nexthop vrf we are
+        * looking at using hasn't been brought up yet, just don't
+        * install the static route yet.
+        * When the nexthop vrf comes up we will get another call
+        * back to do the right thing.  I'm putting this check
+        * here because we are calling static_install_route a bunch
+        * from a bunch of different callpaths.
+        */
+       nh_vrf = vrf_lookup_by_id(si->nh_vrf_id);
+       if (!nh_vrf)
+               return;
+
        memset(&nh_p, 0, sizeof(nh_p));
        if (si->type == STATIC_BLACKHOLE) {
                switch (si->bh_type) {