diff options
author | Mark Stapp <mjs@voltanet.io> | 2019-03-20 19:44:29 +0100 |
---|---|---|
committer | Mark Stapp <mjs@voltanet.io> | 2019-05-28 14:22:21 +0200 |
commit | 5695d9ac5d4095872218e74c203fd7f023833713 (patch) | |
tree | 89720438973819041aeb311ef7fd45c09602c972 /zebra | |
parent | zebra: add api to locate route-node from dplane ctx (diff) | |
download | frr-5695d9ac5d4095872218e74c203fd7f023833713.tar.xz frr-5695d9ac5d4095872218e74c203fd7f023833713.zip |
zebra: set nexthop install state more accurately
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>
Diffstat (limited to 'zebra')
-rw-r--r-- | zebra/zebra_rib.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 13799ac89..977316ef7 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -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 */ |