summaryrefslogtreecommitdiff
path: root/lib/prefix.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/prefix.h')
-rw-r--r--lib/prefix.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/prefix.h b/lib/prefix.h
index 9c57283706..90b792b33c 100644
--- a/lib/prefix.h
+++ b/lib/prefix.h
@@ -499,11 +499,8 @@ extern int macstr2prefix_evpn(const char *str, struct prefix_evpn *p);
/* NOTE: This routine expects the address argument in network byte order. */
static inline bool ipv4_martian(const struct in_addr *addr)
{
- in_addr_t ip = ntohl(addr->s_addr);
-
- if (IPV4_NET0(ip) || IPV4_NET127(ip) || !ipv4_unicast_valid(addr)) {
+ if (!ipv4_unicast_valid(addr))
return true;
- }
return false;
}
@@ -601,6 +598,14 @@ static inline bool ipv6_mcast_ssm(const struct in6_addr *addr)
return (bits & 0xfff0ffff) == 0xff300000;
}
+static inline bool ipv6_mcast_reserved(const struct in6_addr *addr)
+{
+ uint32_t bits = ntohl(addr->s6_addr32[0]);
+
+ /* ffx2::/16 */
+ return (bits & 0xff0fffff) == 0xff020000;
+}
+
static inline uint8_t ipv4_mcast_scope(const struct in_addr *addr)
{
uint32_t bits = ntohl(addr->s_addr);