]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: set nexthop install state more accurately
authorMark Stapp <mjs@voltanet.io>
Wed, 20 Mar 2019 18:44:29 +0000 (14:44 -0400)
committerMark Stapp <mjs@voltanet.io>
Tue, 28 May 2019 12:22:21 +0000 (08:22 -0400)
When setting route nexthops' installation state based on a
dataplane context struct, unset the installed state if a
nexthop was not present in the dataplane context.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
zebra/zebra_rib.c

index 13799ac8900088e40cdb8fa8065f7c037d20f4bc..977316ef7c1e6561854ee8a82e620fbb5463360c 100644 (file)
@@ -1858,31 +1858,30 @@ static int rib_update_re_from_ctx(struct route_entry *re,
        /* Update zebra nexthop FIB flag for each
         * nexthop that was installed.
         */
-       for (ALL_NEXTHOPS_PTR(dplane_ctx_get_ng(ctx),
-                             ctx_nexthop)) {
+       for (ALL_NEXTHOPS(re->ng, nexthop)) {
 
-               if (!re)
+               if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
                        continue;
 
-               for (ALL_NEXTHOPS(re->ng, nexthop)) {
+               for (ALL_NEXTHOPS_PTR(dplane_ctx_get_ng(ctx),
+                                     ctx_nexthop)) {
+
                        if (nexthop_same(ctx_nexthop, nexthop))
                                break;
                }
 
-               if (nexthop == NULL)
-                       continue;
-
-               if (CHECK_FLAG(nexthop->flags,
-                              NEXTHOP_FLAG_RECURSIVE))
+               /* If the FIB doesn't know about the nexthop,
+                * it's not installed
+                */
+               if (ctx_nexthop == NULL) {
+                       UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
                        continue;
+               }
 
-               if (CHECK_FLAG(ctx_nexthop->flags,
-                              NEXTHOP_FLAG_FIB))
-                       SET_FLAG(nexthop->flags,
-                                NEXTHOP_FLAG_FIB);
+               if (CHECK_FLAG(ctx_nexthop->flags, NEXTHOP_FLAG_FIB))
+                       SET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
                else
-                       UNSET_FLAG(nexthop->flags,
-                                  NEXTHOP_FLAG_FIB);
+                       UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
        }
 
        /* Redistribute */