summaryrefslogtreecommitdiff
path: root/zebra/zebra_nhg.c
diff options
context:
space:
mode:
authorMark Stapp <mjs@voltanet.io>2020-05-26 17:35:20 -0400
committerMark Stapp <mjs@voltanet.io>2020-07-07 13:14:01 -0400
commit92ad0c558c467d86b9d4cb857b486fa72fb0f94c (patch)
treebc9f5ab191cce528d302b3b2c413d50989459d41 /zebra/zebra_nhg.c
parent0e8542eef3f287d249d0ae09d8a4dbb873ac981c (diff)
zebra: skip un-installed recursive match
Do less work when resolving a recursive route: just skip nexthops if the resolving route is not installed. Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'zebra/zebra_nhg.c')
-rw-r--r--zebra/zebra_nhg.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c
index fc429cf55c..258709ad9b 100644
--- a/zebra/zebra_nhg.c
+++ b/zebra/zebra_nhg.c
@@ -1934,12 +1934,19 @@ static int nexthop_active(afi_t afi, struct route_entry *re,
resolved = 0;
+ /* Only useful if installed */
+ if (!CHECK_FLAG(match->status, ROUTE_ENTRY_INSTALLED)) {
+ if (IS_ZEBRA_DEBUG_NHG_DETAIL)
+ zlog_debug("%s: match %p (%u) not installed",
+ __func__, match,
+ match->nhe->id);
+
+ goto done_with_match;
+ }
+
/* Examine installed nexthops */
nhg = &match->nhe->nhg;
for (ALL_NEXTHOPS_PTR(nhg, newhop)) {
- if (!CHECK_FLAG(match->status,
- ROUTE_ENTRY_INSTALLED))
- continue;
if (!nexthop_valid_resolve(nexthop, newhop))
continue;
@@ -1960,9 +1967,6 @@ static int nexthop_active(afi_t afi, struct route_entry *re,
goto done_with_match;
for (ALL_NEXTHOPS_PTR(nhg, newhop)) {
- if (!CHECK_FLAG(match->status,
- ROUTE_ENTRY_INSTALLED))
- continue;
if (!nexthop_valid_resolve(nexthop, newhop))
continue;