summaryrefslogtreecommitdiff
path: root/zebra/zebra_rib.c
diff options
context:
space:
mode:
authorDon Slice <dslice@cumulusnetworks.com>2017-11-01 13:39:16 +0000
committerDon Slice <dslice@cumulusnetworks.com>2017-11-09 10:15:02 -0800
commitfd7fd9e5c4d30afbeb212f76c6b76d0b472e65d0 (patch)
tree62047611d15ffc368184217d3f5257b761fdfa38 /zebra/zebra_rib.c
parent0db8196a967778a8d4e1018329b635b5716d6a08 (diff)
zebra: fix resolving nexthop through itself
Problems reported with zebra nht oscillating when a nexthop is resolved using the same address to reach the nexthop (for example, 10.0.0.8 is resolved via 10.0.0.8/32.) This fix removes this attempt to resolve thru itself unless the route being resolved is also a host route. This fix also walks up the tree looking for a less specific route to reach the nexthop if needed. Smoke testing completed successfully. Ticket: CM-8192 Signed-off-by: Don Slice <dslice@cumulusnetworks.com> Reviewed-by: CCR-6583 Testing done: Manual testing successful, bgp-min completed successfully l3-smoke completed with two test changes required.
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 b5c2bc6dae..2d689fed59 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