diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2015-06-11 18:11:12 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2015-06-11 18:11:12 +0200 |
commit | 18ff3eddccd3b024677bb9b2f9c5aac8df8ecc35 (patch) | |
tree | 2897fa8a3bac71f7026b833af457a6d65f865f1c /lib/prefix.h | |
parent | When an interface is disabled, a Cumulus kernel patch causes route deletes to (diff) | |
download | frr-18ff3eddccd3b024677bb9b2f9c5aac8df8ecc35.tar.xz frr-18ff3eddccd3b024677bb9b2f9c5aac8df8ecc35.zip |
Zebra: Don't resolve nexthops over default route unless explicitly allowed.
Ensure that resolution of a nexthop using a default route is not done in the
nexthop validation/update code in zebra_rib.c also. This is an addition to
the zebra-nht-no-default.patch which made the checks only in the NHT code. In
the case of scenarios like interface down, this nexthop update code will kick
in first to update the route before the NHT code comes into play; without the
additional fix, this code could incorrectly resolve the nexthop over a default
route, even when disallowed by the administrator.
Diffstat (limited to 'lib/prefix.h')
-rw-r--r-- | lib/prefix.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/prefix.h b/lib/prefix.h index c02317a58..30fdaed3c 100644 --- a/lib/prefix.h +++ b/lib/prefix.h @@ -247,4 +247,18 @@ static inline int ipv4_martian (struct in_addr *addr) return 0; } +static inline int +is_default_prefix (struct prefix *p) +{ + if (!p) + return 0; + + if (((p->family == AF_INET) && (p->u.prefix4.s_addr == INADDR_ANY)) + || ((p->family == AF_INET6) && + !memcmp(&p->u.prefix6, &in6addr_any, sizeof (struct in6_addr)))) + return 1; + + return 0; +} + #endif /* _ZEBRA_PREFIX_H */ |