lib: Convert ipv4_martian to bool

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
This commit is contained in:
Donatas Abraitis 2022-07-01 23:27:56 +03:00
parent d80132b137
commit e66b8e3942

View File

@ -526,14 +526,14 @@ static inline int ipv6_martian(const struct in6_addr *addr)
extern int macstr2prefix_evpn(const char *str, struct prefix_evpn *p); extern int macstr2prefix_evpn(const char *str, struct prefix_evpn *p);
/* NOTE: This routine expects the address argument in network byte order. */ /* NOTE: This routine expects the address argument in network byte order. */
static inline int ipv4_martian(const struct in_addr *addr) static inline bool ipv4_martian(const struct in_addr *addr)
{ {
in_addr_t ip = ntohl(addr->s_addr); in_addr_t ip = ntohl(addr->s_addr);
if (IPV4_NET0(ip) || IPV4_NET127(ip) || !ipv4_unicast_valid(addr)) { if (IPV4_NET0(ip) || IPV4_NET127(ip) || !ipv4_unicast_valid(addr)) {
return 1; return true;
} }
return 0; return false;
} }
static inline bool is_default_prefix4(const struct prefix_ipv4 *p) static inline bool is_default_prefix4(const struct prefix_ipv4 *p)