|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
21 #include <vpp/app/version.h>
29 .arc_name =
"ip6-unicast",
30 .node_name =
"nat66-in2out",
35 .arc_name =
"ip6-unicast",
36 .node_name =
"nat66-out2in",
43 #define fail_if_enabled() \
46 nat66_main_t *nm = &nat66_main; \
47 if (PREDICT_FALSE (nm->enabled)) \
49 nat66_elog_warn ("plugin enabled"); \
55 #define fail_if_disabled() \
58 nat66_main_t *nm = &nat66_main; \
59 if (PREDICT_FALSE (!nm->enabled)) \
61 nat66_elog_warn ("plugin disabled"); \
74 nm->session_counters.name =
"session counters";
75 nm->in2out_packets.name =
"in2out";
76 nm->in2out_packets.stat_segment_name =
"/nat64/in2out";
77 nm->out2in_packets.name =
"out2in";
78 nm->out2in_packets.stat_segment_name =
"/nat64/out2in";
90 u32 static_mapping_buckets = 1024;
91 uword static_mapping_memory_size = 64 << 20;
95 clib_bihash_init_24_8 (&
nm->sm_l,
"nat66-static-map-by-local",
96 static_mapping_buckets, static_mapping_memory_size);
97 clib_bihash_init_24_8 (&
nm->sm_e,
"nat66-static-map-by-external",
98 static_mapping_buckets, static_mapping_memory_size);
132 clib_bihash_free_24_8 (&
nm->sm_l);
133 clib_bihash_free_24_8 (&
nm->sm_e);
160 const char *feature_name;
176 return VNET_API_ERROR_VALUE_EXIST;
188 return VNET_API_ERROR_NO_SUCH_ENTRY;
193 feature_name = is_inside ?
"nat66-in2out" :
"nat66-out2in";
222 sm_key.
addr.as_u64[0] =
addr->as_u64[0];
223 sm_key.
addr.as_u64[1] =
addr->as_u64[1];
231 if (!clib_bihash_search_24_8
251 sm_key.
addr.as_u64[0] = l_addr->as_u64[0];
252 sm_key.
addr.as_u64[1] = l_addr->as_u64[1];
259 if (!clib_bihash_search_24_8 (&
nm->sm_l, &kv, &
value))
265 return VNET_API_ERROR_VALUE_EXIST;
271 sm->
l_addr.as_u64[0] = l_addr->as_u64[0];
272 sm->
l_addr.as_u64[1] = l_addr->as_u64[1];
273 sm->
e_addr.as_u64[0] = e_addr->as_u64[0];
274 sm->
e_addr.as_u64[1] = e_addr->as_u64[1];
282 if (clib_bihash_add_del_24_8 (&
nm->sm_l, &kv, 1))
284 sm_key.
addr.as_u64[0] = e_addr->as_u64[0];
285 sm_key.
addr.as_u64[1] = e_addr->as_u64[1];
290 if (clib_bihash_add_del_24_8 (&
nm->sm_e, &kv, 1))
299 return VNET_API_ERROR_NO_SUCH_ENTRY;
302 if (clib_bihash_add_del_24_8 (&
nm->sm_l, &kv, 0))
304 sm_key.
addr.as_u64[0] = e_addr->as_u64[0];
305 sm_key.
addr.as_u64[1] = e_addr->as_u64[1];
310 if (clib_bihash_add_del_24_8 (&
nm->sm_e, &kv, 0))
334 .version = VPP_BUILD_VER,
335 .description =
"NAT66",
nat66_static_mapping_t * nat66_static_mapping_get(ip6_address_t *addr, u32 fib_index, u8 is_local)
int nat66_interface_add_del(u32 sw_if_index, u8 is_inside, u8 is_add)
clib_error_t * nat66_plugin_api_hookup(vlib_main_t *vm)
void nat66_interfaces_walk(nat66_interface_walk_fn_t fn, void *ctx)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
void vlib_clear_combined_counters(vlib_combined_counter_main_t *cm)
Clear a collection of combined counters.
nat44_ei_interface_t * interfaces
int nat66_plugin_enable(u32 outside_vrf)
void vlib_validate_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
validate a combined counter
int(* nat66_static_mapping_walk_fn_t)(nat66_static_mapping_t *sm, void *ctx)
#define pool_put(P, E)
Free an object E in pool P.
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
int ip6_sv_reass_enable_disable_with_refcnt(u32 sw_if_index, int is_enable)
void nat66_static_mappings_walk(nat66_static_mapping_walk_fn_t fn, void *ctx)
#define NAT66_INTERFACE_FLAG_IS_INSIDE
#define nat66_elog_warn(nat_elog_str)
#define NAT66_INTERFACE_FLAG_IS_OUTSIDE
#define nat66_interface_is_outside(i)
int(* nat66_interface_walk_fn_t)(nat66_interface_t *i, void *ctx)
int nat66_static_mapping_add_del(ip6_address_t *l_addr, ip6_address_t *e_addr, u32 vrf_id, u8 is_add)
#define pool_foreach(VAR, POOL)
Iterate through pool.
IPv6 shallow virtual reassembly.
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_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
Clear a combined counter Clears the set of per-thread counters.
sll srl srl sll sra u16x4 i
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
fib_source_t fib_source_allocate(const char *name, fib_source_priority_t prio, fib_source_behaviour_t bh)
#define FIB_SOURCE_PRIORITY_HI
Some priority values that plugins might use when they are not to concerned where in the list they'll ...
static void nat66_validate_counters(nat66_main_t *nm, u32 sw_if_index)
int nat66_plugin_disable()
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.
#define fail_if_enabled()
#define VLIB_INIT_FUNCTION(x)
void vlib_validate_simple_counter(vlib_simple_counter_main_t *cm, u32 index)
validate a simple counter
#define nat66_interface_is_inside(i)
#define fail_if_disabled()
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)
static clib_error_t * nat66_init(vlib_main_t *vm)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
#define VNET_FEATURES(...)
#define pool_dup(P)
Return copy of pool without alignment.
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
void fib_table_unlock(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Take a reference counting lock on the table.
@ FIB_SOURCE_BH_SIMPLE
add paths without path extensions
#define pool_free(p)
Free a pool.
NAT66 global declarations.
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
vl_api_interface_index_t sw_if_index
void vlib_clear_simple_counters(vlib_simple_counter_main_t *cm)
Clear a collection of simple counters.
VNET_FEATURE_INIT(nat66_in2out, static)