42 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 45 #define vl_api_version(n,v) static u32 api_version=(v); 52 vl_print (handle, (char *)s); \ 64 #define REPLY_MACRO(t) \ 66 unix_shared_memory_queue_t * q = \ 67 vl_api_client_index_to_input_queue (mp->client_index); \ 71 rmp = vl_msg_api_alloc (sizeof (*rmp)); \ 72 rmp->_vl_msg_id = ntohs((t)+sm->msg_id_base); \ 73 rmp->context = mp->context; \ 74 rmp->retval = ntohl(rv); \ 76 vl_msg_api_send_shmem (q, (u8 *)&rmp); \ 79 #define REPLY_MACRO2(t, body) \ 81 unix_shared_memory_queue_t * q = \ 82 vl_api_client_index_to_input_queue (mp->client_index); \ 86 rmp = vl_msg_api_alloc (sizeof (*rmp)); \ 87 rmp->_vl_msg_id = ntohs((t)+sm->msg_id_base); \ 88 rmp->context = mp->context; \ 89 rmp->retval = ntohl(rv); \ 90 do {body;} while (0); \ 91 vl_msg_api_send_shmem (q, (u8 *)&rmp); \ 97 .node_name =
"snat-in2out",
98 .runs_before = (
char *[]){
"snat-out2in", 0},
102 .node_name =
"snat-out2in",
103 .runs_before = (
char *[]){
"ip4-lookup", 0},
107 .node_name =
"snat-in2out-fast",
108 .runs_before = (
char *[]){
"snat-out2in-fast", 0},
112 .node_name =
"snat-out2in-fast",
113 .runs_before = (
char *[]){
"ip4-lookup", 0},
140 #if (1 || CLIB_DEBUG > 0) 142 #define VALIDATE_SW_IF_INDEX(mp) \ 143 do { u32 __sw_if_index = ntohl(mp->sw_if_index); \ 144 vnet_main_t *__vnm = vnet_get_main(); \ 145 if (pool_is_free_index(__vnm->interface_main.sw_interfaces, \ 147 rv = VNET_API_ERROR_INVALID_SW_IF_INDEX; \ 148 goto bad_sw_if_index; \ 152 #define BAD_SW_IF_INDEX_LABEL \ 158 #define VALIDATE_RX_SW_IF_INDEX(mp) \ 159 do { u32 __rx_sw_if_index = ntohl(mp->rx_sw_if_index); \ 160 vnet_main_t *__vnm = vnet_get_main(); \ 161 if (pool_is_free_index(__vnm->interface_main.sw_interfaces, \ 162 __rx_sw_if_index)) { \ 163 rv = VNET_API_ERROR_INVALID_SW_IF_INDEX; \ 164 goto bad_rx_sw_if_index; \ 168 #define BAD_RX_SW_IF_INDEX_LABEL \ 170 bad_rx_sw_if_index: \ 174 #define VALIDATE_TX_SW_IF_INDEX(mp) \ 175 do { u32 __tx_sw_if_index = ntohl(mp->tx_sw_if_index); \ 176 vnet_main_t *__vnm = vnet_get_main(); \ 177 if (pool_is_free_index(__vnm->interface_main.sw_interfaces, \ 178 __tx_sw_if_index)) { \ 179 rv = VNET_API_ERROR_INVALID_SW_IF_INDEX; \ 180 goto bad_tx_sw_if_index; \ 184 #define BAD_TX_SW_IF_INDEX_LABEL \ 186 bad_tx_sw_if_index: \ 192 #define VALIDATE_SW_IF_INDEX(mp) 193 #define BAD_SW_IF_INDEX_LABEL 194 #define VALIDATE_RX_SW_IF_INDEX(mp) 195 #define BAD_RX_SW_IF_INDEX_LABEL 196 #define VALIDATE_TX_SW_IF_INDEX(mp) 197 #define BAD_TX_SW_IF_INDEX_LABEL 223 if (m->external_addr.as_u32 == addr.as_u32)
235 u32 *ses_to_be_removed = 0, *ses_index;
252 return VNET_API_ERROR_NO_SUCH_ENTRY;
258 return VNET_API_ERROR_UNSPECIFIED;
265 if (ses->out2in.addr.as_u32 == addr.as_u32)
267 vec_add1 (ses_to_be_removed, ses - sm->sessions);
268 kv.key = ses->in2out.as_u64;
269 clib_bihash_add_del_8_8 (&sm->in2out, &kv, 0);
270 kv.key = ses->out2in.as_u64;
271 clib_bihash_add_del_8_8 (&sm->out2in, &kv, 0);
272 clib_dlist_remove (sm->list_pool, ses->per_user_index);
273 user_key.addr = ses->in2out.addr;
274 user_key.fib_index = ses->in2out.fib_index;
275 kv.key = user_key.as_u64;
276 if (!clib_bihash_search_8_8 (&sm->user_hash, &kv, &value))
278 u = pool_elt_at_index (sm->users, value.value);
299 v = clib_net_to_host_u32(a->
as_u32) + 1;
300 a->
as_u32 = clib_host_to_net_u32(v);
319 u16 l_port,
u16 e_port,
u32 vrf_id,
int addr_only,
336 return VNET_API_ERROR_NO_SUCH_FIB;
341 m_key.
port = addr_only ? 0 : e_port;
352 return VNET_API_ERROR_VALUE_EXIST;
359 return VNET_API_ERROR_NO_SUCH_FIB;
369 return VNET_API_ERROR_NO_SUCH_FIB;
390 return VNET_API_ERROR_INVALID_VALUE;
401 return VNET_API_ERROR_NO_SUCH_ENTRY;
405 memset (m, 0,
sizeof (*m));
434 return VNET_API_ERROR_NO_SUCH_ENTRY;
472 u32 elt_index, head_index;
479 if (!clib_bihash_search_8_8 (&sm->
user_hash, &kv, &value))
486 elt_index = head->
next;
488 ses_index = elt->
value;
489 while (ses_index != ~0)
495 if ((s->out2in.addr.as_u32 != e_addr.
as_u32) &&
496 (clib_net_to_host_u16 (s->out2in.port) != e_port))
499 value.
key = s->in2out.as_u64;
500 clib_bihash_add_del_8_8 (&sm->
in2out, &value, 0);
501 value.
key = s->out2in.as_u64;
502 clib_bihash_add_del_8_8 (&sm->
out2in, &value, 0);
508 elt_index = elt->
next;
510 ses_index = elt->
value;
517 clib_bihash_add_del_8_8 (&sm->
user_hash, &kv, 0);
569 if (i->sw_if_index == sw_if_index)
572 pool_put (sm->interfaces, i);
574 return VNET_API_ERROR_VALUE_EXIST;
581 return VNET_API_ERROR_NO_SUCH_ENTRY;
597 u32 start_host_order, end_host_order;
604 rv = VNET_API_ERROR_UNIMPLEMENTED;
610 rv = VNET_API_ERROR_FEATURE_DISABLED;
615 start_host_order = clib_host_to_net_u32 (tmp[0]);
617 end_host_order = clib_host_to_net_u32 (tmp[0]);
619 count = (end_host_order - start_host_order) + 1;
629 for (i = 0; i < count; i++)
651 s =
format (0,
"SCRIPT: snat_add_address_range ");
668 memset (rmp, 0,
sizeof (*rmp));
669 rmp->_vl_msg_id = ntohs (VL_API_SNAT_ADDRESS_DETAILS+sm->
msg_id_base);
698 s =
format (0,
"SCRIPT: snat_address_dump ");
719 REPLY_MACRO(VL_API_SNAT_INTERFACE_ADD_DEL_FEATURE_REPLY);
727 s =
format (0,
"SCRIPT: snat_interface_add_del_feature ");
728 s =
format (s,
"sw_if_index %d %s %s",
744 memset (rmp, 0,
sizeof (*rmp));
745 rmp->_vl_msg_id = ntohs (VL_API_SNAT_INTERFACE_DETAILS+sm->
msg_id_base);
767 send_snat_interface_details(i, q, mp->context);
776 s =
format (0,
"SCRIPT: snat_interface_dump ");
787 u16 local_port = 0, external_port = 0;
793 rv = VNET_API_ERROR_UNIMPLEMENTED;
801 local_port = clib_net_to_host_u16 (mp->
local_port);
804 vrf_id = clib_net_to_host_u32 (mp->
vrf_id);
819 s =
format (0,
"SCRIPT: snat_add_static_mapping ");
820 s =
format (s,
"local_addr %U external_addr %U ",
825 s =
format (s,
"local_port %d external_port %d ",
830 s =
format (s,
"vrf %d", clib_net_to_host_u32 (mp->
vrf_id));
843 memset (rmp, 0,
sizeof (*rmp));
844 rmp->_vl_msg_id = ntohs (VL_API_SNAT_STATIC_MAPPING_DETAILS+sm->
msg_id_base);
871 send_snat_static_mapping_details (m, q, mp->context);
880 s =
format (0,
"SCRIPT: snat_static_mapping_dump ");
895 rmp->
vpe_pid = ntohl (getpid());
904 s =
format (0,
"SCRIPT: snat_control_ping ");
937 s =
format (0,
"SCRIPT: snat_show_config ");
943 #define foreach_snat_plugin_api_msg \ 944 _(SNAT_ADD_ADDRESS_RANGE, snat_add_address_range) \ 945 _(SNAT_INTERFACE_ADD_DEL_FEATURE, snat_interface_add_del_feature) \ 946 _(SNAT_ADD_STATIC_MAPPING, snat_add_static_mapping) \ 947 _(SNAT_CONTROL_PING, snat_control_ping) \ 948 _(SNAT_STATIC_MAPPING_DUMP, snat_static_mapping_dump) \ 949 _(SNAT_SHOW_CONFIG, snat_show_config) \ 950 _(SNAT_ADDRESS_DUMP, snat_address_dump) \ 951 _(SNAT_INTERFACE_DUMP, snat_interface_dump) 959 vl_msg_api_set_handlers((VL_API_##N + sm->msg_id_base), \ 961 vl_api_##n##_t_handler, \ 963 vl_api_##n##_t_endian, \ 964 vl_api_##n##_t_print, \ 965 sizeof(vl_api_##n##_t), 1); 974 #define _(n,f) sm->api_main->msg_print_handlers \ 975 [VL_API_##n + sm->msg_id_base] \ 976 = (void *) vl_api_##f##_t_print; 989 name =
format (0,
"snat_%08x%c", api_version, 0);
1015 u16 port_host_byte_order = clib_net_to_host_u16 (k->
port);
1024 port_host_byte_order, 0);
1053 m_key.
port = clib_net_to_host_u16 (match.
port);
1058 if (clib_bihash_search_8_8 (mapping_hash, &kv, &value))
1063 if (clib_bihash_search_8_8 (mapping_hash, &kv, &value))
1091 u32 * address_indexp)
1116 k->
port = clib_host_to_net_u16(portnum);
1117 *address_indexp =
i;
1135 u32 start_host_order, end_host_order;
1146 if (
unformat (line_input,
"%U - %U",
1151 end_addr = start_addr;
1152 else if (
unformat (line_input,
"del"))
1163 start_host_order = clib_host_to_net_u32 (start_addr.
as_u32);
1164 end_host_order = clib_host_to_net_u32 (end_addr.
as_u32);
1166 if (end_host_order < start_host_order)
1169 count = (end_host_order - start_host_order) + 1;
1177 this_addr = start_addr;
1179 for (i = 0; i < count; i++)
1188 case VNET_API_ERROR_NO_SUCH_ENTRY:
1191 case VNET_API_ERROR_UNSPECIFIED:
1205 .path =
"snat add address",
1206 .short_help =
"snat add addresses <ip4-range-start> [- <ip4-range-end>] [del]",
1219 u32 * inside_sw_if_indices = 0;
1220 u32 * outside_sw_if_indices = 0;
1234 vec_add1 (inside_sw_if_indices, sw_if_index);
1237 vec_add1 (outside_sw_if_indices, sw_if_index);
1238 else if (
unformat (line_input,
"del"))
1246 if (
vec_len (inside_sw_if_indices))
1248 for (i = 0; i <
vec_len(inside_sw_if_indices); i++)
1250 sw_if_index = inside_sw_if_indices[
i];
1255 if (
vec_len (outside_sw_if_indices))
1257 for (i = 0; i <
vec_len(outside_sw_if_indices); i++)
1259 sw_if_index = outside_sw_if_indices[
i];
1271 .path =
"set interface snat",
1273 .short_help =
"set interface snat in <intfc> out <intfc> [del]",
1284 u32 l_port = 0, e_port = 0, vrf_id = ~0;
1306 else if (
unformat (line_input,
"vrf %u", &vrf_id))
1308 else if (
unformat (line_input,
"del"))
1317 vrf_id, addr_only, is_add);
1321 case VNET_API_ERROR_INVALID_VALUE:
1324 case VNET_API_ERROR_NO_SUCH_ENTRY:
1330 case VNET_API_ERROR_NO_SUCH_FIB:
1332 case VNET_API_ERROR_VALUE_EXIST:
1356 .path =
"snat add static mapping",
1359 "snat add static mapping local <addr> [<port>] external <addr> [<port>] [vrf <table-id>] [del]",
1366 u32 translation_buckets = 1024;
1367 u32 translation_memory_size = 128<<20;
1368 u32 user_buckets = 128;
1369 u32 user_memory_size = 64<<20;
1370 u32 max_translations_per_user = 100;
1371 u32 outside_vrf_id = 0;
1372 u32 inside_vrf_id = 0;
1373 u32 static_mapping_buckets = 1024;
1374 u32 static_mapping_memory_size = 64<<20;
1375 u8 static_mapping_only = 0;
1376 u8 static_mapping_connection_tracking = 0;
1380 if (
unformat (input,
"translation hash buckets %d", &translation_buckets))
1382 else if (
unformat (input,
"translation hash memory %d",
1383 &translation_memory_size));
1384 else if (
unformat (input,
"user hash buckets %d", &user_buckets))
1386 else if (
unformat (input,
"user hash memory %d",
1389 else if (
unformat (input,
"max translations per user %d",
1390 &max_translations_per_user))
1392 else if (
unformat (input,
"outside VRF id %d",
1395 else if (
unformat (input,
"inside VRF id %d",
1398 else if (
unformat (input,
"static mapping only"))
1400 static_mapping_only = 1;
1401 if (
unformat (input,
"connection tracking"))
1402 static_mapping_connection_tracking = 1;
1422 if (!static_mapping_only ||
1423 (static_mapping_only && static_mapping_connection_tracking))
1425 clib_bihash_init_8_8 (&sm->
in2out,
"in2out", translation_buckets,
1426 translation_memory_size);
1428 clib_bihash_init_8_8 (&sm->
out2in,
"out2in", translation_buckets,
1429 translation_memory_size);
1431 clib_bihash_init_8_8 (&sm->
user_hash,
"users", user_buckets,
1435 "static_mapping_by_local", static_mapping_buckets,
1436 static_mapping_memory_size);
1439 "static_mapping_by_external", static_mapping_buckets,
1440 static_mapping_memory_size);
1449 char * protocol_string =
"unknown";
1450 static char *protocol_strings[] = {
1457 protocol_string = protocol_strings[key->
protocol];
1459 s =
format (s,
"%U proto %s port %d fib %d",
1468 snat_session_t * sess = va_arg (*args, snat_session_t *);
1472 s =
format (s,
" last heard %.2f\n", sess->last_heard);
1473 s =
format (s,
" total pkts %d, total bytes %lld\n",
1474 sess->total_pkts, sess->total_bytes);
1476 s =
format (s,
" static translation\n");
1478 s =
format (s,
" dynamic translation\n");
1487 int verbose = va_arg (*args,
int);
1489 u32 elt_index, head_index;
1491 snat_session_t * sess;
1493 s =
format (s,
"%U: %d dynamic translations, %d static translations\n",
1504 elt_index = head->
next;
1506 session_index = elt->
value;
1508 while (session_index != ~0)
1514 elt_index = elt->
next;
1516 session_index = elt->
value;
1528 s =
format (s,
"local %U external %U vrf %d",
1533 s =
format (s,
"local %U:%d external %U:%d vrf %d",
1555 else if (
unformat (input,
"verbose"))
1575 vlib_cli_output (vm,
"%U %s", format_vnet_sw_interface_name, vnm,
1576 vnet_get_sw_interface (vnm, i->sw_if_index),
1577 i->is_inside ?
"in" :
"out");
1590 vlib_cli_output (vm,
"%U", format_snat_static_mapping, m);
1596 vlib_cli_output (vm,
"%d users, %d outside addresses, %d active sessions," 1597 " %d static mappings",
1614 vlib_cli_output (vm,
"%U", format_snat_user, sm, u, verbose - 1);
1622 vlib_cli_output (vm,
"%U", format_snat_static_mapping, m);
1632 .path =
"show snat",
1633 .short_help =
"show snat",
ip4_address_t external_addr
vnet_config_main_t config_main
u32 translation_memory_size
u8 external_ip_address[16]
clib_bihash_8_8_t static_mapping_by_external
Add/del S-NAT address range.
static vlib_cli_command_t set_interface_snat_command
(constructor) VLIB_CLI_COMMAND (set_interface_snat_command)
u32 sessions_per_user_list_head_index
u32 max_translations_per_user
static void vl_api_snat_interface_add_del_feature_t_handler(vl_api_snat_interface_add_del_feature_t *mp)
sll srl srl sll sra u16x4 i
static void * vl_api_snat_add_static_mapping_t_print(vl_api_snat_add_static_mapping_t *mp, void *handle)
#define REPLY_MACRO2(t, body)
static void * vl_api_snat_interface_add_del_feature_t_print(vl_api_snat_interface_add_del_feature_t *mp, void *handle)
void vl_msg_api_send_shmem(unix_shared_memory_queue_t *q, u8 *elem)
static void vl_api_snat_add_address_range_t_handler(vl_api_snat_add_address_range_t *mp)
u8 static_mapping_connection_tracking
u32 vnet_config_del_feature(vlib_main_t *vm, vnet_config_main_t *cm, u32 config_string_heap_index, u32 feature_index, void *feature_config, u32 n_feature_config_bytes)
ip_lookup_main_t * ip4_lookup_main
u32 * config_index_by_sw_if_index
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
unix_shared_memory_queue_t * vl_api_client_index_to_input_queue(u32 index)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
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. ...
ip_lookup_main_t lookup_main
void snat_add_address(snat_main_t *sm, ip4_address_t *addr)
unformat_function_t unformat_vnet_sw_interface
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
u32 rx_feature_out2in_fast
static clib_error_t * snat_init(vlib_main_t *vm)
snat_interface_t * interfaces
static clib_error_t * add_address_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static void vl_api_snat_add_static_mapping_t_handler(vl_api_snat_add_static_mapping_t *mp)
ethernet_main_t * ethernet_main
static void vl_api_snat_control_ping_t_handler(vl_api_snat_control_ping_t *mp)
static int snat_interface_add_del(u32 sw_if_index, u8 is_inside, int is_del)
u8 * format_snat_key(u8 *s, va_list *args)
vnet_main_t * vnet_get_main(void)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
static void * vl_api_snat_control_ping_t_print(vl_api_snat_control_ping_t *mp, void *handle)
#define VLIB_INIT_FUNCTION(x)
u8 * format_snat_user(u8 *s, va_list *args)
int snat_static_mapping_match(snat_main_t *sm, snat_session_key_t match, snat_session_key_t *mapping, u8 by_external)
Match SNAT static mapping.
#define foreach_snat_plugin_api_msg
snat_static_mapping_t * static_mappings
#define VALIDATE_SW_IF_INDEX(mp)
#define clib_warning(format, args...)
static clib_error_t * snat_plugin_api_hookup(vlib_main_t *vm)
Control ping from the client to the server response.
u32 translation_memory_size
S-NAT static mapping details response.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
VNET_IP4_UNICAST_FEATURE_INIT(ip4_snat_in2out, static)
uword * fib_index_by_table_id
Hash table mapping table id to fib index.
u32 rx_feature_in2out_fast
static void send_snat_static_mapping_details(snat_static_mapping_t *m, unix_shared_memory_queue_t *q, u32 context)
static int is_snat_address_used_in_static_mapping(snat_main_t *sm, ip4_address_t addr)
#define pool_put(P, E)
Free an object E in pool P.
Enable/disable S-NAT feature on the interface reply.
#define VLIB_CONFIG_FUNCTION(x, n,...)
int snat_del_address(snat_main_t *sm, ip4_address_t addr)
#define vec_del1(v, i)
Delete the element at index I.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static void * vl_api_snat_address_dump_t_print(vl_api_snat_address_dump_t *mp, void *handle)
static void increment_v4_address(ip4_address_t *a)
u8 * format_snat_session(u8 *s, va_list *args)
Dump S-NAT static mappings.
u8 external_ip_address[16]
vnet_feature_config_main_t feature_config_mains[VNET_N_IP_FEAT]
rx unicast, multicast, tx interface/feature configuration.
void * vl_msg_api_alloc(int nbytes)
static clib_error_t * show_snat_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static void * vl_api_snat_static_mapping_dump_t_print(vl_api_snat_static_mapping_dump_t *mp, void *handle)
clib_bihash_8_8_t user_hash
#define vec_free(V)
Free vector's memory (no header).
snat_address_t * addresses
static clib_error_t * add_static_mapping_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Dump interfaces with S-NAT feature.
int snat_alloc_outside_address_and_port(snat_main_t *sm, snat_session_key_t *k, u32 *address_indexp)
u32 max_translations_per_user
#define clib_memcpy(a, b, c)
clib_error_t * vlib_plugin_register(vlib_main_t *vm, vnet_plugin_handoff_t *h, int from_early_init)
static void send_snat_interface_details(snat_interface_t *i, unix_shared_memory_queue_t *q, u32 context)
static clib_error_t * snat_config(vlib_main_t *vm, unformat_input_t *input)
8 octet key, 8 octet key value pair
static uword clib_bitmap_get(uword *ai, uword i)
Gets the ith bit value from a bitmap.
clib_bihash_8_8_t static_mapping_by_local
S-NAT address details response.
Add S-NAT address range reply.
Add/delete S-NAT static mapping.
Enable/disable S-NAT feature on the interface.
#define VLIB_CLI_COMMAND(x,...)
#define pool_put_index(p, i)
Free pool element with given index.
int snat_add_static_mapping(ip4_address_t l_addr, ip4_address_t e_addr, u16 l_port, u16 e_port, u32 vrf_id, int addr_only, int is_add)
Add static mapping.
u8 * format_snat_static_mapping(u8 *s, va_list *args)
static void vl_api_snat_show_config_t_handler(vl_api_snat_show_config_t *mp)
u32 vnet_config_add_feature(vlib_main_t *vm, vnet_config_main_t *cm, u32 config_string_heap_index, u32 feature_index, void *feature_config, u32 n_feature_config_bytes)
static void clib_dlist_remove(dlist_elt_t *pool, u32 index)
#define BAD_SW_IF_INDEX_LABEL
snat_session_t * sessions
static vlib_cli_command_t show_snat_command
(constructor) VLIB_CLI_COMMAND (show_snat_command)
static void vl_api_snat_static_mapping_dump_t_handler(vl_api_snat_static_mapping_dump_t *mp)
static void vl_api_snat_interface_dump_t_handler(vl_api_snat_interface_dump_t *mp)
static void * vl_api_snat_add_address_range_t_print(vl_api_snat_add_address_range_t *mp, void *handle)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static vlib_cli_command_t add_address_command
(constructor) VLIB_CLI_COMMAND (add_address_command)
static void * vl_api_snat_show_config_t_print(vl_api_snat_show_config_t *mp, void *handle)
void snat_free_outside_address_and_port(snat_main_t *sm, snat_session_key_t *k, u32 address_index)
static vlib_cli_command_t add_static_mapping_command
(constructor) VLIB_CLI_COMMAND (add_static_mapping_command)
S-NAT interface details response.
static void send_snat_address_details(snat_address_t *a, unix_shared_memory_queue_t *q, u32 context)
static u32 random_u32(u32 *seed)
32-bit random number generator
Show S-NAT plugin startup config reply.
ip4_main_t ip4_main
Global ip4 main structure.
Control ping from client to api server request.
#define vec_foreach(var, vec)
Vector iterator.
static void vl_api_snat_address_dump_t_handler(vl_api_snat_address_dump_t *mp)
static void plugin_custom_dump_configure(snat_main_t *sm)
u16 vl_msg_api_get_msg_ids(char *name, int n)
u8 static_mapping_connection_tracking
#define clib_error_return(e, args...)
Add/delete S-NAT static mapping reply.
ethernet_main_t * ethernet_main
static void * vl_api_snat_interface_dump_t_print(vl_api_snat_interface_dump_t *mp, void *handle)
Show S-NAT plugin startup config.
static clib_error_t * snat_feature_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define snat_is_session_static(s)
Check if SNAT session is created from static mapping.
struct _unix_shared_memory_queue unix_shared_memory_queue_t
static u32 clib_dlist_remove_head(dlist_elt_t *pool, u32 head_index)
static uword pool_elts(void *v)
Number of active elements in a pool.