29 int dst_address_length = 128 - i;
30 vec_add1 (table->meta[af].prefix_lengths_in_search_order, dst_address_length);
56 clib_bihash_add_del_24_8 (&table->
ip_hash, &kv, 1 );
87 if (clib_bihash_search_24_8 (&table->
ip_hash, &kv, &val))
91 clib_bihash_add_del_24_8 (&table->
ip_hash, &kv, 0 );
109 u32 af = kv->
key[2] >> 32;
139 sizeof (ip6_address_t));
158 .path =
"cnat snat with",
159 .short_help =
"cnat snat with [<ip4-address>][<ip6-address>]",
199 .path =
"cnat snat exclude",
200 .short_help =
"cnat snat exclude [ip]",
214 format_bihash_24_8, &table->
ip_hash, 1);
221 .path =
"show cnat snat",
222 .short_help =
"show cnat snat",
240 for (j = 0; j < i0; j++)
245 clib_host_to_net_u32 (
pow2_mask (i1) << (32 - i1));
247 clib_bihash_init_24_8 (&table->
ip_hash,
"snat prefixes",
249 clib_bihash_set_kvp_format_fn_24_8 (&table->
ip_hash,
static void cnat_compute_prefix_lengths_in_search_order(cnat_snat_pfx_table_t *table, ip_address_family_t af)
static clib_error_t * cnat_show_snat(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap. ...
int cnat_add_snat_prefix(ip_prefix_t *pfx)
#define ip_addr_version(_a)
static clib_error_t * cnat_set_snat(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
#define clib_memcpy(d, s, n)
int cnat_del_snat_prefix(ip_prefix_t *pfx)
#define VLIB_INIT_FUNCTION(x)
static uword pow2_mask(uword x)
clib_bihash_24_8_t ip_hash
#define clib_error_return(e, args...)
#define clib_bitmap_foreach(i, ai, body)
Macro to iterate across set bits in a bitmap.
static clib_error_t * cnat_snat_exclude(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
uword unformat_ip_address(unformat_input_t *input, va_list *args)
sll srl srl sll sra u16x4 i
#define VLIB_CLI_COMMAND(x,...)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
cnat_snat_pfx_table_t snat_pfx_table
enum ip_address_family_t_ ip_address_family_t
ip6_address_t ip_masks[129]
u8 * format_cnat_snat_prefix(u8 *s, va_list *args)
#define ip_prefix_version(_a)
static clib_error_t * cnat_snat_init(vlib_main_t *vm)
cnat_snat_pfx_table_meta_t meta[2]
uword unformat_ip_prefix(unformat_input_t *input, va_list *args)