29 .arc_name =
"ip6-unicast",
30 .node_name =
"nat66-in2out",
34 .arc_name =
"ip6-unicast",
35 .node_name =
"nat66-out2in",
46 u32 static_mapping_buckets = 1024;
47 uword static_mapping_memory_size = 64 << 20;
49 clib_bihash_init_24_8 (&nm->
sm_l,
"nat66-static-map-by-local",
50 static_mapping_buckets, static_mapping_memory_size);
51 clib_bihash_init_24_8 (&nm->
sm_e,
"nat66-static-map-by-external",
52 static_mapping_buckets, static_mapping_memory_size);
62 const char *feature_name;
67 if (i->sw_if_index == sw_if_index)
78 return VNET_API_ERROR_VALUE_EXIST;
80 pool_get (nm->interfaces, interface);
81 interface->sw_if_index = sw_if_index;
89 return VNET_API_ERROR_NO_SUCH_ENTRY;
91 pool_put (nm->interfaces, interface);
94 feature_name = is_inside ?
"nat66-in2out" :
"nat66-out2in";
96 sw_if_index, is_add, 0, 0);
131 if (!clib_bihash_search_24_8
132 (is_local ? &nm->
sm_l : &nm->
sm_e, &kv, &value))
140 u32 vrf_id,
u8 is_add)
157 if (!clib_bihash_search_24_8 (&nm->
sm_l, &kv, &value))
163 return VNET_API_ERROR_VALUE_EXIST;
168 memset (sm, 0,
sizeof (*sm));
180 if (clib_bihash_add_del_24_8 (&nm->
sm_l, &kv, 1))
181 clib_warning (
"nat66-static-map-by-local add key failed");
188 if (clib_bihash_add_del_24_8 (&nm->
sm_e, &kv, 1))
189 clib_warning (
"nat66-static-map-by-external add key failed");
197 return VNET_API_ERROR_NO_SUCH_ENTRY;
200 if (clib_bihash_add_del_24_8 (&nm->
sm_l, &kv, 0))
201 clib_warning (
"nat66-static-map-by-local delete key failed");
208 if (clib_bihash_add_del_24_8 (&nm->
sm_e, &kv, 0))
209 clib_warning (
"nat66-static-map-by-external delete key failed");
void vlib_validate_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
validate a combined counter
#define NAT_INTERFACE_FLAG_IS_OUTSIDE
clib_bihash_24_8_t sm_e
Static mapping by external address lookup table.
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
A high priority source a plugin can use.
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static void vlib_zero_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
Clear a combined counter Clears the set of per-thread counters.
void nat66_static_mappings_walk(nat66_static_mapping_walk_fn_t fn, void *ctx)
#define pool_put(P, E)
Free an object E in pool P.
int(* nat66_static_mapping_walk_fn_t)(nat66_static_mapping_t *sm, void *ctx)
void fib_table_unlock(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Take a reference counting lock on the table.
int nat66_interface_add_del(u32 sw_if_index, u8 is_inside, u8 is_add)
#define clib_warning(format, args...)
snat_interface_t * interfaces
Interface pool.
clib_bihash_24_8_t sm_l
Static mapping by local address lookup table.
VNET_FEATURE_INIT(nat66_in2out, static)
#define NAT_INTERFACE_FLAG_IS_INSIDE
u32 fib_table_find_or_create_and_lock(fib_protocol_t proto, u32 table_id, fib_source_t src)
Get the index of the FIB for a Table-ID.
#define VNET_FEATURES(...)
vlib_combined_counter_main_t session_counters
Session counters.
int(* nat66_interface_walk_fn_t)(snat_interface_t *i, void *ctx)
void nat66_interfaces_walk(nat66_interface_walk_fn_t fn, void *ctx)
char * name
The counter collection's name.
int nat66_static_mapping_add_del(ip6_address_t *l_addr, ip6_address_t *e_addr, u32 vrf_id, u8 is_add)
nat66_static_mapping_t * sm
Static mapping pool.
NAT66 global declarations.
nat66_static_mapping_t * nat66_static_mapping_get(ip6_address_t *addr, u32 fib_index, u8 is_local)
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)