34 #define vl_api_nat44_lb_addr_port_t_endian vl_noop_handler 35 #define vl_api_nat44_add_del_lb_static_mapping_t_endian vl_noop_handler 36 #define vl_api_nat44_nat44_lb_static_mapping_details_t_endian vl_noop_handler 48 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 50 #define REPLY_MSG_ID_BASE sm->msg_id_base 54 #define vl_api_version(n,v) static u32 api_version=(v); 61 vl_print (handle, (char *)s); \ 80 rmp->
vpe_pid = ntohl (getpid ());
90 s =
format (0,
"SCRIPT: nat_control_ping ");
134 s =
format (0,
"SCRIPT: nat_show_config ");
143 vl_api_nat_set_workers_reply_t *rmp;
150 rv = VNET_API_ERROR_UNSUPPORTED;
158 rv = VNET_API_ERROR_FEATURE_DISABLED;
179 s =
format (0,
"SCRIPT: nat_set_workers ");
205 memset (rmp, 0,
sizeof (*rmp));
206 rmp->_vl_msg_id = ntohs (VL_API_NAT_WORKER_DETAILS + sm->
msg_id_base);
240 s =
format (0,
"SCRIPT: nat_worker_dump ");
250 vl_api_nat_ipfix_enable_disable_reply_t *rmp;
259 REPLY_MACRO (VL_API_NAT_IPFIX_ENABLE_DISABLE_REPLY);
268 s =
format (0,
"SCRIPT: nat_ipfix_enable_disable ");
272 s =
format (s,
"src_port %d ", clib_net_to_host_u16 (mp->
src_port));
274 s =
format (s,
"disable ");
283 vl_api_nat_set_reass_reply_t *rmp;
298 s =
format (0,
"SCRIPT: nat_set_reass ");
299 s =
format (s,
"timeout %d max_reass %d max_frag %d drop_frag %d is_ip6 %d",
300 clib_host_to_net_u32 (mp->
timeout),
334 s =
format (0,
"SCRIPT: nat_get_reass");
353 memset (rmp, 0,
sizeof (*rmp));
354 rmp->_vl_msg_id = ntohs (VL_API_NAT_REASS_DETAILS + sm->
msg_id_base);
358 rmp->
proto = reass->key.proto;
359 rmp->
frag_id = ntohl (reass->key.frag_id);
360 rmp->
frag_n = reass->frag_n;
376 memset (rmp, 0,
sizeof (*rmp));
377 rmp->_vl_msg_id = ntohs (VL_API_NAT_REASS_DETAILS + sm->
msg_id_base);
381 rmp->
proto = reass->key.proto;
382 rmp->
frag_id = ntohl (reass->key.frag_id);
383 rmp->
frag_n = reass->frag_n;
414 s =
format (0,
"SCRIPT: nat_reass_dump");
423 vl_api_nat_set_timeouts_reply_t *rmp;
450 s =
format (0,
"SCRIPT: nat_set_timeouts ");
451 s =
format (s,
"udp %d tcp_established %d tcp_transitory %d icmp %d\n",
482 s =
format (0,
"SCRIPT: nat_get_timeouts");
492 vl_api_nat_set_addr_and_port_alloc_alg_reply_t *rmp;
494 u16 port_start, port_end;
498 rv = VNET_API_ERROR_UNSUPPORTED;
504 case NAT_ADDR_AND_PORT_ALLOC_ALG_DEFAULT:
507 case NAT_ADDR_AND_PORT_ALLOC_ALG_MAPE:
511 case NAT_ADDR_AND_PORT_ALLOC_ALG_RANGE:
514 if (port_end <= port_start)
516 rv = VNET_API_ERROR_INVALID_VALUE;
522 rv = VNET_API_ERROR_INVALID_VALUE;
527 REPLY_MACRO (VL_API_NAT_SET_ADDR_AND_PORT_ALLOC_ALG_REPLY);
535 s =
format (0,
"SCRIPT: nat_set_addr_and_port_alloc_alg ");
536 s =
format (s,
"alg %d psid_offset %d psid_length %d psid %d start_port %d " 554 REPLY_MACRO2 (VL_API_NAT_GET_ADDR_AND_PORT_ALLOC_ALG_REPLY,
571 s =
format (0,
"SCRIPT: nat_get_addr_and_port_alloc_alg");
580 vl_api_nat_set_mss_clamping_reply_t *rmp;
600 s =
format (0,
"SCRIPT: nat_set_mss_clamping enable %d mss_value %d\n",
628 s =
format (0,
"SCRIPT: nat_get_mss_clamping");
641 vl_api_nat44_add_del_address_range_reply_t *rmp;
643 u32 start_host_order, end_host_order;
651 rv = VNET_API_ERROR_UNSUPPORTED;
657 rv = VNET_API_ERROR_FEATURE_DISABLED;
662 start_host_order = clib_host_to_net_u32 (tmp[0]);
664 end_host_order = clib_host_to_net_u32 (tmp[0]);
666 count = (end_host_order - start_host_order) + 1;
668 vrf_id = clib_host_to_net_u32 (mp->
vrf_id);
677 for (i = 0; i <
count; i++)
694 REPLY_MACRO (VL_API_NAT44_ADD_DEL_ADDRESS_RANGE_REPLY);
702 s =
format (0,
"SCRIPT: nat44_add_address_range ");
721 memset (rmp, 0,
sizeof (*rmp));
722 rmp->_vl_msg_id = ntohs (VL_API_NAT44_ADDRESS_DETAILS + sm->
msg_id_base);
765 s =
format (0,
"SCRIPT: nat44_address_dump ");
775 vl_api_nat44_interface_add_del_feature_reply_t *rmp;
786 REPLY_MACRO (VL_API_NAT44_INTERFACE_ADD_DEL_FEATURE_REPLY);
794 s =
format (0,
"SCRIPT: nat44_interface_add_del_feature ");
795 s =
format (s,
"sw_if_index %d %s %s",
810 memset (rmp, 0,
sizeof (*rmp));
811 rmp->_vl_msg_id = ntohs (VL_API_NAT44_INTERFACE_DETAILS + sm->
msg_id_base);
835 send_nat44_interface_details(i, reg, mp->context);
846 s =
format (0,
"SCRIPT: nat44_interface_dump ");
856 vl_api_nat44_interface_add_del_output_feature_reply_t *rmp;
863 rv = VNET_API_ERROR_UNSUPPORTED;
874 REPLY_MACRO (VL_API_NAT44_INTERFACE_ADD_DEL_OUTPUT_FEATURE_REPLY);
882 s =
format (0,
"SCRIPT: nat44_interface_add_del_output_feature ");
883 s =
format (s,
"sw_if_index %d %s %s",
899 memset (rmp, 0,
sizeof (*rmp));
901 ntohs (VL_API_NAT44_INTERFACE_OUTPUT_FEATURE_DETAILS + sm->
msg_id_base);
927 send_nat44_interface_output_feature_details(i, reg, mp->context);
937 s =
format (0,
"SCRIPT: nat44_interface_output_feature_dump ");
947 vl_api_nat44_add_del_static_mapping_reply_t *rmp;
949 u16 local_port = 0, external_port = 0;
950 u32 vrf_id, external_sw_if_index;
958 rv = VNET_API_ERROR_UNSUPPORTED;
966 local_port = clib_net_to_host_u16 (mp->
local_port);
969 vrf_id = clib_net_to_host_u32 (mp->
vrf_id);
976 mp->
tag[
sizeof (mp->
tag) - 1] = 0;
982 external_sw_if_index, proto, mp->
is_add,
988 REPLY_MACRO (VL_API_NAT44_ADD_DEL_STATIC_MAPPING_REPLY);
996 s =
format (0,
"SCRIPT: nat44_add_del_static_mapping ");
997 s =
format (s,
"protocol %d local_addr %U external_addr %U ",
1003 s =
format (s,
"local_port %d external_port %d ",
1007 s =
format (s,
"twice_nat %d out2in_only %d ",
1011 s =
format (s,
"vrf %d", clib_net_to_host_u32 (mp->
vrf_id));
1014 s =
format (s,
"external_sw_if_index %d",
1027 memset (rmp, 0,
sizeof (*rmp));
1029 ntohs (VL_API_NAT44_STATIC_MAPPING_DETAILS + sm->
msg_id_base);
1062 memset (rmp, 0,
sizeof (*rmp));
1064 ntohs (VL_API_NAT44_STATIC_MAPPING_DETAILS + sm->
msg_id_base);
1103 if (!is_identity_static_mapping(m) && !is_lb_static_mapping (m))
1104 send_nat44_static_mapping_details (m, reg, mp->context);
1122 s =
format (0,
"SCRIPT: nat44_static_mapping_dump ");
1132 vl_api_nat44_add_del_identity_mapping_reply_t *rmp;
1142 rv = VNET_API_ERROR_UNSUPPORTED;
1148 port = clib_net_to_host_u16 (mp->
port);
1151 vrf_id = clib_net_to_host_u32 (mp->
vrf_id);
1152 sw_if_index = clib_net_to_host_u32 (mp->
sw_if_index);
1153 if (sw_if_index != ~0)
1157 mp->
tag[
sizeof (mp->
tag) - 1] = 0;
1163 sw_if_index, proto, mp->
is_add, 0, 0, tag, 1);
1168 REPLY_MACRO (VL_API_NAT44_ADD_DEL_IDENTITY_MAPPING_REPLY);
1176 s =
format (0,
"SCRIPT: nat44_add_del_identity_mapping ");
1185 clib_net_to_host_u16 (mp->
port));
1188 s =
format (s,
" vrf %d", clib_net_to_host_u32 (mp->
vrf_id));
1201 memset (rmp, 0,
sizeof (*rmp));
1203 ntohs (VL_API_NAT44_IDENTITY_MAPPING_DETAILS + sm->
msg_id_base);
1226 memset (rmp, 0,
sizeof (*rmp));
1228 ntohs (VL_API_NAT44_IDENTITY_MAPPING_DETAILS + sm->
msg_id_base);
1261 if (is_identity_static_mapping(m) && !is_lb_static_mapping (m))
1263 for (j = 0; j < vec_len (m->locals); j++)
1264 send_nat44_identity_mapping_details (m, j, reg, mp->context);
1269 for (j = 0; j <
vec_len (sm->to_resolve); j++)
1271 rp = sm->to_resolve + j;
1272 if (rp->identity_nat)
1282 s =
format (0,
"SCRIPT: nat44_identity_mapping_dump ");
1292 vl_api_nat44_add_del_interface_addr_reply_t *rmp;
1299 rv = VNET_API_ERROR_UNSUPPORTED;
1309 REPLY_MACRO (VL_API_NAT44_ADD_DEL_INTERFACE_ADDR_REPLY);
1317 s =
format (0,
"SCRIPT: nat44_add_del_interface_addr ");
1318 s =
format (s,
"sw_if_index %d twice_nat %d %s",
1334 memset (rmp, 0,
sizeof (*rmp));
1336 ntohs (VL_API_NAT44_INTERFACE_ADDR_DETAILS + sm->
msg_id_base);
1373 s =
format (0,
"SCRIPT: nat44_interface_addr_dump ");
1387 memset (rmp, 0,
sizeof (*rmp));
1388 rmp->_vl_msg_id = ntohs (VL_API_NAT44_USER_DETAILS + sm->
msg_id_base);
1424 send_nat44_user_details (u, reg, mp->context);
1435 s =
format (0,
"SCRIPT: nat44_user_dump ");
1448 memset (rmp, 0,
sizeof (*rmp));
1450 ntohs (VL_API_NAT44_USER_SESSION_DETAILS + sm->
msg_id_base);
1457 rmp->
last_heard = clib_host_to_net_u64 ((
u64) s->last_heard);
1458 rmp->
total_bytes = clib_host_to_net_u64 (s->total_bytes);
1465 rmp->
protocol = ntohs (s->in2out.port);
1498 u32 session_index, head_index, elt_index;
1519 if (clib_bihash_search_8_8 (&tsm->user_hash, &key, &value))
1527 elt_index = head->
next;
1529 session_index = elt->
value;
1530 while (session_index != ~0)
1536 elt_index = elt->
next;
1538 session_index = elt->
value;
1548 s =
format (0,
"SCRIPT: nat44_user_session_dump ");
1549 s =
format (s,
"ip_address %U vrf_id %d\n",
1551 clib_net_to_host_u32 (mp->
vrf_id));
1558 u8 addr_port_pair_num)
1564 for (i = 0; i < addr_port_pair_num; i++)
1566 ap = &addr_port_pairs[
i];
1567 memset (&lb_addr_port, 0,
sizeof (lb_addr_port));
1569 lb_addr_port.port = clib_net_to_host_u16 (ap->
port);
1571 lb_addr_port.vrf_id = clib_net_to_host_u32 (ap->
vrf_id);
1572 vec_add1 (lb_addr_port_pairs, lb_addr_port);
1575 return lb_addr_port_pairs;
1583 vl_api_nat44_add_del_lb_static_mapping_reply_t *rmp;
1593 rv = VNET_API_ERROR_UNSUPPORTED;
1604 mp->
tag[
sizeof (mp->
tag) - 1] = 0;
1611 proto, locals, mp->
is_add, twice_nat,
1613 clib_net_to_host_u32 (mp->
affinity));
1619 REPLY_MACRO (VL_API_NAT44_ADD_DEL_LB_STATIC_MAPPING_REPLY);
1627 s =
format (0,
"SCRIPT: nat44_add_del_lb_static_mapping ");
1628 s =
format (s,
"is_add %d twice_nat %d out2in_only %d ",
1647 memset (rmp, 0,
sizeof (*rmp));
1649 ntohs (VL_API_NAT44_LB_STATIC_MAPPING_DETAILS + sm->
msg_id_base);
1695 if (is_lb_static_mapping(m))
1696 send_nat44_lb_static_mapping_details (m, reg, mp->context);
1706 s =
format (0,
"SCRIPT: nat44_lb_static_mapping_dump ");
1715 vl_api_nat44_del_session_reply_t *rmp;
1724 rv = VNET_API_ERROR_UNSUPPORTED;
1729 port = clib_net_to_host_u16 (mp->
port);
1730 vrf_id = clib_net_to_host_u32 (mp->
vrf_id);
1752 s =
format (0,
"SCRIPT: nat44_add_del_static_mapping ");
1753 s =
format (s,
"addr %U port %d protocol %d vrf_id %d is_in %d",
1755 clib_net_to_host_u16 (mp->
port),
1758 s =
format (s,
"ext_host_address %U ext_host_port %d",
1770 vl_api_nat44_forwarding_enable_disable_reply_t *rmp;
1772 u32 *ses_to_be_removed = 0, *ses_index;
1785 if (is_fwd_bypass_session(s))
1787 vec_add1 (ses_to_be_removed, s - tsm->sessions);
1801 REPLY_MACRO (VL_API_NAT44_FORWARDING_ENABLE_DISABLE_REPLY);
1809 s =
format (0,
"SCRIPT: nat44_forwarding_enable_disable ");
1828 memset (rmp, 0,
sizeof (*rmp));
1830 ntohs (VL_API_NAT44_FORWARDING_IS_ENABLED_REPLY + sm->
msg_id_base);
1843 s =
format (0,
"SCRIPT: nat44_forwarding_is_enabled ");
1856 vl_api_nat_det_add_del_map_reply_t *rmp;
1862 rv = VNET_API_ERROR_UNSUPPORTED;
1868 rv = VNET_API_ERROR_UNIMPLEMENTED;
1887 s =
format (0,
"SCRIPT: nat_det_add_del_map ");
1888 s =
format (s,
"inside address %U/%d outside address %U/%d\n",
1901 u16 lo_port = 0, hi_port = 0;
1907 rv = VNET_API_ERROR_UNSUPPORTED;
1915 rv = VNET_API_ERROR_UNIMPLEMENTED;
1924 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
1947 s =
format (0,
"SCRIPT: nat_det_forward");
1964 rv = VNET_API_ERROR_UNSUPPORTED;
1974 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
1996 s =
format (0,
"SCRIPT: nat_det_reverse");
1997 s =
format (s,
"outside ip address %U outside port %d",
2011 memset (rmp, 0,
sizeof (*rmp));
2012 rmp->_vl_msg_id = ntohs (VL_API_NAT_DET_MAP_DETAILS + sm->
msg_id_base);
2051 s =
format (0,
"SCRIPT: nat_det_map_dump ");
2061 vl_api_nat_det_close_session_out_reply_t *rmp;
2070 rv = VNET_API_ERROR_UNSUPPORTED;
2080 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
2090 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
2096 REPLY_MACRO (VL_API_NAT_DET_CLOSE_SESSION_OUT_REPLY);
2105 s =
format (0,
"SCRIPT: nat_det_close_session_out ");
2106 s =
format (s,
"out_addr %U out_port %d " 2107 "ext_addr %U ext_port %d\n",
2119 vl_api_nat_det_close_session_in_reply_t *rmp;
2128 rv = VNET_API_ERROR_UNSUPPORTED;
2134 rv = VNET_API_ERROR_UNIMPLEMENTED;
2144 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
2152 rv = VNET_API_ERROR_NO_SUCH_ENTRY;
2158 REPLY_MACRO (VL_API_NAT_DET_CLOSE_SESSION_OUT_REPLY);
2166 s =
format (0,
"SCRIPT: nat_det_close_session_in ");
2167 s =
format (s,
"in_addr %U in_port %d ext_addr %U ext_port %d\n",
2182 memset (rmp, 0,
sizeof (*rmp));
2183 rmp->_vl_msg_id = ntohs (VL_API_NAT_DET_SESSION_DETAILS + sm->
msg_id_base);
2214 memset (&empty_ses, 0,
sizeof (empty_ses));
2235 s =
format (0,
"SCRIPT: nat_det_session_dump ");
2249 vl_api_nat64_add_del_pool_addr_range_reply_t *rmp;
2253 u32 start_host_order, end_host_order;
2259 start_host_order = clib_host_to_net_u32 (tmp[0]);
2261 end_host_order = clib_host_to_net_u32 (tmp[0]);
2263 count = (end_host_order - start_host_order) + 1;
2265 vrf_id = clib_host_to_net_u32 (mp->
vrf_id);
2269 for (i = 0; i <
count; i++)
2278 REPLY_MACRO (VL_API_NAT64_ADD_DEL_POOL_ADDR_RANGE_REPLY);
2286 s =
format (0,
"SCRIPT: nat64_add_del_pool_addr_range ");
2287 s =
format (s,
"%U - %U vrf_id %u %s\n",
2310 memset (rmp, 0,
sizeof (*rmp));
2311 rmp->_vl_msg_id = ntohs (VL_API_NAT64_POOL_ADDR_DETAILS + sm->
msg_id_base);
2352 s =
format (0,
"SCRIPT: nat64_pool_addr_dump\n");
2362 vl_api_nat64_add_del_interface_reply_t *rmp;
2373 REPLY_MACRO (VL_API_NAT64_ADD_DEL_INTERFACE_REPLY);
2382 s =
format (0,
"SCRIPT: nat64_add_del_interface ");
2383 s =
format (s,
"sw_if_index %d %s %s",
2398 memset (rmp, 0,
sizeof (*rmp));
2399 rmp->_vl_msg_id = ntohs (VL_API_NAT64_INTERFACE_DETAILS + sm->
msg_id_base);
2434 s =
format (0,
"SCRIPT: snat_interface_dump ");
2444 vl_api_nat64_add_del_static_bib_reply_t *rmp;
2454 clib_net_to_host_u16 (mp->
i_port),
2455 clib_net_to_host_u16 (mp->
o_port),
2457 clib_net_to_host_u32 (mp->
vrf_id),
2460 REPLY_MACRO (VL_API_NAT64_ADD_DEL_STATIC_BIB_REPLY);
2468 s =
format (0,
"SCRIPT: nat64_add_del_static_bib ");
2469 s =
format (s,
"protocol %d i_addr %U o_addr %U ",
2474 s =
format (s,
"vrf %d", clib_net_to_host_u32 (mp->
vrf_id));
2492 memset (rmp, 0,
sizeof (*rmp));
2493 rmp->_vl_msg_id = ntohs (VL_API_NAT64_BIB_DETAILS + sm->
msg_id_base);
2497 rmp->
i_port = bibe->in_port;
2498 rmp->
o_port = bibe->out_port;
2500 rmp->
proto = bibe->proto;
2502 rmp->
ses_num = ntohl (bibe->ses_num);
2536 s =
format (0,
"SCRIPT: snat_bib_dump protocol %d", mp->
proto);
2547 nat64_db_bib_entry_t *bibe;
2559 memset (rmp, 0,
sizeof (*rmp));
2560 rmp->_vl_msg_id = ntohs (VL_API_NAT64_ST_DETAILS + sm->
msg_id_base);
2565 rmp->
ol_port = bibe->out_port;
2570 rmp->
proto = ste->proto;
2607 s =
format (0,
"SCRIPT: snat_st_dump protocol %d", mp->
proto);
2615 vl_api_nat64_add_del_prefix_reply_t *rmp;
2634 s =
format (0,
"SCRIPT: nat64_add_del_prefix %U/%u vrf_id %u %s\n",
2649 memset (rmp, 0,
sizeof (*rmp));
2650 rmp->_vl_msg_id = ntohs (VL_API_NAT64_PREFIX_DETAILS + sm->
msg_id_base);
2684 s =
format (0,
"SCRIPT: nat64_prefix_dump\n");
2694 vl_api_nat64_add_del_interface_addr_reply_t *rmp;
2704 REPLY_MACRO (VL_API_NAT64_ADD_DEL_INTERFACE_ADDR_REPLY);
2712 s =
format (0,
"SCRIPT: nat64_add_del_interface_addr ");
2713 s =
format (s,
"sw_if_index %d %s",
2715 mp->
is_add ?
"" :
"del");
2727 vl_api_dslite_set_aftr_addr_reply_t *rmp;
2750 s =
format (0,
"SCRIPT: dslite_set_aftr_addr ");
2751 s =
format (s,
"ip6_addr %U ip4_addr %U\n",
2781 s =
format (0,
"SCRIPT: dslite_get_aftr_addr");
2789 vl_api_dslite_set_b4_addr_reply_t *rmp;
2812 s =
format (0,
"SCRIPT: dslite_set_b4_addr ");
2813 s =
format (s,
"ip6_addr %U ip4_addr %U\n",
2843 s =
format (0,
"SCRIPT: dslite_get_b4_addr");
2852 vl_api_dslite_add_del_pool_addr_range_reply_t *rmp;
2857 u32 start_host_order, end_host_order;
2862 start_host_order = clib_host_to_net_u32 (tmp[0]);
2864 end_host_order = clib_host_to_net_u32 (tmp[0]);
2866 count = (end_host_order - start_host_order) + 1;
2869 for (i = 0; i <
count; i++)
2878 REPLY_MACRO (VL_API_DSLITE_ADD_DEL_POOL_ADDR_RANGE_REPLY);
2890 memset (rmp, 0,
sizeof (*rmp));
2892 rmp->_vl_msg_id = ntohs (VL_API_DSLITE_ADDRESS_DETAILS + sm->
msg_id_base);
2924 s =
format (0,
"SCRIPT: dslite_address_dump ");
2934 s =
format (0,
"SCRIPT: dslite_add_del_pool_addr_range ");
2935 s =
format (s,
"%U - %U\n",
2952 vl_api_nat66_add_del_interface_reply_t *rmp;
2963 REPLY_MACRO (VL_API_NAT66_ADD_DEL_INTERFACE_REPLY);
2972 s =
format (0,
"SCRIPT: nat66_add_del_interface ");
2973 s =
format (s,
"sw_if_index %d %s %s",
2985 vl_api_nat66_add_del_static_mapping_reply_t *rmp;
2994 clib_net_to_host_u32 (mp->
vrf_id),
2997 REPLY_MACRO (VL_API_NAT66_ADD_DEL_STATIC_MAPPING_REPLY);
3005 s =
format (0,
"SCRIPT: nat66_add_del_static_mapping ");
3006 s =
format (s,
"local_ip_address %U external_ip_address %U vrf_id %d %s",
3009 clib_net_to_host_u32 (mp->
vrf_id), mp->
is_add ?
"" :
"del");
3028 memset (rmp, 0,
sizeof (*rmp));
3029 rmp->_vl_msg_id = ntohs (VL_API_NAT66_INTERFACE_DETAILS + sm->
msg_id_base);
3062 s =
format (0,
"SCRIPT: nat66_interface_dump ");
3084 memset (rmp, 0,
sizeof (*rmp));
3086 ntohs (VL_API_NAT66_STATIC_MAPPING_DETAILS + sm->
msg_id_base);
3123 s =
format (0,
"SCRIPT: nat66_static_mapping_dump ");
3130 #define foreach_snat_plugin_api_msg \ 3131 _(NAT_CONTROL_PING, nat_control_ping) \ 3132 _(NAT_SHOW_CONFIG, nat_show_config) \ 3133 _(NAT_SET_WORKERS, nat_set_workers) \ 3134 _(NAT_WORKER_DUMP, nat_worker_dump) \ 3135 _(NAT_IPFIX_ENABLE_DISABLE, nat_ipfix_enable_disable) \ 3136 _(NAT_SET_REASS, nat_set_reass) \ 3137 _(NAT_GET_REASS, nat_get_reass) \ 3138 _(NAT_REASS_DUMP, nat_reass_dump) \ 3139 _(NAT_SET_TIMEOUTS, nat_set_timeouts) \ 3140 _(NAT_GET_TIMEOUTS, nat_get_timeouts) \ 3141 _(NAT_SET_ADDR_AND_PORT_ALLOC_ALG, nat_set_addr_and_port_alloc_alg) \ 3142 _(NAT_GET_ADDR_AND_PORT_ALLOC_ALG, nat_get_addr_and_port_alloc_alg) \ 3143 _(NAT_SET_MSS_CLAMPING, nat_set_mss_clamping) \ 3144 _(NAT_GET_MSS_CLAMPING, nat_get_mss_clamping) \ 3145 _(NAT44_ADD_DEL_ADDRESS_RANGE, nat44_add_del_address_range) \ 3146 _(NAT44_INTERFACE_ADD_DEL_FEATURE, nat44_interface_add_del_feature) \ 3147 _(NAT44_ADD_DEL_STATIC_MAPPING, nat44_add_del_static_mapping) \ 3148 _(NAT44_ADD_DEL_IDENTITY_MAPPING, nat44_add_del_identity_mapping) \ 3149 _(NAT44_STATIC_MAPPING_DUMP, nat44_static_mapping_dump) \ 3150 _(NAT44_IDENTITY_MAPPING_DUMP, nat44_identity_mapping_dump) \ 3151 _(NAT44_ADDRESS_DUMP, nat44_address_dump) \ 3152 _(NAT44_INTERFACE_DUMP, nat44_interface_dump) \ 3153 _(NAT44_ADD_DEL_INTERFACE_ADDR, nat44_add_del_interface_addr) \ 3154 _(NAT44_INTERFACE_ADDR_DUMP, nat44_interface_addr_dump) \ 3155 _(NAT44_USER_DUMP, nat44_user_dump) \ 3156 _(NAT44_USER_SESSION_DUMP, nat44_user_session_dump) \ 3157 _(NAT44_INTERFACE_ADD_DEL_OUTPUT_FEATURE, \ 3158 nat44_interface_add_del_output_feature) \ 3159 _(NAT44_INTERFACE_OUTPUT_FEATURE_DUMP, \ 3160 nat44_interface_output_feature_dump) \ 3161 _(NAT44_ADD_DEL_LB_STATIC_MAPPING, nat44_add_del_lb_static_mapping) \ 3162 _(NAT44_LB_STATIC_MAPPING_DUMP, nat44_lb_static_mapping_dump) \ 3163 _(NAT44_DEL_SESSION, nat44_del_session) \ 3164 _(NAT44_FORWARDING_ENABLE_DISABLE, nat44_forwarding_enable_disable) \ 3165 _(NAT44_FORWARDING_IS_ENABLED, nat44_forwarding_is_enabled) \ 3166 _(NAT_DET_ADD_DEL_MAP, nat_det_add_del_map) \ 3167 _(NAT_DET_FORWARD, nat_det_forward) \ 3168 _(NAT_DET_REVERSE, nat_det_reverse) \ 3169 _(NAT_DET_MAP_DUMP, nat_det_map_dump) \ 3170 _(NAT_DET_CLOSE_SESSION_OUT, nat_det_close_session_out) \ 3171 _(NAT_DET_CLOSE_SESSION_IN, nat_det_close_session_in) \ 3172 _(NAT_DET_SESSION_DUMP, nat_det_session_dump) \ 3173 _(NAT64_ADD_DEL_POOL_ADDR_RANGE, nat64_add_del_pool_addr_range) \ 3174 _(NAT64_POOL_ADDR_DUMP, nat64_pool_addr_dump) \ 3175 _(NAT64_ADD_DEL_INTERFACE, nat64_add_del_interface) \ 3176 _(NAT64_INTERFACE_DUMP, nat64_interface_dump) \ 3177 _(NAT64_ADD_DEL_STATIC_BIB, nat64_add_del_static_bib) \ 3178 _(NAT64_BIB_DUMP, nat64_bib_dump) \ 3179 _(NAT64_ST_DUMP, nat64_st_dump) \ 3180 _(NAT64_ADD_DEL_PREFIX, nat64_add_del_prefix) \ 3181 _(NAT64_PREFIX_DUMP, nat64_prefix_dump) \ 3182 _(NAT64_ADD_DEL_INTERFACE_ADDR, nat64_add_del_interface_addr) \ 3183 _(DSLITE_ADD_DEL_POOL_ADDR_RANGE, dslite_add_del_pool_addr_range) \ 3184 _(DSLITE_ADDRESS_DUMP, dslite_address_dump) \ 3185 _(DSLITE_SET_AFTR_ADDR, dslite_set_aftr_addr) \ 3186 _(DSLITE_GET_AFTR_ADDR, dslite_get_aftr_addr) \ 3187 _(DSLITE_SET_B4_ADDR, dslite_set_b4_addr) \ 3188 _(DSLITE_GET_B4_ADDR, dslite_get_b4_addr) \ 3189 _(NAT66_ADD_DEL_INTERFACE, nat66_add_del_interface) \ 3190 _(NAT66_INTERFACE_DUMP, nat66_interface_dump) \ 3191 _(NAT66_ADD_DEL_STATIC_MAPPING, nat66_add_del_static_mapping) \ 3192 _(NAT66_STATIC_MAPPING_DUMP, nat66_static_mapping_dump) 3200 vl_msg_api_set_handlers((VL_API_##N + sm->msg_id_base), \ 3202 vl_api_##n##_t_handler, \ 3204 vl_api_##n##_t_endian, \ 3205 vl_api_##n##_t_print, \ 3206 sizeof(vl_api_##n##_t), 1); 3213 #define vl_msg_name_crc_list 3215 #undef vl_msg_name_crc_list 3220 #define _(id,n,crc) \ 3221 vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id + sm->msg_id_base); 3222 foreach_vl_msg_name_crc_nat;
3229 #define _(n,f) sm->api_main->msg_print_handlers \ 3230 [VL_API_##n + sm->msg_id_base] \ 3231 = (void *) vl_api_##f##_t_print; 3242 name =
format (0,
"nat_%08x%c", api_version, 0);
ip4_address_t external_addr
NAT64 interface details response.
nat64_db_t * db
BIB and session DB per thread.
#define nat_log_info(...)
u32 nat_reass_get_timeout(u8 is_ip6)
Get reassembly timeout.
NAT virtual fragmentation reassemblies response.
#define snat_is_session_static(s)
Check if SNAT session is created from static mapping.
u32 sessions_per_user_list_head_index
NAT44 load-balancing static mapping rule details response.
static void vl_api_nat66_add_del_interface_t_handler(vl_api_nat66_add_del_interface_t *mp)
int snat_del_address(snat_main_t *sm, ip4_address_t addr, u8 delete_sm, u8 twice_nat)
Delete external address from NAT44 pool.
int nat64_set_udp_timeout(u32 timeout)
Set UDP session timeout.
static void send_nat44_identity_map_resolve_details(snat_static_map_resolve_t *m, vl_api_registration_t *reg, u32 context)
static void vl_api_nat_worker_dump_t_handler(vl_api_nat_worker_dump_t *mp)
Get address and port assignment algorithm reply.
static int nat64_api_pool_walk(snat_address_t *a, void *arg)
NAT64 BIB details response.
Dump NAT virtual fragmentation reassemblies.
static void * vl_api_nat44_user_dump_t_print(vl_api_nat44_user_dump_t *mp, void *handle)
static void * vl_api_nat_ipfix_enable_disable_t_print(vl_api_nat_ipfix_enable_disable_t *mp, void *handle)
static void * vl_api_nat_det_close_session_in_t_print(vl_api_nat_det_close_session_in_t *mp, void *handle)
Get values of timeouts for NAT sessions (seconds)
NAT workers details response.
Get values of timeouts for NAT sessions reply.
Set AFTR IPv6 and IPv4 addresses.
static void * vl_api_nat64_interface_dump_t_print(vl_api_nat64_interface_dump_t *mp, void *handle)
static void send_nat44_user_session_details(snat_session_t *s, vl_api_registration_t *reg, u32 context)
NAT44 interface with output feature details response.
static void * vl_api_nat_set_addr_and_port_alloc_alg_t_print(vl_api_nat_set_addr_and_port_alloc_alg_t *mp, void *handle)
Dump NAT44 pool addresses interfaces.
static void vl_api_nat44_user_session_dump_t_handler(vl_api_nat44_user_session_dump_t *mp)
#define is_ed_session(s)
Check if NAT session is endpoint dependent.
static void * vl_api_nat44_del_session_t_print(vl_api_nat44_del_session_t *mp, void *handle)
ip4_address_t aftr_ip4_addr
NAT44 identity mapping details response.
Add/delete NAT44 identity mapping.
vl_api_nat44_lb_addr_port_t locals[local_num]
#define REPLY_MACRO2(t, body)
int nat64_add_del_interface(u32 sw_if_index, u8 is_inside, u8 is_add)
Enable/disable NAT64 feature on the interface.
static void vl_api_nat44_lb_static_mapping_dump_t_handler(vl_api_nat44_lb_static_mapping_dump_t *mp)
static void send_dslite_address_details(snat_address_t *ap, vl_api_registration_t *reg, u32 context)
static void vl_api_nat_reass_dump_t_handler(vl_api_nat_reass_dump_t *mp)
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
static int nat64_api_interface_walk(snat_interface_t *i, void *arg)
Add/delete address range to DS-Lite pool.
static void vl_api_nat64_bib_dump_t_handler(vl_api_nat64_bib_dump_t *mp)
static int nat_ip6_reass_walk_api(nat_reass_ip6_t *reass, void *arg)
static clib_error_t * snat_plugin_api_hookup(vlib_main_t *vm)
int nat64_add_del_pool_addr(ip4_address_t *addr, u32 vrf_id, u8 is_add)
Add/delete address to NAT64 pool.
Set NAT virtual fragmentation reassembly.
static void * vl_api_nat64_bib_dump_t_print(vl_api_nat64_bib_dump_t *mp, void *handle)
static void * vl_api_nat66_add_del_static_mapping_t_print(vl_api_nat66_add_del_static_mapping_t *mp, void *handle)
Control ping from client to api server request.
Set values of timeouts for NAT sessions (seconds)
#define vec_terminate_c_string(V)
(If necessary) NULL terminate a vector containing a c-string.
Get outside address and port range from inside address.
u8 external_ip_address[4]
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static void vl_api_nat64_add_del_pool_addr_range_t_handler(vl_api_nat64_add_del_pool_addr_range_t *mp)
static void snat_det_ses_close(snat_det_map_t *dm, snat_det_session_t *ses)
Get inside address from outside address and port reply.
Combined counter to hold both packets and byte differences.
NAT44 interface details response.
static nat44_lb_addr_port_t * unformat_nat44_lb_addr_port(vl_api_nat44_lb_addr_port_t *addr_port_pairs, u8 addr_port_pair_num)
static snat_det_session_t * snat_det_find_ses_by_in(snat_det_map_t *dm, ip4_address_t *in_addr, u16 in_port, snat_det_out_key_t out_key)
u8 external_ip_address[16]
static void send_nat44_interface_addr_details(u32 sw_if_index, vl_api_registration_t *reg, u32 context, u8 twice_nat)
Dump NAT66 static mappings.
static void snat_det_forward(snat_det_map_t *dm, ip4_address_t *in_addr, ip4_address_t *out_addr, u16 *lo_port)
NAT44 static mapping details response.
static void * vl_api_dslite_add_del_pool_addr_range_t_print(vl_api_dslite_add_del_pool_addr_range_t *mp, void *handle)
static void vl_api_nat_get_addr_and_port_alloc_alg_t_handler(vl_api_nat_get_addr_and_port_alloc_alg_t *mp)
static void * vl_api_nat64_add_del_static_bib_t_print(vl_api_nat64_add_del_static_bib_t *mp, void *handle)
int nat44_del_ed_session(snat_main_t *sm, ip4_address_t *addr, u16 port, ip4_address_t *eh_addr, u16 eh_port, u8 proto, u32 vrf_id, int is_in)
Delete NAT44 endpoint-dependent session.
static void * vl_api_nat64_pool_addr_dump_t_print(vl_api_nat64_pool_addr_dump_t *mp, void *handle)
Response to check if forwarding is enabled or disabled.
snat_det_map_t * det_maps
static void vl_api_nat_control_ping_t_handler(vl_api_nat_control_ping_t *mp)
Get NAT virtual fragmentation reassembly configuration reply.
int nat64_add_interface_address(u32 sw_if_index, int is_add)
NAT64 pool address from specific (DHCP addressed) interface.
Add/delete NAT64 pool address from specific interfce.
static void snat_det_reverse(snat_det_map_t *dm, ip4_address_t *out_addr, u16 out_port, ip4_address_t *in_addr)
void * vl_msg_api_alloc(int nbytes)
#define snat_is_unk_proto_session(s)
Check if SNAT session for unknown protocol.
static void vl_api_nat44_add_del_interface_addr_t_handler(vl_api_nat44_add_del_interface_addr_t *mp)
static void vl_api_nat_set_workers_t_handler(vl_api_nat_set_workers_t *mp)
Enable/disable NAT64 feature on the interface.
void nat_ip4_reass_walk(nat_ip4_reass_walk_fn_t fn, void *ctx)
Walk IPv4 reassemblies.
static void * vl_api_nat_get_reass_t_print(vl_api_nat_get_reass_t *mp, void *handle)
static int nat64_api_prefix_walk(nat64_prefix_t *p, void *arg)
int snat_interface_add_del(u32 sw_if_index, u8 is_inside, int is_del)
Enable/disable NAT44 feature on the interface.
nat44_lb_addr_port_t * locals
static void vl_api_nat_get_timeouts_t_handler(vl_api_nat_get_timeouts_t *mp)
static void * vl_api_nat_det_reverse_t_print(vl_api_nat_det_reverse_t *mp, void *handle)
static void * vl_api_nat_show_config_t_print(vl_api_nat_show_config_t *mp, void *handle)
static void * vl_api_nat44_forwarding_is_enabled_t_print(vl_api_nat44_forwarding_is_enabled_t *mp, void *handle)
int nat44_add_del_lb_static_mapping(ip4_address_t e_addr, u16 e_port, snat_protocol_t proto, nat44_lb_addr_port_t *locals, u8 is_add, twice_nat_type_t twice_nat, u8 out2in_only, u8 *tag, u32 affinity)
Add/delete static mapping with load-balancing (multiple backends)
#define nat_interface_is_outside(i)
Check if NAT interface is outside.
u32 max_translations_per_user
static void * vl_api_nat44_interface_addr_dump_t_print(vl_api_nat44_interface_addr_dump_t *mp, void *handle)
static void * vl_api_nat44_identity_mapping_dump_t_print(vl_api_nat44_identity_mapping_dump_t *mp, void *handle)
static void * vl_api_dslite_address_dump_t_print(vl_api_dslite_address_dump_t *mp, void *handle)
memset(h->entries, 0, sizeof(h->entries[0])*entries)
static void * vl_api_nat_det_add_del_map_t_print(vl_api_nat_det_add_del_map_t *mp, void *handle)
static void vl_api_nat44_user_dump_t_handler(vl_api_nat44_user_dump_t *mp)
Check if forwarding is enabled or disabled.
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
Dump NAT64 session table.
static void * vl_api_nat44_lb_static_mapping_dump_t_print(vl_api_nat44_lb_static_mapping_dump_t *mp, void *handle)
static void vl_api_nat_set_addr_and_port_alloc_alg_t_handler(vl_api_nat_set_addr_and_port_alloc_alg_t *mp)
ip4_address_t ext_host_addr
NAT66 interface details response.
static int nat64_api_st_walk(nat64_db_st_entry_t *ste, void *arg)
Response to get AFTR IPv6 and IPv4 addresses.
Enable/disbale NAT44 as an interface output feature (postrouting in2out translation) ...
static void sent_nat_det_map_details(snat_det_map_t *m, vl_api_registration_t *reg, u32 context)
int snat_add_address(snat_main_t *sm, ip4_address_t *addr, u32 vrf_id, u8 twice_nat)
Add external address to NAT44 pool.
int nat64_set_icmp_timeout(u32 timeout)
Set ICMP session timeout.
struct nat64_api_walk_ctx_t_ nat64_api_walk_ctx_t
ip6_address_t b4_ip6_addr
u8 external_ip_address[4]
#define SNAT_DET_SES_PER_USER
NAT44 load-balancing address and port pair.
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
#define is_fwd_bypass_session(s)
Check if NAT session is forwarding bypass.
#define foreach_snat_plugin_api_msg
static void vl_api_nat44_interface_add_del_output_feature_t_handler(vl_api_nat44_interface_add_del_output_feature_t *mp)
int snat_ipfix_logging_enable_disable(int enable, u32 domain_id, u16 src_port)
Enable/disable NAT plugin IPFIX logging.
static void send_nat44_user_details(snat_user_t *u, vl_api_registration_t *reg, u32 context)
Dump interfaces with NAT44 output feature.
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
static void vl_api_nat44_add_del_address_range_t_handler(vl_api_nat44_add_del_address_range_t *mp)
static void vl_api_nat44_forwarding_enable_disable_t_handler(vl_api_nat44_forwarding_enable_disable_t *mp)
static void vl_api_nat_det_map_dump_t_handler(vl_api_nat_det_map_dump_t *mp)
Get B4 IPv6 and IPv4 addresses.
static void send_nat44_identity_mapping_details(snat_static_mapping_t *m, int index, vl_api_registration_t *reg, u32 context)
static void * vl_api_nat66_add_del_interface_t_print(vl_api_nat66_add_del_interface_t *mp, void *handle)
static void * vl_api_nat44_forwarding_enable_disable_t_print(vl_api_nat44_forwarding_enable_disable_t *mp, void *handle)
clib_error_t * snat_api_init(vlib_main_t *vm, snat_main_t *sm)
static void nat44_delete_session(snat_main_t *sm, snat_session_t *ses, u32 thread_index)
static heap_elt_t * first(heap_header_t *h)
u8 nat_reass_get_max_frag(u8 is_ip6)
Get maximum number of fragmets per reassembly.
twice_nat_type_t twice_nat
u32 * auto_add_sw_if_indices_twice_nat
u32 max_translations_per_user
static void * vl_api_dslite_get_b4_addr_t_print(vl_api_dslite_get_b4_addr_t *mp, void *handle)
static u32 snat_det_user_ses_offset(ip4_address_t *addr, u8 plen)
static void * vl_api_nat_get_timeouts_t_print(vl_api_nat_get_timeouts_t *mp, void *handle)
vlib_worker_thread_t * vlib_worker_threads
static void send_nat44_address_details(snat_address_t *a, vl_api_registration_t *reg, u32 context, u8 twice_nat)
Get TCP MSS rewriting configuration.
#define clib_bitmap_foreach(i, ai, body)
Macro to iterate across set bits in a bitmap.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Control ping from the client to the server response.
void nat66_static_mappings_walk(nat66_static_mapping_walk_fn_t fn, void *ctx)
void nat_free_session_data(snat_main_t *sm, snat_session_t *s, u32 thread_index)
Free NAT44 session data (lookup keys, external addrres port)
static void * vl_api_nat64_st_dump_t_print(vl_api_nat64_st_dump_t *mp, void *handle)
static void * vl_api_nat_control_ping_t_print(vl_api_nat_control_ping_t *mp, void *handle)
counter_t packets
packet counter
nat_addr_and_port_alloc_alg_t addr_and_port_alloc_alg
u8 external_ip_address[16]
static void vl_api_nat44_forwarding_is_enabled_t_handler(vl_api_nat44_forwarding_is_enabled_t *mp)
Add/delete address range to NAT64 pool.
snat_det_session_t * sessions
Close deterministic NAT session by outside address and port.
static void * vl_api_nat_get_addr_and_port_alloc_alg_t_print(vl_api_nat_get_addr_and_port_alloc_alg_t *mp, void *handle)
static snat_det_map_t * snat_det_map_by_out(snat_main_t *sm, ip4_address_t *out_addr)
static void * vl_api_dslite_get_aftr_addr_t_print(vl_api_dslite_get_aftr_addr_t *mp, void *handle)
static void send_nat44_interface_output_feature_details(snat_interface_t *i, vl_api_registration_t *reg, u32 context)
Enable/disable forwarding for NAT44 Forward packets which don't match existing translation or static ...
Dump NAT64 pool addresses.
static void * vl_api_nat_set_workers_t_print(vl_api_nat_set_workers_t *mp, void *handle)
static void vl_api_nat_set_timeouts_t_handler(vl_api_nat_set_timeouts_t *mp)
snat_static_mapping_t * static_mappings
vl_api_registration_t * reg
static void * vl_api_dslite_set_aftr_addr_t_print(vl_api_dslite_set_aftr_addr_t *mp, void *handle)
static int nat66_api_interface_walk(snat_interface_t *i, void *arg)
static void vl_api_nat64_pool_addr_dump_t_handler(vl_api_nat64_pool_addr_dump_t *mp)
#define nat_interface_is_inside(i)
Check if NAT interface is inside.
static void * vl_api_nat44_interface_output_feature_dump_t_print(vl_api_nat44_interface_output_feature_dump_t *mp, void *handle)
static void vl_api_nat_det_reverse_t_handler(vl_api_nat_det_reverse_t *mp)
snat_address_t * addr_pool
Dump NAT44 identity mappings.
u8 ext_host_nat_address[4]
u32 translation_memory_size
int dslite_add_del_pool_addr(dslite_main_t *dm, ip4_address_t *addr, u8 is_add)
void nat_set_alloc_addr_and_port_default(void)
Set address and port assignment algorithm to default/standard.
int dslite_set_b4_ip4_addr(dslite_main_t *dm, ip4_address_t *addr)
static void vl_api_nat44_add_del_identity_mapping_t_handler(vl_api_nat44_add_del_identity_mapping_t *mp)
static void send_nat_det_session_details(snat_det_session_t *s, vl_api_registration_t *reg, u32 context)
static void * vl_api_nat66_static_mapping_dump_t_print(vl_api_nat66_static_mapping_dump_t *mp, void *handle)
static void vl_api_nat_get_mss_clamping_t_handler(vl_api_nat_get_mss_clamping_t *mp)
Add/delete NAT44 pool address from specific interfce.
static void * vl_api_nat_worker_dump_t_print(vl_api_nat_worker_dump_t *mp, void *handle)
static void * vl_api_nat44_address_dump_t_print(vl_api_nat44_address_dump_t *mp, void *handle)
static void vl_api_dslite_set_aftr_addr_t_handler(vl_api_dslite_set_aftr_addr_t *mp)
u8 static_mapping_connection_tracking
Get address and port assignment algorithm.
static void vl_api_nat44_del_session_t_handler(vl_api_nat44_del_session_t *mp)
static void * vl_api_nat_det_session_dump_t_print(vl_api_nat_det_session_dump_t *mp, void *handle)
Add/delete NAT64 static BIB entry.
API main structure, used by both vpp and binary API clients.
static void vl_api_nat44_add_del_static_mapping_t_handler(vl_api_nat44_add_del_static_mapping_t *mp)
Enable/disable NAT66 feature on the interface.
static void send_nat44_interface_details(snat_interface_t *i, vl_api_registration_t *reg, u32 context)
snat_interface_t * output_feature_interfaces
An API client registration, only in vpp/vlib.
u16 nat_reass_get_max_reass(u8 is_ip6)
Get maximum number of concurrent reassemblies.
#define BAD_SW_IF_INDEX_LABEL
Add/delete NAT deterministic mapping.
static void * vl_api_nat_set_timeouts_t_print(vl_api_nat_set_timeouts_t *mp, void *handle)
ip6_address_t aftr_ip6_addr
void vl_msg_api_send_shmem(svm_queue_t *q, u8 *elem)
static int nat66_api_static_mapping_walk(nat66_static_mapping_t *m, void *arg)
static void * vl_api_nat66_interface_dump_t_print(vl_api_nat66_interface_dump_t *mp, void *handle)
static void vl_api_nat66_add_del_static_mapping_t_handler(vl_api_nat66_add_del_static_mapping_t *mp)
static u8 snat_proto_to_ip_proto(snat_protocol_t snat_proto)
static void * vl_api_nat64_add_del_prefix_t_print(vl_api_nat64_add_del_prefix_t *mp, void *handle)
static void vl_api_nat64_add_del_interface_addr_t_handler(vl_api_nat64_add_del_interface_addr_t *mp)
Dump interfaces with NAT44 feature.
int nat66_interface_add_del(u32 sw_if_index, u8 is_inside, u8 is_add)
void nat64_pool_addr_walk(nat64_pool_addr_walk_fn_t fn, void *ctx)
Walk NAT64 pool.
int nat_reass_set(u32 timeout, u16 max_reass, u8 max_frag, u8 drop_frag, u8 is_ip6)
Set NAT virtual fragmentation reassembly configuration.
u32 ft_table_id
Table ID (hash key) for this FIB.
u8 nat_reass_is_drop_frag(u8 is_ip6)
Get status of virtual fragmentation reassembly.
static void vlib_get_combined_counter(const vlib_combined_counter_main_t *cm, u32 index, vlib_counter_t *result)
Get the value of a combined counter, never called in the speed path Scrapes the entire set of per-thr...
static void vl_api_nat44_identity_mapping_dump_t_handler(vl_api_nat44_identity_mapping_dump_t *mp)
static void vl_api_nat_det_forward_t_handler(vl_api_nat_det_forward_t *mp)
static void * vl_api_nat64_add_del_pool_addr_range_t_print(vl_api_nat64_add_del_pool_addr_range_t *mp, void *handle)
void nat44_add_del_address_dpo(ip4_address_t addr, u8 is_add)
Add/delete external address to FIB DPO (out2in DPO mode)
svm_queue_t * vl_api_client_index_to_input_queue(u32 index)
static void vl_api_nat_show_config_t_handler(vl_api_nat_show_config_t *mp)
static void vl_api_dslite_address_dump_t_handler(vl_api_dslite_address_dump_t *mp)
static void vl_api_nat44_add_del_lb_static_mapping_t_handler(vl_api_nat44_add_del_lb_static_mapping_t *mp)
snat_get_worker_function_t * worker_in2out_cb
u8 static_mapping_connection_tracking
Dump NAT44 load-balancing static mapping rules.
#define vec_free(V)
Free vector's memory (no header).
ip4_address_t b4_ip4_addr
deterministic NAT definitions
NAT44 user's sessions response.
static void * vl_api_nat44_interface_dump_t_print(vl_api_nat44_interface_dump_t *mp, void *handle)
static void * vl_api_nat_det_map_dump_t_print(vl_api_nat_det_map_dump_t *mp, void *handle)
int nat64_add_del_prefix(ip6_address_t *prefix, u8 plen, u32 vrf_id, u8 is_add)
Add/delete NAT64 prefix.
u32 bib_buckets
config parameters
static void vl_api_nat44_interface_addr_dump_t_handler(vl_api_nat44_interface_addr_dump_t *mp)
NAT66 static mapping details response.
int snat_interface_add_del_output_feature(u32 sw_if_index, u8 is_inside, int is_del)
Enable/disable NAT44 output feature on the interface (postrouting NAT)
#define clib_memcpy(a, b, c)
static void vl_api_nat64_add_del_prefix_t_handler(vl_api_nat64_add_del_prefix_t *mp)
dslite_main_t dslite_main
static uword * clib_bitmap_set_multiple(uword *bitmap, uword i, uword value, uword n_bits)
sets the ith through ith + n_bits bits in a bitmap
static void vl_api_nat64_prefix_dump_t_handler(vl_api_nat64_prefix_dump_t *mp)
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
static void * vl_api_nat44_add_del_lb_static_mapping_t_print(vl_api_nat44_add_del_lb_static_mapping_t *mp, void *handle)
8 octet key, 8 octet key value pair
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
static void vl_api_dslite_set_b4_addr_t_handler(vl_api_dslite_set_b4_addr_t *mp)
static void send_nat44_lb_static_mapping_details(snat_static_mapping_t *m, vl_api_registration_t *reg, u32 context)
u32 tcp_transitory_timeout
static void vl_api_nat_det_close_session_out_t_handler(vl_api_nat_det_close_session_out_t *mp)
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, u32 sw_if_index, snat_protocol_t proto, int is_add, twice_nat_type_t twice_nat, u8 out2in_only, u8 *tag, u8 identity_nat)
Add/delete NAT44 static mapping.
static void send_nat44_static_map_resolve_details(snat_static_map_resolve_t *m, vl_api_registration_t *reg, u32 context)
static void vl_api_nat_det_add_del_map_t_handler(vl_api_nat_det_add_del_map_t *mp)
int snat_det_add_map(snat_main_t *sm, ip4_address_t *in_addr, u8 in_plen, ip4_address_t *out_addr, u8 out_plen, int is_add)
Add/delete deterministic NAT mapping.
u32 * auto_add_sw_if_indices
static int nat64_api_bib_walk(nat64_db_bib_entry_t *bibe, void *arg)
static void vl_api_nat66_static_mapping_dump_t_handler(vl_api_nat66_static_mapping_dump_t *mp)
static void vl_api_dslite_get_aftr_addr_t_handler(vl_api_dslite_get_aftr_addr_t *mp)
Get NAT virtual fragmentation reassembly configuration.
static void vl_api_nat_get_reass_t_handler(vl_api_nat_get_reass_t *mp)
static void * vl_api_nat44_add_del_static_mapping_t_print(vl_api_nat44_add_del_static_mapping_t *mp, void *handle)
static void vl_api_nat_det_close_session_in_t_handler(vl_api_nat_det_close_session_in_t *mp)
static snat_det_map_t * snat_det_map_by_user(snat_main_t *sm, ip4_address_t *user_addr)
static void * vl_api_nat64_add_del_interface_addr_t_print(vl_api_nat64_add_del_interface_addr_t *mp, void *handle)
vl_api_nat44_lb_addr_port_t locals[local_num]
#define is_addr_only_static_mapping(sm)
Check if NAT static mapping is address only (1:1NAT).
static int nat_ip4_reass_walk_api(nat_reass_ip4_t *reass, void *arg)
static void vl_api_dslite_add_del_pool_addr_range_t_handler(vl_api_dslite_add_del_pool_addr_range_t *mp)
DS-Lite address details response.
void nat64_db_st_walk(nat64_db_t *db, u8 proto, nat64_db_st_walk_fn_t fn, void *ctx)
Walk NAT64 session table.
static void * vl_api_nat44_interface_add_del_output_feature_t_print(vl_api_nat44_interface_add_del_output_feature_t *mp, void *handle)
static void send_nat44_static_mapping_details(snat_static_mapping_t *m, vl_api_registration_t *reg, u32 context)
vl_api_registration_t * reg
NAT64 pool address details response.
static void * vl_api_nat_set_reass_t_print(vl_api_nat_set_reass_t *mp, void *handle)
static void vl_api_nat_ipfix_enable_disable_t_handler(vl_api_nat_ipfix_enable_disable_t *mp)
Dump NAT64 prefix details response.
Set B4 IPv6 and IPv4 addresses.
static void send_nat_worker_details(u32 worker_index, vl_api_registration_t *reg, u32 context)
Set address and port assignment algorithm.
static void vl_api_nat_det_session_dump_t_handler(vl_api_nat_det_session_dump_t *mp)
static void * vl_api_nat44_add_del_identity_mapping_t_print(vl_api_nat44_add_del_identity_mapping_t *mp, void *handle)
Add/del NAT44 address range.
void nat_set_alloc_addr_and_port_range(u16 start_port, u16 end_port)
Set address and port assignment algorithm for port range.
nat64_db_bib_entry_t * nat64_db_bib_entry_by_index(nat64_db_t *db, u8 proto, u32 bibe_index)
Get BIB entry by index and protocol.
static void * vl_api_nat_get_mss_clamping_t_print(vl_api_nat_get_mss_clamping_t *mp, void *handle)
Close deterministic NAT session by inside address and port.
static void vl_api_nat64_interface_dump_t_handler(vl_api_nat64_interface_dump_t *mp)
static void * vl_api_nat44_static_mapping_dump_t_print(vl_api_nat44_static_mapping_dump_t *mp, void *handle)
#define clib_bitmap_free(v)
Free a bitmap.
Dump determinstic NAT sessions.
static void * vl_api_nat_det_forward_t_print(vl_api_nat_det_forward_t *mp, void *handle)
static void vl_api_nat66_interface_dump_t_handler(vl_api_nat66_interface_dump_t *mp)
static void * vl_api_nat_set_mss_clamping_t_print(vl_api_nat_set_mss_clamping_t *mp, void *handle)
int nat44_del_session(snat_main_t *sm, ip4_address_t *addr, u16 port, snat_protocol_t proto, u32 vrf_id, int is_in)
Delete NAT44 session.
snat_address_t * twice_nat_addresses
void nat64_prefix_walk(nat64_prefix_walk_fn_t fn, void *ctx)
Walk NAT64 prefixes.
Set TCP MSS rewriting configuration.
void nat64_interfaces_walk(nat64_interface_walk_fn_t fn, void *ctx)
Walk NAT64 interfaces.
int dslite_set_aftr_ip4_addr(dslite_main_t *dm, ip4_address_t *addr)
NAT64 global declarations.
counter_t bytes
byte counter
int nat64_set_tcp_timeouts(u32 trans, u32 est)
Set TCP session timeouts.
void increment_v4_address(ip4_address_t *a)
Increment IPv4 address.
vlib_combined_counter_main_t session_counters
Session counters.
static void * vl_api_nat44_add_del_address_range_t_print(vl_api_nat44_add_del_address_range_t *mp, void *handle)
void nat66_interfaces_walk(nat66_interface_walk_fn_t fn, void *ctx)
Add/delete NAT44 load-balancing static mapping rule.
Dump NAT deterministic mappings.
Get TCP MSS rewriting configuration reply.
Show NAT plugin startup config reply.
static u32 ip_proto_to_snat_proto(u8 ip_proto)
The NAT inline functions.
Get outside address and port range from inside address.
static void vl_api_dslite_get_b4_addr_t_handler(vl_api_dslite_get_b4_addr_t *mp)
static void vl_api_nat44_interface_dump_t_handler(vl_api_nat44_interface_dump_t *mp)
Dump interfaces with NAT66 feature.
Add/delete NAT44 static mapping.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
int dslite_set_b4_ip6_addr(dslite_main_t *dm, ip6_address_t *addr)
static void * vl_api_nat44_add_del_interface_addr_t_print(vl_api_nat44_add_del_interface_addr_t *mp, void *handle)
static void * vl_api_nat44_user_session_dump_t_print(vl_api_nat44_user_session_dump_t *mp, void *handle)
#define is_out2in_only_static_mapping(sm)
Check if NAT static mapping match only out2in direction.
Dump NAT44 static mappings.
Deterministic NAT sessions reply.
static void vl_api_nat64_add_del_static_bib_t_handler(vl_api_nat64_add_del_static_bib_t *mp)
Dump interfaces with NAT64 feature.
NAT44 pool addresses interfaces details response.
snat_main_per_thread_data_t * per_thread_data
void nat_ip6_reass_walk(nat_ip6_reass_walk_fn_t fn, void *ctx)
Walk IPv6 reassemblies.
static void vl_api_nat_set_mss_clamping_t_handler(vl_api_nat_set_mss_clamping_t *mp)
fib_table_t * fib_table_get(fib_node_index_t index, fib_protocol_t proto)
Get a pointer to a FIB table.
int nat66_static_mapping_add_del(ip6_address_t *l_addr, ip6_address_t *e_addr, u32 vrf_id, u8 is_add)
Enable/disable NAT IPFIX logging.
snat_address_t * addresses
NAT44 user's sessions.
int snat_add_interface_address(snat_main_t *sm, u32 sw_if_index, int is_del, u8 twice_nat)
Add/delete NAT44 pool address from specific interfce.
static void * vl_api_nat64_add_del_interface_t_print(vl_api_nat64_add_del_interface_t *mp, void *handle)
struct _svm_queue svm_queue_t
static snat_det_session_t * snat_det_get_ses_by_out(snat_det_map_t *dm, ip4_address_t *in_addr, u64 out_key)
snat_static_map_resolve_t * to_resolve
ip4_main_t ip4_main
Global ip4 main structure.
static void vl_api_nat44_address_dump_t_handler(vl_api_nat44_address_dump_t *mp)
struct fib_table_t_ * fibs
Vector of FIBs.
u32 translation_memory_size
#define vec_foreach(var, vec)
Vector iterator.
static void setup_message_id_table(snat_main_t *sm, api_main_t *am)
static void plugin_custom_dump_configure(snat_main_t *sm)
static void vl_api_nat44_interface_add_del_feature_t_handler(vl_api_nat44_interface_add_del_feature_t *mp)
nat66_static_mapping_t * sm
Static mapping pool.
static void vl_api_nat64_st_dump_t_handler(vl_api_nat64_st_dump_t *mp)
int snat_set_workers(uword *bitmap)
Set NAT plugin workers.
#define is_twice_nat_session(s)
Check if NAT session is twice NAT.
struct nat66_api_walk_ctx_t_ nat66_api_walk_ctx_t
u32 nat64_bib_memory_size
Response to get B4 IPv6 and IPv4 addresses.
static void * vl_api_nat_det_close_session_out_t_print(vl_api_nat_det_close_session_out_t *mp, void *handle)
static void * vl_api_nat44_interface_add_del_feature_t_print(vl_api_nat44_interface_add_del_feature_t *mp, void *handle)
static void * vl_api_nat64_prefix_dump_t_print(vl_api_nat64_prefix_dump_t *mp, void *handle)
NAT plugin virtual fragmentation reassembly.
Get inside address from outside address and port.
void nat_set_alloc_addr_and_port_mape(u16 psid, u16 psid_offset, u16 psid_length)
Set address and port assignment algorithm for MAP-E CE.
NAT66 global declarations.
static void * vl_api_dslite_set_b4_addr_t_print(vl_api_dslite_set_b4_addr_t *mp, void *handle)
Get AFTR IPv6 and IPv4 addresses.
static void * vl_api_nat_reass_dump_t_print(vl_api_nat_reass_dump_t *mp, void *handle)
Enable/disable NAT44 feature on the interface.
void nat64_db_bib_walk(nat64_db_t *db, u8 proto, nat64_db_bib_walk_fn_t fn, void *ctx)
Walk NAT64 BIB.
int nat64_add_del_static_bib_entry(ip6_address_t *in_addr, ip4_address_t *out_addr, u16 in_port, u16 out_port, u8 proto, u32 vrf_id, u8 is_add)
Add/delete static NAT64 BIB entry.
snat_session_t * sessions
int dslite_set_aftr_ip6_addr(dslite_main_t *dm, ip6_address_t *addr)
static void vl_api_nat44_static_mapping_dump_t_handler(vl_api_nat44_static_mapping_dump_t *mp)
static void vl_api_nat_set_reass_t_handler(vl_api_nat_set_reass_t *mp)
snat_interface_t * interfaces
#define VALIDATE_SW_IF_INDEX(mp)
A protocol Independent FIB table.
static void vl_api_nat44_interface_output_feature_dump_t_handler(vl_api_nat44_interface_output_feature_dump_t *mp)
Show NAT plugin startup config.
NAT44 address details response.
u16 vl_msg_api_get_msg_ids(const char *name, int n)
NAT64 session table details response.
static void vl_api_nat64_add_del_interface_t_handler(vl_api_nat64_add_del_interface_t *mp)
u32 tcp_established_timeout
struct nat_api_walk_ctx_t_ nat_api_walk_ctx_t