25 u8 ea_bits_len,
u8 psid_offset,
31 if (ea_bits_len > 0 && (ip6_prefix_len + ea_bits_len) > 64)
50 if (ip4_prefix_len + ea_bits_len < 32)
54 suffix_len = ea_bits_len;
59 suffix_len = 32 - ip4_prefix_len;
63 d->
psid_shift = 16 - psid_length - psid_offset;
66 if (ip6_prefix_len + suffix_len + d->
psid_length > 64)
92 ip4_prefix.
as_u32 = clib_host_to_net_u32(0x14000000);
93 ip6_prefix.
as_u64[0] = clib_host_to_net_u64(0x20010db800000000);
95 ip6_src.
as_u64[0] = clib_host_to_net_u64(0x20010db8ffff0000);
96 map_domain_t * d =
get_domain (&ip4_prefix, 8, &ip6_prefix, 40, &ip6_src, 96, 24, 0, 0, 0,
MAP_DOMAIN_TRANSLATION);
122 ip4_prefix.
as_u32 = clib_host_to_net_u32(0x14000000);
123 ip6_prefix.
as_u64[0] = clib_host_to_net_u64(0x20010db800000000);
125 ip6_src.
as_u64[0] = clib_host_to_net_u64(0x20010db8ffff0000);
126 ip6_src.
as_u64[1] = clib_host_to_net_u64(0x0000000000000001);
128 128, 16, 6, 8, 0, 0);
132 d =
get_domain (&ip4_prefix, 8, &ip6_prefix, 32, &ip6_src,
140 d =
get_domain (&ip4_prefix, 8, &ip6_prefix, 32, &ip6_src,
148 d =
get_domain (&ip4_prefix, 8, &ip6_prefix, 32, &ip6_src,
149 128, 10, 0, 0, 0, 0);
156 d =
get_domain (&ip4_prefix, 8, &ip6_prefix, 32, &ip6_src,
157 128, 16, 0, 0, 0, 0);
164 d =
get_domain (&ip4_prefix, 8, &ip6_prefix, 32, &ip6_src,
165 128, 20, 0, 0, 0, 0);
172 d =
get_domain (&ip4_prefix, 8, &ip6_prefix, 32, &ip6_src,
173 128, 23, 0, 0, 0, 0);
180 d =
get_domain (&ip4_prefix, 8, &ip6_prefix, 32, &ip6_src,
188 #define foreach_test_case \ 195 #define _(_test_name) \ 196 test_ ## _test_name ();
static_always_inline u64 map_get_pfx(map_domain_t *d, u32 addr, u16 port)
manual_print typedef ip4_prefix
static void test_map_t_destaddr(void)
manual_print typedef ip6_prefix
static void test_map_eabits(void)
static map_domain_t * get_domain(ip4_address_t *ip4_prefix, u8 ip4_prefix_len, ip6_address_t *ip6_prefix, u8 ip6_prefix_len, ip6_address_t *ip6_src, u8 ip6_src_len, u8 ea_bits_len, u8 psid_offset, u8 psid_length, u16 mtu, u8 flags)
static void run_tests(void)
#define foreach_test_case
static_always_inline u64 map_get_sfx(map_domain_t *d, u32 addr, u16 port)