summaryrefslogtreecommitdiff
path: root/lib/prefix.h
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2022-07-01 23:26:24 +0300
committerDonatas Abraitis <donatas@opensourcerouting.org>2022-07-01 23:38:13 +0300
commitd80132b13720857913e1e78bf61f25655062c488 (patch)
tree312932477f8fec472d22e91fe1605a514bb68e96 /lib/prefix.h
parentac156aecb5f292f565ccd0aeafade4cc0cad6028 (diff)
lib: Allow using IPv4 (Class E) reserved block if enabled
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'lib/prefix.h')
-rw-r--r--lib/prefix.h14
1 files changed, 3 insertions, 11 deletions
diff --git a/lib/prefix.h b/lib/prefix.h
index f9eef28a0b..6c51186f52 100644
--- a/lib/prefix.h
+++ b/lib/prefix.h
@@ -382,6 +382,8 @@ static inline void ipv4_addr_copy(struct in_addr *dst,
#define IPV4_NET0(a) ((((uint32_t)(a)) & 0xff000000) == 0x00000000)
#define IPV4_NET127(a) ((((uint32_t)(a)) & 0xff000000) == 0x7f000000)
#define IPV4_LINKLOCAL(a) ((((uint32_t)(a)) & 0xffff0000) == 0xa9fe0000)
+#define IPV4_CLASS_D(a) ((((uint32_t)(a)) & 0xf0000000) == 0xe0000000)
+#define IPV4_CLASS_E(a) ((((uint32_t)(a)) & 0xf0000000) == 0xf0000000)
#define IPV4_CLASS_DE(a) ((((uint32_t)(a)) & 0xe0000000) == 0xe0000000)
#define IPV4_MC_LINKLOCAL(a) ((((uint32_t)(a)) & 0xffffff00) == 0xe0000000)
@@ -507,17 +509,7 @@ extern int str_to_esi(const char *str, esi_t *esi);
extern char *esi_to_str(const esi_t *esi, char *buf, int size);
extern char *evpn_es_df_alg2str(uint8_t df_alg, char *buf, int buf_len);
extern void prefix_evpn_hexdump(const struct prefix_evpn *p);
-
-static inline bool ipv4_unicast_valid(const struct in_addr *addr)
-{
-
- in_addr_t ip = ntohl(addr->s_addr);
-
- if (IPV4_CLASS_DE(ip))
- return false;
-
- return true;
-}
+extern bool ipv4_unicast_valid(const struct in_addr *addr);
static inline int ipv6_martian(const struct in6_addr *addr)
{