23 return (ip46_address->ip4.as_u32 == 0);
25 return (ip46_address->as_u64[0] == 0 && ip46_address->as_u64[1] == 0);
32 return (ip46_address->ip4.as_u8[0] == 127);
34 return (ip46_address->as_u64[0] == 0 &&
35 clib_net_to_host_u64 (ip46_address->as_u64[1]) == 1);
41 return (ip4_address->
as_u8[0] == 127);
47 return (ip6_address->
as_u64[0] == 0 &&
48 clib_net_to_host_u64 (ip6_address->
as_u64[1]) == 1);
84 dst->ip4.as_u32 = src->ip4.as_u32;
173 ip4->
data_u32 &= clib_net_to_host_u32 (0xffffffff << (32 - preflen));
185 else if (preflen <= 64)
188 clib_host_to_net_u64 (0xffffffffffffffffL << (64 - preflen));
193 clib_host_to_net_u64 (0xffffffffffffffffL << (128 - preflen));
202 ip->
as_u32 = clib_host_to_net_u32 (~((1 << (32 - pref_len)) - 1));
218 not_mask = (1 << (32 - plen)) - 1;
219 res->
as_u32 = clib_net_to_host_u32 (ip->
as_u32) + not_mask;
230 else if (pref_len <= 64)
233 clib_host_to_net_u64 (0xffffffffffffffffL << (64 - pref_len));
238 mask->
as_u64[0] = 0xffffffffffffffffL;
240 clib_host_to_net_u64 (0xffffffffffffffffL << (128 - pref_len));
251 res->
as_u64[0] = 0xffffffffffffffffL;
252 res->
as_u64[1] = 0xffffffffffffffffL;
256 not_mask = ((
u64) 1 << (64 - plen)) - 1;
257 res->
as_u64[0] = clib_net_to_host_u64 (ip->
as_u64[0]) + not_mask;
258 res->
as_u64[1] = 0xffffffffffffffffL;
262 not_mask = ((
u64) 1 << (128 - plen)) - 1;
263 res->
as_u64[1] = clib_net_to_host_u64 (ip->
as_u64[1]) + not_mask;
290 return (
format (s,
"ip4"));
292 return (
format (s,
"ip6"));
295 return (
format (s,
"unknown"));
307 return (format (s, "%s", #v)); 312 return (
format (s,
"unknon"));
#define foreach_ip_interface_address(lm, a, sw_if_index, loop, body)
fib_protocol_t fp_proto
protocol type
void ip6_preflen_to_mask(u8 pref_len, ip6_address_t *mask)
void ip4_preflen_to_mask(u8 pref_len, ip4_address_t *ip)
enum ip_address_family_t_ ip_address_family_t
void ip_copy(ip46_address_t *dst, ip46_address_t *src, u8 is_ip4)
static uword log2_first_set(uword x)
u8 ip_is_local(u32 fib_index, ip46_address_t *ip46_address, u8 is_ip4)
Checks that an ip is local to the requested fib.
void ip_set(ip46_address_t *dst, void *src, u8 is_ip4)
#define clib_memcpy_fast(a, b, c)
u8 ip_interface_has_address(u32 sw_if_index, ip46_address_t *ip, u8 is_ip4)
ip_lookup_main_t lookup_main
void * ip_interface_get_first_ip(u32 sw_if_index, u8 is_ip4)
void ip6_prefix_max_address_host_order(ip6_address_t *ip, u8 plen, ip6_address_t *res)
vl_api_interface_index_t sw_if_index
void ip4_address_normalize(ip4_address_t *ip4, u8 preflen)
Aggregrate type for a prefix.
u16 fp_len
The mask length.
fib_node_index_t fib_table_lookup(u32 fib_index, const fib_prefix_t *prefix)
Perfom a longest prefix match in the non-forwarding table.
u8 * format_ip_dscp(u8 *s, va_list *va)
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
void ip6_address_normalize(ip6_address_t *ip6, u8 preflen)
int ip6_address_compare(ip6_address_t *a1, ip6_address_t *a2)
u8 * format_ip_address_family(u8 *s, va_list *args)
u32 ip6_mask_to_preflen(ip6_address_t *mask)
int ip4_address_compare(ip4_address_t *a1, ip4_address_t *a2)
u8 ip4_is_local_host(ip4_address_t *ip4_address)
u32 fib_node_index_t
A typedef of a node index.
u32 ip4_mask_to_preflen(ip4_address_t *mask)
u8 ip6_is_local_host(ip6_address_t *ip6_address)
enum fib_entry_flag_t_ fib_entry_flag_t
ip_lookup_main_t lookup_main
enum ip_dscp_t_ ip_dscp_t
static uword ip6_address_is_link_local_unicast(const ip6_address_t *a)
u8 ip_is_zero(ip46_address_t *ip46_address, u8 is_ip4)
void ip4_prefix_max_address_host_order(ip4_address_t *ip, u8 plen, ip4_address_t *res)
u8 ip_is_local_host(ip46_address_t *ip46_address, u8 is_ip4)
ip4_main_t ip4_main
Global ip4 main structure.
static void * ip_interface_address_get_address(ip_lookup_main_t *lm, ip_interface_address_t *a)
fib_entry_flag_t fib_entry_get_flags(fib_node_index_t fib_entry_index)