diff --git a/lib/prefix.c b/lib/prefix.c index 2485c3e61b..feaf3e5f1c 100644 --- a/lib/prefix.c +++ b/lib/prefix.c @@ -1439,10 +1439,13 @@ bool ipv4_unicast_valid(const struct in_addr *addr) { in_addr_t ip = ntohl(addr->s_addr); + if (IPV4_CLASS_E(ip)) + return true; + if (IPV4_CLASS_D(ip)) return false; - if (IPV4_NET0(ip) || IPV4_NET127(ip) || IPV4_CLASS_E(ip)) { + if (IPV4_NET0(ip) || IPV4_NET127(ip)) { if (cmd_allow_reserved_ranges_get()) return true; else diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index a1c8cd3059..8cea605f41 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -391,11 +391,10 @@ int zebra_check_addr(const struct prefix *p) if (p->family == AF_INET) { uint32_t addr; - addr = p->u.prefix4.s_addr; - addr = ntohl(addr); + addr = ntohl(p->u.prefix4.s_addr); - if (IPV4_NET127(addr) || IN_CLASSD(addr) - || IPV4_LINKLOCAL(addr)) + if (IPV4_NET127(addr) || IN_CLASSD(addr) || + (IPV4_LINKLOCAL(addr) && !IPV4_CLASS_E(addr))) return 0; } if (p->family == AF_INET6) {