]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib,zebra: Allow class E prefixes in RIB
authorDavid Schweizer <dschweizer@opensourcerouting.org>
Wed, 12 Feb 2025 12:07:38 +0000 (13:07 +0100)
committerDavid Schweizer <dschweizer@opensourcerouting.org>
Fri, 14 Feb 2025 14:05:08 +0000 (15:05 +0100)
Changes allow ipv4 class E addresses and prefixes in the 240.0.0.0/4
range to be configured on interfaces, imported from the kernel routing
table and redistributed as connected routes in zebra by default.

Changes also fix routes with class E prefixes in kernel routing table
getting rejected by zebra during early daemon startup.

Drivin this change in default behavior are cloud providers (with
customers still using obsolete ipv4 protocol, i.e. Azure, AWS) running
out of ip space and abusing class E for addressing instances (announced
via BGP) over tunneling connections back to customers on premise
infrastructure.

Signed-off-by: David Schweizer <dschweizer@opensourcerouting.org>
lib/prefix.c
zebra/zebra_rib.c

index 2485c3e61bdd1ecfe305467aee4ca4b9a19db88f..feaf3e5f1c9ac662cb45411feaf0bafa55b87560 100644 (file)
@@ -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
index a1c8cd305956095c0c7f5dcb173f5b4d25a85f2f..8cea605f41b69a647c110fb6969e888a6ccb2dc2 100644 (file)
@@ -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) {