diff options
Diffstat (limited to 'lib/prefix.h')
| -rw-r--r-- | lib/prefix.h | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/lib/prefix.h b/lib/prefix.h index 1724225817..133264f999 100644 --- a/lib/prefix.h +++ b/lib/prefix.h @@ -45,7 +45,7 @@ * own to simplify internal handling */ struct ethaddr { - u_char octet[ETH_ALEN]; + uint8_t octet[ETH_ALEN]; } __attribute__((packed)); @@ -58,15 +58,15 @@ struct ethaddr { /* EVPN address (RFC 7432) */ struct evpn_addr { - u_char route_type; - u_char ip_prefix_length; + uint8_t route_type; + uint8_t ip_prefix_length; struct ethaddr mac; uint32_t eth_tag; struct ipaddr ip; #if 0 union { - u_char addr; + uint8_t addr; struct in_addr v4_addr; struct in6_addr v6_addr; } ip; @@ -108,10 +108,10 @@ struct evpn_addr { /* FRR generic prefix structure. */ struct prefix { - u_char family; - u_char prefixlen; + uint8_t family; + uint8_t prefixlen; union { - u_char prefix; + uint8_t prefix; struct in_addr prefix4; struct in6_addr prefix6; struct { @@ -119,7 +119,7 @@ struct prefix { struct in_addr adv_router; } lp; struct ethaddr prefix_eth; /* AF_ETHERNET */ - u_char val[16]; + uint8_t val[16]; uintptr_t ptr; struct evpn_addr prefix_evpn; /* AF_EVPN */ } u __attribute__((aligned(8))); @@ -127,56 +127,56 @@ struct prefix { /* IPv4 prefix structure. */ struct prefix_ipv4 { - u_char family; - u_char prefixlen; + uint8_t family; + uint8_t prefixlen; struct in_addr prefix __attribute__((aligned(8))); }; /* IPv6 prefix structure. */ struct prefix_ipv6 { - u_char family; - u_char prefixlen; + uint8_t family; + uint8_t prefixlen; struct in6_addr prefix __attribute__((aligned(8))); }; struct prefix_ls { - u_char family; - u_char prefixlen; + uint8_t family; + uint8_t prefixlen; struct in_addr id __attribute__((aligned(8))); struct in_addr adv_router; }; /* Prefix for routing distinguisher. */ struct prefix_rd { - u_char family; - u_char prefixlen; - u_char val[8] __attribute__((aligned(8))); + uint8_t family; + uint8_t prefixlen; + uint8_t val[8] __attribute__((aligned(8))); }; /* Prefix for ethernet. */ struct prefix_eth { - u_char family; - u_char prefixlen; + uint8_t family; + uint8_t prefixlen; struct ethaddr eth_addr __attribute__((aligned(8))); /* AF_ETHERNET */ }; /* EVPN prefix structure. */ struct prefix_evpn { - u_char family; - u_char prefixlen; + uint8_t family; + uint8_t prefixlen; struct evpn_addr prefix __attribute__((aligned(8))); }; /* Prefix for a generic pointer */ struct prefix_ptr { - u_char family; - u_char prefixlen; + uint8_t family; + uint8_t prefixlen; uintptr_t prefix __attribute__((aligned(8))); }; struct prefix_sg { - u_char family; - u_char prefixlen; + uint8_t family; + uint8_t prefixlen; struct in_addr src __attribute__((aligned(8))); struct in_addr grp; }; @@ -235,11 +235,11 @@ static inline void ipv4_addr_copy(struct in_addr *dst, } #define IPV4_ADDR_COPY(D,S) ipv4_addr_copy((D), (S)) -#define IPV4_NET0(a) ((((u_int32_t) (a)) & 0xff000000) == 0x00000000) -#define IPV4_NET127(a) ((((u_int32_t) (a)) & 0xff000000) == 0x7f000000) -#define IPV4_LINKLOCAL(a) ((((u_int32_t) (a)) & 0xffff0000) == 0xa9fe0000) -#define IPV4_CLASS_DE(a) ((((u_int32_t) (a)) & 0xe0000000) == 0xe0000000) -#define IPV4_MC_LINKLOCAL(a) ((((u_int32_t) (a)) & 0xffffff00) == 0xe0000000) +#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_DE(a) ((((uint32_t)(a)) & 0xe0000000) == 0xe0000000) +#define IPV4_MC_LINKLOCAL(a) ((((uint32_t)(a)) & 0xffffff00) == 0xe0000000) /* Max bit/byte length of IPv6 address. */ #define IPV6_MAX_BYTELEN 16 @@ -275,9 +275,9 @@ extern const char *safi2str(safi_t safi); extern const char *afi2str(afi_t afi); /* Check bit of the prefix. */ -extern unsigned int prefix_bit(const u_char *prefix, const u_char prefixlen); +extern unsigned int prefix_bit(const uint8_t *prefix, const uint8_t prefixlen); extern unsigned int prefix6_bit(const struct in6_addr *prefix, - const u_char prefixlen); + const uint8_t prefixlen); extern struct prefix *prefix_new(void); extern void prefix_free(struct prefix *); @@ -318,7 +318,7 @@ extern void apply_mask_ipv4(struct prefix_ipv4 *); extern int prefix_ipv4_any(const struct prefix_ipv4 *); extern void apply_classful_mask_ipv4(struct prefix_ipv4 *); -extern u_char ip_masklen(struct in_addr); +extern uint8_t ip_masklen(struct in_addr); extern void masklen2ip(const int, struct in_addr *); /* returns the network portion of the host address */ extern in_addr_t ipv4_network_addr(in_addr_t hostaddr, int masklen); |
