summaryrefslogtreecommitdiff
path: root/zebra/zebra_nhg.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zebra_nhg.c')
-rw-r--r--zebra/zebra_nhg.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c
index 61ca200a53..1a70250627 100644
--- a/zebra/zebra_nhg.c
+++ b/zebra/zebra_nhg.c
@@ -1364,6 +1364,17 @@ static int nexthop_active(afi_t afi, struct route_entry *re,
}
}
+ if ((top->p.family == AF_INET && top->p.prefixlen == 32
+ && nexthop->gate.ipv4.s_addr == top->p.u.prefix4.s_addr)
+ || (top->p.family == AF_INET6 && top->p.prefixlen == 128
+ && memcmp(&nexthop->gate.ipv6, &top->p.u.prefix6, 16) == 0)) {
+ if (IS_ZEBRA_DEBUG_RIB_DETAILED)
+ zlog_debug(
+ "\t:%s: Attempting to install a max prefixlength route through itself",
+ __PRETTY_FUNCTION__);
+ return 0;
+ }
+
/* Make lookup prefix. */
memset(&p, 0, sizeof(struct prefix));
switch (afi) {
@@ -1685,10 +1696,13 @@ int nexthop_active_update(struct route_node *rn, struct route_entry *re)
new_active =
nexthop_active_check(rn, re, nexthop);
- if (new_active
- && nexthop_group_active_nexthop_num(&new_grp)
- >= zrouter.multipath_num) {
- UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE);
+ if (new_active && curr_active >= zrouter.multipath_num) {
+ struct nexthop *nh;
+
+ /* Set it and its resolved nexthop as inactive. */
+ for (nh = nexthop; nh; nh = nh->resolved)
+ UNSET_FLAG(nh->flags, NEXTHOP_FLAG_ACTIVE);
+
new_active = 0;
}