[PATCH] bird: treat former classe addresses as valid addresses

Dave Taht dave at taht.net
Wed Dec 12 00:26:08 CET 2018


There is no reason to disallow the former class e address
space, except in a bogon file.

---
 lib/ip.c | 8 ++++++--
 lib/ip.h | 2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/ip.c b/lib/ip.c
index 2050d19e..022c7d74 100644
--- a/lib/ip.c
+++ b/lib/ip.c
@@ -100,8 +100,12 @@ ip4_classify(ip4_addr ad)
   if (b >= 0xe0 && b <= 0xef)
     return IADDR_MULTICAST | SCOPE_UNIVERSE;
 
-  if (a == 0xffffffff)
-    return IADDR_BROADCAST | SCOPE_LINK;
+  if (b >= 0xf0)
+    if(a == 0xffffffff) {
+      return IADDR_BROADCAST | SCOPE_LINK;
+    } else {
+      return IADDR_HOST | SCOPE_UNIVERSE;
+    }
 
   return IADDR_INVALID;
 }
diff --git a/lib/ip.h b/lib/ip.h
index 4fbe4407..2d1b4cff 100644
--- a/lib/ip.h
+++ b/lib/ip.h
@@ -312,7 +312,7 @@ static inline int ip6_is_v4mapped(ip6_addr a)
 #endif
 
 static inline int ip4_is_unicast(ip4_addr a)
-{ return _I(a) < 0xe0000000; }
+{ return _I(a) < 0xe0000000 || (_I(a) >= 0xf0000000 && _I(a) != 0xffffffff); }
 
 static inline int ipa_classify_net(ip_addr a)
 { return ipa_zero2(a) ? (IADDR_HOST | SCOPE_UNIVERSE) : ipa_classify(a); }
-- 
2.17.1




More information about the Bird-users mailing list