|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
24 #include <vpp/app/version.h>
27 #include <ct6/ct6.api_enum.h>
28 #include <ct6/ct6.api_types.h>
30 #define REPLY_MSG_ID_BASE cmp->msg_id_base
45 clib_bihash_init_48_8 (&cmp->
session_hash,
"ct6 session table",
65 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
70 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
90 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
95 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
110 int enable_disable = 1;
145 case VNET_API_ERROR_INVALID_SW_IF_INDEX:
147 (0,
"Invalid interface, only works on physical ports");
161 "set ct6 [inside|outside] <interface-name> [disable]",
170 vl_api_ct6_enable_disable_reply_t *rmp;
187 #include <ct6/ct6.api.c>
222 .arc_name =
"ip6-unicast",
223 .node_name =
"ct6-out2in",
230 .arc_name =
"interface-output",
231 .node_name =
"ct6-in2out",
239 .version = VPP_BUILD_VER,
240 .description =
"IPv6 Connection Tracker",
248 int i = va_arg (*args,
int);
250 int verbose = va_arg (*args,
int);
255 s =
format (s,
"\n%6s%6s%40s%6s%40s%6s",
256 "Sess",
"Prot",
"Src",
"Sport",
"Dst",
"Dport");
260 s =
format (s,
"\n%6d%6d%40U%6u%40U%6u",
263 clib_net_to_host_u16 (s0->
key.sport),
265 clib_net_to_host_u16 (s0->
key.dport));
269 if (clib_bihash_search_48_8 (&cmp->
session_hash, &kvp0, &kvp0) < 0)
271 s =
format (s,
" LOOKUP FAIL!");
286 s =
format (s,
" BOGUS LOOKUP RESULT!");
306 if (
unformat (input,
"verbose %d", &verbose))
308 else if (
unformat (input,
"verbose"))
313 s =
format (s,
"Thread %d: %d sessions\n",
i,
338 .path =
"show ip6 connection-tracker",
339 .short_help =
"show ip6 connection-tracker",
349 v0 = clib_net_to_host_u64 (
a->as_u64[0]);
350 v1 = clib_net_to_host_u64 (
a->as_u64[1]);
355 a->as_u64[0] = clib_net_to_host_u64 (v0);
356 a->as_u64[1] = clib_net_to_host_u64 (v1);
367 ct6_session_key_t *key0;
370 u32 recycled = 0, created = 0;
371 int i, num_sessions = 5;
379 if (
unformat (input,
"num-sessions %d", &num_sessions))
392 memset (
src, 0,
sizeof (
src));
393 memset (
dst, 0,
sizeof (
dst));
405 key0 = (ct6_session_key_t *) & kvp0;
406 memset (&kvp0, 0,
sizeof (kvp0));
408 for (
i = 0;
i < num_sessions;
i++)
414 key0->sport = clib_host_to_net_u16 (1234);
415 key0->dport = clib_host_to_net_u16 (4321);
419 (cmp, &kvp0, 3.0 , 0 ,
420 &recycled, &created);
470 .path =
"test ip6 connection-tracker",
471 .short_help =
"test ip6 connection-tracker",
483 if (
unformat (input,
"session-hash-buckets %u",
486 else if (
unformat (input,
"session-hash-memory %U",
489 else if (
unformat (input,
"session-timeout %f",
#define VALIDATE_SW_IF_INDEX(mp)
static u32 vlib_num_workers()
static clib_error_t * set_ct6_enable_disable_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
vnet_sw_interface_type_t type
static void ethernet_setup_node(vlib_main_t *vm, u32 node_index)
static vlib_cli_command_t set_ct6_command
(constructor) VLIB_CLI_COMMAND (set_ct6_command)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
#define clib_error_return(e, args...)
static void ct6_update_session_hit(ct6_main_t *cmp, ct6_session_t *s0, f64 now)
static void increment_v6_address(ip6_address_t *a)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
vlib_node_registration_t ct6_in2out_node
(constructor) VLIB_REGISTER_NODE (ct6_in2out_node)
VNET_FEATURE_INIT(ct6out2in, static)
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
static vlib_cli_command_t test_ct6_command_fn_command
(constructor) VLIB_CLI_COMMAND (test_ct6_command_fn_command)
#define VLIB_CONFIG_FUNCTION(x, n,...)
clib_bihash_48_8_t session_hash
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
static void setup_message_id_table(api_main_t *am)
#define pool_foreach(VAR, POOL)
Iterate through pool.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static void vl_api_ct6_enable_disable_t_handler(vl_api_ct6_enable_disable_t *mp)
ct6_session_t ** sessions
vnet_main_t * vnet_get_main(void)
int ct6_out2in_enable_disable(ct6_main_t *cmp, u32 sw_if_index, int enable_disable)
static void ct6_feature_init(ct6_main_t *cmp)
sll srl srl sll sra u16x4 i
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
#define VLIB_CLI_COMMAND(x,...)
static vlib_cli_command_t show_ct6_command_fn_command
(constructor) VLIB_CLI_COMMAND (show_ct6_command_fn_command)
uword session_hash_memory
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
vnet_sw_interface_t * sw_interfaces
#define BAD_SW_IF_INDEX_LABEL
ct6_session_t * ct6_create_or_recycle_session(ct6_main_t *cmp, clib_bihash_kv_48_8_t *kvpp, f64 now, u32 my_thread_index, u32 *recyclep, u32 *createp)
#define vec_free(V)
Free vector's memory (no header).
unformat_function_t unformat_vnet_sw_interface
description fragment has unexpected format
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header,...
#define VLIB_INIT_FUNCTION(x)
static uword pool_elts(void *v)
Number of active elements in a pool.
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)
#define VNET_FEATURES(...)
u8 * format_ct6_session(u8 *s, va_list *args)
int ct6_in2out_enable_disable(ct6_main_t *cmp, u32 sw_if_index, int enable_disable)
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
u32 max_sessions_per_worker
vl_api_interface_index_t sw_if_index
static clib_error_t * ct6_init(vlib_main_t *vm)
f64 session_timeout_interval
static clib_error_t * ct6_config(vlib_main_t *vm, unformat_input_t *input)
@ VNET_SW_INTERFACE_TYPE_HARDWARE
vl_api_interface_index_t sw_if_index
static clib_error_t * test_ct6_command_fn_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
vnet_interface_main_t interface_main
static clib_error_t * show_ct6_command_fn_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)