Merge pull request #5192 from donaldsharp/zebra_rejection

zebra: Dissallow a /32 or /128 through itself
This commit is contained in:
Donatas Abraitis 2019-12-03 09:29:50 +02:00 committed by GitHub
commit d79368d3a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1354,6 +1354,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) {