summaryrefslogtreecommitdiff
path: root/zebra/zebra_rib.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@openbsd.org>2017-11-23 10:13:18 -0200
committerGitHub <noreply@github.com>2017-11-23 10:13:18 -0200
commit67f1e3aa18a5b7356a3ea91e5188aff814d4a6ac (patch)
treead57d28f48c65b1dfdffa43d913d1d8af9d25c1d /zebra/zebra_rib.c
parentfcaae8e4ec680ad1b5d73d7ee2d30c5974192491 (diff)
parent6f593e8003c043c09d1c3a15cf0f64768a3d8906 (diff)
Merge pull request #1434 from dslicenc/zebra-nexthop-cm8192
zebra: fix resolving nexthop through itself
Diffstat (limited to 'zebra/zebra_rib.c')
-rw-r--r--zebra/zebra_rib.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 5e0baf807d..e96a988edf 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -449,9 +449,15 @@ static int nexthop_active(afi_t afi, struct route_entry *re,
while (rn) {
route_unlock_node(rn);
- /* If lookup self prefix return immediately. */
- if (rn == top)
- return 0;
+ /* Lookup should halt if we've matched against ourselves ('top',
+ * if specified) - i.e., we cannot have a nexthop NH1 is
+ * resolved by a route NH1. The exception is if the route is a
+ * host route.
+ */
+ if (top && rn == top)
+ if (((afi == AFI_IP) && (rn->p.prefixlen != 32)) ||
+ ((afi == AFI_IP6) && (rn->p.prefixlen != 128)))
+ return 0;
/* Pick up selected route. */
/* However, do not resolve over default route unless explicitly