|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
95 return sizeof (ip6_address_t);
166 switch (
src->version)
186 return sizeof (ip6_address_t);
278 sizeof (
prefix->fp_addr.ip4));
285 sizeof (
prefix->fp_addr.ip6));
338 m = (
u32 *) & mask_6[0];
340 for (j = 0; j < i0; j++)
347 m[i0] = clib_host_to_net_u32 (
pow2_mask (i1) << (32 - i1));
350 for (j = 0; j <
sizeof (mask_6); j++)
352 ip6->as_u8[j] &= mask_6[j];
434 ip6_address_t ip6_addr, ip6_mask;
442 return (((ip6_addr.as_u64[0] & ip6_mask.as_u64[0]) == ip6_addr.as_u64[0]) &&
443 ((ip6_addr.as_u64[1] & ip6_mask.as_u64[1]) == ip6_addr.as_u64[1]));
467 ip4->data_u32 &= clib_net_to_host_u32 (0xffffffff << (32 - preflen));
479 else if (preflen <= 64)
482 clib_host_to_net_u64 (0xffffffffffffffffL << (64 - preflen));
487 clib_host_to_net_u64 (0xffffffffffffffffL << (128 - preflen));
496 ip->as_u32 = clib_host_to_net_u32 (~((1 << (32 - pref_len)) - 1));
502 if (
mask->as_u32 == 0)
512 not_mask = (1 << (32 - plen)) - 1;
513 res->
as_u32 = clib_net_to_host_u32 (
ip->as_u32) + not_mask;
524 else if (pref_len <= 64)
527 clib_host_to_net_u64 (0xffffffffffffffffL << (64 - pref_len));
532 mask->as_u64[0] = 0xffffffffffffffffL;
534 clib_host_to_net_u64 (0xffffffffffffffffL << (128 - pref_len));
545 res->as_u64[0] = 0xffffffffffffffffL;
546 res->as_u64[1] = 0xffffffffffffffffL;
550 not_mask = ((
u64) 1 << (64 - plen)) - 1;
551 res->as_u64[0] = clib_net_to_host_u64 (
ip->as_u64[0]) + not_mask;
552 res->as_u64[1] = 0xffffffffffffffffL;
556 not_mask = ((
u64) 1 << (128 - plen)) - 1;
557 res->as_u64[1] = clib_net_to_host_u64 (
ip->as_u64[1]) + not_mask;
564 if (
mask->as_u64[1] != 0)
566 if (
mask->as_u64[0] != 0)
u32 ip4_mask_to_preflen(ip4_address_t *mask)
int ip_prefix_cmp(ip_prefix_t *p1, ip_prefix_t *p2)
uword unformat_ip_prefix(unformat_input_t *input, va_list *args)
#define clib_memcpy(d, s, n)
static uword pow2_mask(uword x)
static bool ip4_prefix_validate(const ip_prefix_t *ip)
void ip46_address_increment(ip46_type_t type, ip46_address_t *ip)
bool ip_prefix_validate(const ip_prefix_t *ip)
static int ip46_address_cmp(const ip46_address_t *ip46_1, const ip46_address_t *ip46_2)
void ip_prefix_normalize(ip_prefix_t *a)
void ip_address_to_fib_prefix(const ip_address_t *addr, fib_prefix_t *prefix)
convert from a IP address to a FIB prefix
u16 fp_len
The mask length.
#define ip_prefix_addr(_a)
#define ip_prefix_len(_a)
u16 ip_version_to_size(ip_address_family_t af)
void ip_prefix_copy(void *dst, void *src)
void ip_address_from_46(const ip46_address_t *nh, fib_protocol_t fproto, ip_address_t *ip)
u16 ip_address_size(const ip_address_t *a)
#define ip_addr_version(_a)
void ip_address_copy_addr(void *dst, const ip_address_t *src)
uword unformat_ip_address(unformat_input_t *input, va_list *args)
void ip4_preflen_to_mask(u8 pref_len, ip4_address_t *ip)
u8 * format_ip_address(u8 *s, va_list *args)
void ip4_prefix_max_address_host_order(ip4_address_t *ip, u8 plen, ip4_address_t *res)
void ip6_address_normalize(ip6_address_t *ip6, u8 preflen)
void ip6_prefix_max_address_host_order(ip6_address_t *ip, u8 plen, ip6_address_t *res)
u8 * format_ip_prefix(u8 *s, va_list *args)
vnet_link_t ip_address_family_to_link_type(ip_address_family_t af)
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
fib_protocol_t ip_address_to_46(const ip_address_t *addr, ip46_address_t *a)
void ip_address_set(ip_address_t *dst, const void *src, ip_address_family_t af)
fib_protocol_t ip_address_family_to_fib_proto(ip_address_family_t af)
bool ip_address_is_zero(const ip_address_t *ip)
description fragment has unexpected format
static uword log2_first_set(uword x)
u32 ip6_mask_to_preflen(ip6_address_t *mask)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
void ip_address_increment(ip_address_t *ip)
#define ip_prefix_version(_a)
ip_address_family_t ip_address_family_from_fib_proto(fib_protocol_t fp)
#define clib_warning(format, args...)
static bool ip6_prefix_validate(const ip_prefix_t *ip)
int ip_address_cmp(const ip_address_t *ip1, const ip_address_t *ip2)
static void ip_prefix_normalize_ip6(ip6_address_t *ip6, u8 preflen)
void ip_address_copy(ip_address_t *dst, const ip_address_t *src)
void ip4_address_normalize(ip4_address_t *ip4, u8 preflen)
void ip_address_reset(ip_address_t *ip)
static void ip_prefix_normalize_ip4(ip4_address_t *ip4, u8 preflen)
Aggregate type for a prefix.
u8 * ip_addr_bytes(ip_address_t *ip)
enum ip_address_family_t_ ip_address_family_t
void ip6_preflen_to_mask(u8 pref_len, ip6_address_t *mask)
void ip_prefix_to_fib_prefix(const ip_prefix_t *ip_prefix, fib_prefix_t *fib_prefix)
convert from a LISP to a FIB prefix