20 #include <vpp/app/version.h> 33 .arc_name =
"ip6-unicast",
34 .node_name =
"nat66-in2out",
39 .arc_name =
"ip6-unicast",
40 .node_name =
"nat66-out2in",
53 u32 static_mapping_buckets = 1024;
54 uword static_mapping_memory_size = 64 << 20;
62 clib_bihash_init_24_8 (&nm->
sm_l,
"nat66-static-map-by-local",
63 static_mapping_buckets, static_mapping_memory_size);
64 clib_bihash_init_24_8 (&nm->
sm_e,
"nat66-static-map-by-external",
65 static_mapping_buckets, static_mapping_memory_size);
94 const char *feature_name;
99 if (i->sw_if_index == sw_if_index)
110 return VNET_API_ERROR_VALUE_EXIST;
112 pool_get (nm->interfaces, interface);
122 return VNET_API_ERROR_NO_SUCH_ENTRY;
124 pool_put (nm->interfaces, interface);
127 feature_name = is_inside ?
"nat66-in2out" :
"nat66-out2in";
158 sm_key.
addr.as_u64[0] = addr->as_u64[0];
159 sm_key.
addr.as_u64[1] = addr->as_u64[1];
167 if (!clib_bihash_search_24_8
168 (is_local ? &nm->
sm_l : &nm->
sm_e, &kv, &value))
185 sm_key.
addr.as_u64[0] = l_addr->as_u64[0];
186 sm_key.
addr.as_u64[1] = l_addr->as_u64[1];
193 if (!clib_bihash_search_24_8 (&nm->
sm_l, &kv, &value))
199 return VNET_API_ERROR_VALUE_EXIST;
205 sm->
l_addr.as_u64[0] = l_addr->as_u64[0];
206 sm->
l_addr.as_u64[1] = l_addr->as_u64[1];
207 sm->
e_addr.as_u64[0] = e_addr->as_u64[0];
208 sm->
e_addr.as_u64[1] = e_addr->as_u64[1];
216 if (clib_bihash_add_del_24_8 (&nm->
sm_l, &kv, 1))
218 sm_key.
addr.as_u64[0] = e_addr->as_u64[0];
219 sm_key.
addr.as_u64[1] = e_addr->as_u64[1];
224 if (clib_bihash_add_del_24_8 (&nm->
sm_e, &kv, 1))
233 return VNET_API_ERROR_NO_SUCH_ENTRY;
236 if (clib_bihash_add_del_24_8 (&nm->
sm_l, &kv, 0))
238 sm_key.
addr.as_u64[0] = e_addr->as_u64[0];
239 sm_key.
addr.as_u64[1] = e_addr->as_u64[1];
244 if (clib_bihash_add_del_24_8 (&nm->
sm_e, &kv, 0))
272 u32 outside_ip6_vrf_id = 0;
284 .version = VPP_BUILD_VER,
285 .description =
"NAT66",
int(* nat66_interface_walk_fn_t)(nat66_interface_t *i, void *ctx)
enum fib_source_t_ fib_source_t
The different sources that can create a route.
void vlib_validate_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
validate a combined counter
#define NAT66_INTERFACE_FLAG_IS_INSIDE
static void nat66_validate_counters(nat66_main_t *nm, u32 sw_if_index)
fib_source_t nat_fib_src_hi
vlib_simple_counter_main_t in2out_packets
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
add paths without path extensions
static clib_error_t * nat66_init(vlib_main_t *vm)
nat66_interface_t * interfaces
Interface pool.
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.
#define VLIB_INIT_FUNCTION(x)
#define nat66_elog_warn(nat_elog_str)
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
fib_source_t fib_source_allocate(const char *name, fib_source_priority_t prio, fib_source_behaviour_t bh)
char * name
The counter collection's name.
#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)
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
#define FIB_SOURCE_PRIORITY_HI
Some priority values that plugins might use when they are not to concerned where in the list they'll ...
IPv6 shallow virtual reassembly.
vlib_simple_counter_main_t out2in_packets
#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.
clib_error_t * nat66_plugin_api_hookup(vlib_main_t *vm)
int nat66_interface_add_del(u32 sw_if_index, u8 is_inside, u8 is_add)
sll srl srl sll sra u16x4 i
clib_bihash_24_8_t sm_l
Static mapping by local address lookup table.
vlib_main_t vlib_node_runtime_t * node
VNET_FEATURE_INIT(nat66_in2out, static)
void vlib_validate_simple_counter(vlib_simple_counter_main_t *cm, u32 index)
validate a simple counter
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.
static void vlib_zero_simple_counter(vlib_simple_counter_main_t *cm, u32 index)
Clear a simple counter Clears the set of per-thread u16 counters, and the u64 counter.
int ip6_sv_reass_enable_disable_with_refcnt(u32 sw_if_index, int is_enable)
#define VNET_FEATURES(...)
vlib_combined_counter_main_t session_counters
Session counters.
void nat66_interfaces_walk(nat66_interface_walk_fn_t fn, void *ctx)
char * stat_segment_name
Name in stat segment directory.
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.
u32 in2out_node_index
node index
NAT66 global declarations.
nat66_static_mapping_t * nat66_static_mapping_get(ip6_address_t *addr, u32 fib_index, u8 is_local)
#define NAT66_INTERFACE_FLAG_IS_OUTSIDE
vl_api_interface_index_t sw_if_index
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)