diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2022-07-01 23:26:24 +0300 |
|---|---|---|
| committer | Donatas Abraitis <donatas@opensourcerouting.org> | 2022-07-01 23:38:13 +0300 |
| commit | d80132b13720857913e1e78bf61f25655062c488 (patch) | |
| tree | 312932477f8fec472d22e91fe1605a514bb68e96 /lib/prefix.c | |
| parent | ac156aecb5f292f565ccd0aeafade4cc0cad6028 (diff) | |
lib: Allow using IPv4 (Class E) reserved block if enabled
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'lib/prefix.c')
| -rw-r--r-- | lib/prefix.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/prefix.c b/lib/prefix.c index 1a3efd32b1..e64b10bf24 100644 --- a/lib/prefix.c +++ b/lib/prefix.c @@ -21,6 +21,7 @@ #include <zebra.h> +#include "command.h" #include "prefix.h" #include "ipaddr.h" #include "vty.h" @@ -1386,6 +1387,23 @@ char *evpn_es_df_alg2str(uint8_t df_alg, char *buf, int buf_len) return buf; } +bool ipv4_unicast_valid(const struct in_addr *addr) +{ + in_addr_t ip = ntohl(addr->s_addr); + + if (IPV4_CLASS_D(ip)) + return false; + + if (IPV4_CLASS_E(ip)) { + if (cmd_allow_reserved_ranges_get()) + return true; + else + return false; + } + + return true; +} + printfrr_ext_autoreg_p("EA", printfrr_ea); static ssize_t printfrr_ea(struct fbuf *buf, struct printfrr_eargs *ea, const void *ptr) |
