25 u8 ea_bits_len,
u8 psid_offset,
32 if (ea_bits_len > 0 && (ip6_prefix_len + ea_bits_len) > 64)
49 if (ip4_prefix_len + ea_bits_len < 32)
53 suffix_len = ea_bits_len;
58 suffix_len = 32 - ip4_prefix_len;
62 d->
psid_shift = 16 - psid_length - psid_offset;
65 if (ip6_prefix_len + suffix_len + d->
psid_length > 64)
91 ip4_prefix.
as_u32 = clib_host_to_net_u32(0x14000000);
92 ip6_prefix.
as_u64[0] = clib_host_to_net_u64(0x20010db800000000);
94 ip6_src.
as_u64[0] = clib_host_to_net_u64(0x20010db8ffff0000);
95 map_domain_t * d =
get_domain (&ip4_prefix, 8, &ip6_prefix, 40, &ip6_src, 96, 24, 0, 0, 0,
MAP_DOMAIN_TRANSLATION);
101 assert(dst6.
as_u64[0] == 0x20010db800a9c9db);
102 assert(dst6.
as_u64[1] == 0x000014a9c9db0000);
121 ip4_prefix.
as_u32 = clib_host_to_net_u32(0x14000000);
122 ip6_prefix.
as_u64[0] = clib_host_to_net_u64(0x20010db800000000);
124 ip6_src.
as_u64[0] = clib_host_to_net_u64(0x20010db8ffff0000);
125 ip6_src.
as_u64[1] = clib_host_to_net_u64(0x0000000000000001);
127 128, 16, 6, 8, 0, 0);
131 d =
get_domain (&ip4_prefix, 8, &ip6_prefix, 32, &ip6_src,
135 assert(dst6.
as_u64[0] == 0x20010db8a0000000);
136 assert(dst6.
as_u64[1] == 0x000014a000000000);
139 d =
get_domain (&ip4_prefix, 8, &ip6_prefix, 32, &ip6_src,
143 assert(dst6.
as_u64[0] == 0x20010db8a9000000);
144 assert(dst6.
as_u64[1] == 0x000014a900000000);
147 d =
get_domain (&ip4_prefix, 8, &ip6_prefix, 32, &ip6_src,
148 128, 10, 0, 0, 0, 0);
151 assert(dst6.
as_u64[0] == 0x20010db8a9c00000);
152 assert(dst6.
as_u64[1] == 0x000014a9c0000000);
155 d =
get_domain (&ip4_prefix, 8, &ip6_prefix, 32, &ip6_src,
156 128, 16, 0, 0, 0, 0);
159 assert(dst6.
as_u64[0] == 0x20010db8a9c90000);
160 assert(dst6.
as_u64[1] == 0x000014a9c9000000);
163 d =
get_domain (&ip4_prefix, 8, &ip6_prefix, 32, &ip6_src,
164 128, 20, 0, 0, 0, 0);
167 assert(dst6.
as_u64[0] == 0x20010db8a9c9d000);
168 assert(dst6.
as_u64[1] == 0x000014a9c9d00000);
171 d =
get_domain (&ip4_prefix, 8, &ip6_prefix, 32, &ip6_src,
172 128, 23, 0, 0, 0, 0);
175 assert(dst6.
as_u64[0] == 0x20010db8a9c9da00);
176 assert(dst6.
as_u64[1] == 0x000014a9c9da0000);
179 d =
get_domain (&ip4_prefix, 8, &ip6_prefix, 32, &ip6_src,
183 assert(dst6.
as_u64[0] == 0x20010db8a8000000);
184 assert(dst6.
as_u64[1] == 0x000014a800000000);
187 #define foreach_test_case \ 194 #define _(_test_name) \ 195 test_ ## _test_name ();
static_always_inline u64 map_get_pfx(map_domain_t *d, u32 addr, u16 port)
static void run_tests(void)
static void test_map_eabits(void)
static void test_map_t_destaddr(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_always_inline u64 map_get_sfx(map_domain_t *d, u32 addr, u16 port)
#define foreach_test_case