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); \ 79 rmp->
vpe_pid = ntohl (getpid ());
89 s =
format (0,
"SCRIPT: nat_control_ping ");
136 s =
format (0,
"SCRIPT: nat_show_config ");
182 s =
format (0,
"SCRIPT: nat_show_config_2 ");
191 vl_api_nat_set_workers_reply_t *rmp;
200 rv = VNET_API_ERROR_FEATURE_DISABLED;
221 s =
format (0,
"SCRIPT: nat_set_workers ");
279 s =
format (0,
"SCRIPT: nat_worker_dump ");
289 vl_api_nat44_set_session_limit_reply_t *rmp;
304 s =
format (0,
"SCRIPT: nat44_set_session_limit ");
315 vl_api_nat_set_log_level_reply_t *rmp;
319 rv = VNET_API_ERROR_UNSUPPORTED;
332 s =
format (0,
"SCRIPT: nat_set_log_level ");
343 vl_api_nat_ipfix_enable_disable_reply_t *rmp;
352 REPLY_MACRO (VL_API_NAT_IPFIX_ENABLE_DISABLE_REPLY);
361 s =
format (0,
"SCRIPT: nat_ipfix_enable_disable ");
365 s =
format (s,
"src_port %d ", clib_net_to_host_u16 (mp->
src_port));
367 s =
format (s,
"disable ");
376 vl_api_nat_set_timeouts_reply_t *rmp;
403 s =
format (0,
"SCRIPT: nat_set_timeouts ");
404 s =
format (s,
"udp %d tcp_established %d tcp_transitory %d icmp %d\n",
435 s =
format (0,
"SCRIPT: nat_get_timeouts");
445 vl_api_nat_set_addr_and_port_alloc_alg_reply_t *rmp;
447 u16 port_start, port_end;
451 case NAT_ADDR_AND_PORT_ALLOC_ALG_DEFAULT:
454 case NAT_ADDR_AND_PORT_ALLOC_ALG_MAPE:
458 case NAT_ADDR_AND_PORT_ALLOC_ALG_RANGE:
461 if (port_end <= port_start)
463 rv = VNET_API_ERROR_INVALID_VALUE;
469 rv = VNET_API_ERROR_INVALID_VALUE;
474 REPLY_MACRO (VL_API_NAT_SET_ADDR_AND_PORT_ALLOC_ALG_REPLY);
482 s =
format (0,
"SCRIPT: nat_set_addr_and_port_alloc_alg ");
483 s =
format (s,
"alg %d psid_offset %d psid_length %d psid %d start_port %d " 501 REPLY_MACRO2 (VL_API_NAT_GET_ADDR_AND_PORT_ALLOC_ALG_REPLY,
518 s =
format (0,
"SCRIPT: nat_get_addr_and_port_alloc_alg");
527 vl_api_nat_set_mss_clamping_reply_t *rmp;
544 s =
format (0,
"SCRIPT: nat_set_mss_clamping enable %d mss_value %d\n",
572 s =
format (0,
"SCRIPT: nat_get_mss_clamping");
581 vl_api_nat_ha_set_listener_reply_t *rmp;
585 memcpy (&addr, &mp->
ip_address, sizeof (addr));
588 clib_net_to_host_u32 (mp->
path_mtu));
599 s =
format (0,
"SCRIPT: nat_ha_set_listener ");
601 s =
format (s,
"port %d ", clib_net_to_host_u16 (mp->
port));
602 s =
format (s,
"path_mtu %d", clib_net_to_host_u32 (mp->
path_mtu));
623 rmp->
port = clib_host_to_net_u16 (port);
624 rmp->
path_mtu = clib_host_to_net_u32 (path_mtu);
635 s =
format (0,
"SCRIPT: nat_ha_get_listener");
644 vl_api_nat_ha_set_failover_reply_t *rmp;
648 memcpy (&addr, &mp->
ip_address, sizeof (addr));
662 s =
format (0,
"SCRIPT: nat_ha_set_failover ");
664 s =
format (s,
"port %d ", clib_net_to_host_u16 (mp->
port));
677 u32 session_refresh_interval;
685 rmp->
port = clib_host_to_net_u16 (port);
697 s =
format (0,
"SCRIPT: nat_ha_get_failover");
706 vl_api_nat_ha_flush_reply_t *rmp;
719 s =
format (0,
"SCRIPT: nat_ha_flush ");
750 vl_api_nat_ha_resync_reply_t *rmp;
766 s =
format (0,
"SCRIPT: nat_ha_resync ");
769 clib_host_to_net_u32 (mp->
pid));
781 vl_api_nat44_del_user_reply_t *rmp;
793 s =
format (0,
"SCRIPT: nat44_del_user ");
794 s =
format (s,
"ip_address %U fib_index %U ",
804 vl_api_nat44_add_del_address_range_reply_t *rmp;
806 u8 is_add, twice_nat;
807 u32 start_host_order, end_host_order;
815 rv = VNET_API_ERROR_FEATURE_DISABLED;
820 twice_nat = mp->
flags & NAT_API_IS_TWICE_NAT;
823 start_host_order = clib_host_to_net_u32 (tmp[0]);
825 end_host_order = clib_host_to_net_u32 (tmp[0]);
827 count = (end_host_order - start_host_order) + 1;
829 vrf_id = clib_host_to_net_u32 (mp->
vrf_id);
838 for (i = 0; i <
count; i++)
855 REPLY_MACRO (VL_API_NAT44_ADD_DEL_ADDRESS_RANGE_REPLY);
863 s =
format (0,
"SCRIPT: nat44_add_address_range ");
869 s =
format (s,
"twice_nat %d ", mp->
flags & NAT_API_IS_TWICE_NAT);
893 rmp->
flags |= NAT_API_IS_TWICE_NAT;
924 s =
format (0,
"SCRIPT: nat44_address_dump ");
934 vl_api_nat44_interface_add_del_feature_reply_t *rmp;
949 REPLY_MACRO (VL_API_NAT44_INTERFACE_ADD_DEL_FEATURE_REPLY);
957 s =
format (0,
"SCRIPT: nat44_interface_add_del_feature ");
958 s =
format (s,
"sw_if_index %d %s %s",
960 mp->
flags & NAT_API_IS_INSIDE ?
"in" :
"out",
979 rmp->
flags |= NAT_API_IS_INSIDE;
981 rmp->
flags |= NAT_API_IS_OUTSIDE;
1002 send_nat44_interface_details(i, reg, mp->context);
1013 s =
format (0,
"SCRIPT: nat44_interface_dump ");
1023 vl_api_nat44_interface_add_del_output_feature_reply_t *rmp;
1030 mp->
flags & NAT_API_IS_INSIDE,
1034 REPLY_MACRO (VL_API_NAT44_INTERFACE_ADD_DEL_OUTPUT_FEATURE_REPLY);
1042 s =
format (0,
"SCRIPT: nat44_interface_add_del_output_feature ");
1043 s =
format (s,
"sw_if_index %d %s %s",
1045 mp->
flags & NAT_API_IS_INSIDE ?
"in" :
"out",
1046 mp->
is_add ?
"" :
"del");
1067 rmp->
flags |= NAT_API_IS_INSIDE;
1087 send_nat44_interface_output_feature_details(i, reg, mp->context);
1097 s =
format (0,
"SCRIPT: nat44_interface_output_feature_dump ");
1107 vl_api_nat44_add_del_static_mapping_reply_t *rmp;
1109 u16 local_port = 0, external_port = 0;
1119 if (!(mp->
flags & NAT_API_IS_ADDR_ONLY))
1125 vrf_id = clib_net_to_host_u32 (mp->
vrf_id);
1129 if (mp->
flags & NAT_API_IS_TWICE_NAT)
1131 else if (mp->
flags & NAT_API_IS_SELF_TWICE_NAT)
1133 mp->
tag[
sizeof (mp->
tag) - 1] = 0;
1138 external_port, vrf_id,
1139 mp->
flags & NAT_API_IS_ADDR_ONLY,
1140 external_sw_if_index, proto,
1142 mp->
flags & NAT_API_IS_OUT2IN_ONLY, tag, 0,
1146 REPLY_MACRO (VL_API_NAT44_ADD_DEL_STATIC_MAPPING_REPLY);
1154 vl_api_nat44_add_del_static_mapping_v2_reply_t *rmp;
1156 u16 local_port = 0, external_port = 0;
1167 if (!(mp->
flags & NAT_API_IS_ADDR_ONLY))
1173 vrf_id = clib_net_to_host_u32 (mp->
vrf_id);
1177 if (mp->
flags & NAT_API_IS_TWICE_NAT)
1179 else if (mp->
flags & NAT_API_IS_SELF_TWICE_NAT)
1181 mp->
tag[
sizeof (mp->
tag) - 1] = 0;
1186 external_port, vrf_id,
1187 mp->
flags & NAT_API_IS_ADDR_ONLY,
1188 external_sw_if_index, proto,
1190 mp->
flags & NAT_API_IS_OUT2IN_ONLY, tag, 0,
1194 REPLY_MACRO (VL_API_NAT44_ADD_DEL_STATIC_MAPPING_V2_REPLY);
1202 s =
format (0,
"SCRIPT: nat44_add_del_static_mapping ");
1203 s =
format (s,
"protocol %d local_addr %U external_addr %U ",
1208 if (!(mp->
flags & NAT_API_IS_ADDR_ONLY))
1209 s =
format (s,
"local_port %d external_port %d ",
1213 s =
format (s,
"twice_nat %d out2in_only %d ",
1214 mp->
flags & NAT_API_IS_TWICE_NAT,
1215 mp->
flags & NAT_API_IS_OUT2IN_ONLY);
1218 s =
format (s,
"vrf %d", clib_net_to_host_u32 (mp->
vrf_id));
1221 s =
format (s,
"external_sw_if_index %d",
1231 s =
format (0,
"SCRIPT: nat44_add_del_static_mapping_v2 ");
1232 s =
format (s,
"protocol %d local_addr %U external_addr %U ",
1237 if (!(mp->
flags & NAT_API_IS_ADDR_ONLY))
1238 s =
format (s,
"local_port %d external_port %d ",
1242 s =
format (s,
"twice_nat %d out2in_only %d ",
1243 mp->
flags & NAT_API_IS_TWICE_NAT,
1244 mp->
flags & NAT_API_IS_OUT2IN_ONLY);
1247 s =
format (s,
"vrf %d", clib_net_to_host_u32 (mp->
vrf_id));
1250 s =
format (s,
"external_sw_if_index %d",
1253 s =
format (s,
"match pool address %U",
1279 rmp->
flags |= NAT_API_IS_TWICE_NAT;
1281 rmp->
flags |= NAT_API_IS_SELF_TWICE_NAT;
1284 rmp->
flags |= NAT_API_IS_OUT2IN_ONLY;
1288 rmp->
flags |= NAT_API_IS_ADDR_ONLY;
1321 rmp->
flags |= NAT_API_IS_TWICE_NAT;
1325 rmp->
flags |= NAT_API_IS_ADDR_ONLY;
1356 if (!is_identity_static_mapping(m) && !is_lb_static_mapping (m))
1357 send_nat44_static_mapping_details (m, reg, mp->context);
1375 s =
format (0,
"SCRIPT: nat44_static_mapping_dump ");
1385 vl_api_nat44_add_del_identity_mapping_reply_t *rmp;
1393 if (!(mp->
flags & NAT_API_IS_ADDR_ONLY))
1398 vrf_id = clib_net_to_host_u32 (mp->
vrf_id);
1399 sw_if_index = clib_net_to_host_u32 (mp->
sw_if_index);
1400 if (sw_if_index != ~0)
1404 mp->
tag[
sizeof (mp->
tag) - 1] = 0;
1410 mp->
flags & NAT_API_IS_ADDR_ONLY, sw_if_index,
1411 proto, mp->
is_add, 0, 0, tag, 1, pool_addr, 0);
1414 REPLY_MACRO (VL_API_NAT44_ADD_DEL_IDENTITY_MAPPING_REPLY);
1422 s =
format (0,
"SCRIPT: nat44_add_del_identity_mapping ");
1428 if (!(mp->
flags & NAT_API_IS_ADDR_ONLY))
1431 clib_net_to_host_u16 (mp->
port));
1434 s =
format (s,
" vrf %d", clib_net_to_host_u32 (mp->
vrf_id));
1453 rmp->
flags |= NAT_API_IS_ADDR_ONLY;
1481 rmp->
flags = (vl_api_nat_config_flags_t) NAT_API_IS_ADDR_ONLY;
1511 if (is_identity_static_mapping(m) && !is_lb_static_mapping (m))
1513 pool_foreach_index (j, m->locals,
1515 send_nat44_identity_mapping_details (m, j, reg, mp->context);
1521 for (j = 0; j <
vec_len (sm->to_resolve); j++)
1523 rp = sm->to_resolve + j;
1524 if (rp->identity_nat)
1534 s =
format (0,
"SCRIPT: nat44_identity_mapping_dump ");
1544 vl_api_nat44_add_del_interface_addr_reply_t *rmp;
1554 mp->
flags & NAT_API_IS_TWICE_NAT);
1557 REPLY_MACRO (VL_API_NAT44_ADD_DEL_INTERFACE_ADDR_REPLY);
1565 s =
format (0,
"SCRIPT: nat44_add_del_interface_addr ");
1566 s =
format (s,
"sw_if_index %d twice_nat %d %s",
1568 mp->
flags & NAT_API_IS_TWICE_NAT, mp->
is_add ?
"" :
"del");
1588 rmp->
flags = (vl_api_nat_config_flags_t) NAT_API_IS_TWICE_NAT;
1620 s =
format (0,
"SCRIPT: nat44_interface_addr_dump ");
1656 k.
addr = s->in2out.addr;
1661 if (clib_bihash_search_8_8 (&tsm->
user_hash, &key, &value))
1669 clib_bihash_add_del_8_8 (&tsm->
user_hash, &key, 1);
1728 send_nat44_user_details (u, reg, mp->context);
1743 s =
format (0,
"SCRIPT: nat44_user_dump ");
1763 rmp->
flags |= NAT_API_IS_STATIC;
1766 rmp->
flags |= NAT_API_IS_TWICE_NAT;
1769 rmp->
flags |= NAT_API_IS_EXT_HOST_VALID;
1771 rmp->
last_heard = clib_host_to_net_u64 ((
u64) s->last_heard);
1772 rmp->
total_bytes = clib_host_to_net_u64 (s->total_bytes);
1812 u32 session_index, head_index, elt_index;
1832 if (clib_bihash_search_8_8 (&tsm->user_hash, &key, &value))
1840 elt_index = head->
next;
1842 session_index = elt->
value;
1843 while (session_index != ~0)
1849 elt_index = elt->
next;
1851 session_index = elt->
value;
1858 if (s->in2out.addr.as_u32 == ukey.addr.as_u32)
1860 send_nat44_user_session_details (s, reg, mp->context);
1873 s =
format (0,
"SCRIPT: nat44_user_session_dump ");
1874 s =
format (s,
"ip_address %U vrf_id %d\n",
1876 clib_net_to_host_u32 (mp->
vrf_id));
1883 u32 addr_port_pair_num)
1887 vl_api_nat44_lb_addr_port_t *ap;
1889 for (i = 0; i < addr_port_pair_num; i++)
1891 ap = &addr_port_pairs[
i];
1892 clib_memset (&lb_addr_port, 0,
sizeof (lb_addr_port));
1894 lb_addr_port.port = ap->port;
1895 lb_addr_port.probability = ap->probability;
1896 lb_addr_port.vrf_id = clib_net_to_host_u32 (ap->vrf_id);
1897 vec_add1 (lb_addr_port_pairs, lb_addr_port);
1900 return lb_addr_port_pairs;
1908 vl_api_nat44_add_del_lb_static_mapping_reply_t *rmp;
1918 rv = VNET_API_ERROR_UNSUPPORTED;
1928 if (mp->
flags & NAT_API_IS_TWICE_NAT)
1930 else if (mp->
flags & NAT_API_IS_SELF_TWICE_NAT)
1932 mp->
tag[
sizeof (mp->
tag) - 1] = 0;
1939 proto, locals, mp->
is_add,
1941 mp->
flags & NAT_API_IS_OUT2IN_ONLY, tag,
1942 clib_net_to_host_u32 (mp->
affinity));
1948 REPLY_MACRO (VL_API_NAT44_ADD_DEL_LB_STATIC_MAPPING_REPLY);
1956 s =
format (0,
"SCRIPT: nat44_add_del_lb_static_mapping ");
1957 s =
format (s,
"is_add %d twice_nat %d out2in_only %d ",
1959 mp->
flags & NAT_API_IS_TWICE_NAT,
1960 mp->
flags & NAT_API_IS_OUT2IN_ONLY);
1970 vl_api_nat44_lb_static_mapping_add_del_local_reply_t *rmp;
1977 rv = VNET_API_ERROR_UNSUPPORTED;
1987 clib_net_to_host_u16
1989 clib_net_to_host_u16 (mp->
1992 clib_net_to_host_u32 (mp->
1997 REPLY_MACRO (VL_API_NAT44_LB_STATIC_MAPPING_ADD_DEL_LOCAL_REPLY);
2005 s =
format (0,
"SCRIPT: nat44_lb_static_mapping_add_del_local ");
2019 vl_api_nat44_lb_addr_port_t *locals;
2036 rmp->
flags |= NAT_API_IS_TWICE_NAT;
2038 rmp->
flags |= NAT_API_IS_SELF_TWICE_NAT;
2040 rmp->
flags |= NAT_API_IS_OUT2IN_ONLY;
2044 locals = (vl_api_nat44_lb_addr_port_t *) rmp->
locals;
2048 clib_memcpy (locals->addr, &(ap->addr), 4);
2049 locals->port = ap->port;
2050 locals->probability = ap->probability;
2051 locals->vrf_id = ntohl (ap->vrf_id);
2079 if (is_lb_static_mapping(m))
2080 send_nat44_lb_static_mapping_details (m, reg, mp->context);
2090 s =
format (0,
"SCRIPT: nat44_lb_static_mapping_dump ");
2099 vl_api_nat44_del_session_reply_t *rmp;
2109 vrf_id = clib_net_to_host_u32 (mp->
vrf_id);
2114 is_in = mp->
flags & NAT_API_IS_INSIDE;
2116 if (mp->
flags & NAT_API_IS_EXT_HOST_VALID)
2132 s =
format (0,
"SCRIPT: nat44_add_del_session ");
2133 s =
format (s,
"addr %U port %d protocol %d vrf_id %d is_in %d",
2135 clib_net_to_host_u16 (mp->
port),
2137 mp->
flags & NAT_API_IS_INSIDE);
2138 if (mp->
flags & NAT_API_IS_EXT_HOST_VALID)
2139 s =
format (s,
"ext_host_address %U ext_host_port %d",
2151 vl_api_nat44_forwarding_enable_disable_reply_t *rmp;
2153 u32 *ses_to_be_removed = 0, *ses_index;
2166 if (is_fwd_bypass_session(s))
2168 vec_add1 (ses_to_be_removed, s - tsm->sessions);
2191 REPLY_MACRO (VL_API_NAT44_FORWARDING_ENABLE_DISABLE_REPLY);
2199 s =
format (0,
"SCRIPT: nat44_forwarding_enable_disable ");
2233 s =
format (0,
"SCRIPT: nat44_forwarding_is_enabled ");
2246 vl_api_nat64_add_del_pool_addr_range_reply_t *rmp;
2250 u32 start_host_order, end_host_order;
2256 start_host_order = clib_host_to_net_u32 (tmp[0]);
2258 end_host_order = clib_host_to_net_u32 (tmp[0]);
2260 count = (end_host_order - start_host_order) + 1;
2262 vrf_id = clib_host_to_net_u32 (mp->
vrf_id);
2266 for (i = 0; i <
count; i++)
2275 REPLY_MACRO (VL_API_NAT64_ADD_DEL_POOL_ADDR_RANGE_REPLY);
2283 s =
format (0,
"SCRIPT: nat64_add_del_pool_addr_range ");
2284 s =
format (s,
"%U - %U vrf_id %u %s\n",
2308 rmp->_vl_msg_id =
ntohs (VL_API_NAT64_POOL_ADDR_DETAILS + sm->
msg_id_base);
2349 s =
format (0,
"SCRIPT: nat64_pool_addr_dump\n");
2359 vl_api_nat64_add_del_interface_reply_t *rmp;
2370 REPLY_MACRO (VL_API_NAT64_ADD_DEL_INTERFACE_REPLY);
2379 s =
format (0,
"SCRIPT: nat64_add_del_interface ");
2380 s =
format (s,
"sw_if_index %d %s %s",
2382 mp->
flags & NAT_API_IS_INSIDE ?
"in" :
"out",
2383 mp->
is_add ?
"" :
"del");
2397 rmp->_vl_msg_id =
ntohs (VL_API_NAT64_INTERFACE_DETAILS + sm->
msg_id_base);
2401 rmp->
flags |= NAT_API_IS_INSIDE;
2403 rmp->
flags |= NAT_API_IS_OUTSIDE;
2435 s =
format (0,
"SCRIPT: snat_interface_dump ");
2445 vl_api_nat64_add_del_static_bib_reply_t *rmp;
2446 ip6_address_t in_addr;
2450 memcpy (&in_addr.as_u8, mp->
i_addr, 16);
2455 clib_net_to_host_u16 (mp->
i_port),
2456 clib_net_to_host_u16 (mp->
o_port),
2458 clib_net_to_host_u32 (mp->
vrf_id),
2461 REPLY_MACRO (VL_API_NAT64_ADD_DEL_STATIC_BIB_REPLY);
2469 s =
format (0,
"SCRIPT: nat64_add_del_static_bib ");
2470 s =
format (s,
"protocol %d i_addr %U o_addr %U ",
2475 s =
format (s,
"vrf %d", clib_net_to_host_u32 (mp->
vrf_id));
2498 rmp->
i_port = bibe->in_port;
2499 rmp->
o_port = bibe->out_port;
2501 rmp->
proto = bibe->proto;
2502 if (bibe->is_static)
2503 rmp->
flags |= NAT_API_IS_STATIC;
2504 rmp->
ses_num = ntohl (bibe->ses_num);
2538 s =
format (0,
"SCRIPT: snat_bib_dump protocol %d", mp->
proto);
2549 nat64_db_bib_entry_t *bibe;
2567 rmp->
ol_port = bibe->out_port;
2572 rmp->
proto = ste->proto;
2609 s =
format (0,
"SCRIPT: snat_st_dump protocol %d", mp->
proto);
2617 vl_api_nat64_add_del_prefix_reply_t *rmp;
2622 memcpy (&prefix.as_u8, mp->
prefix.address, 16);
2636 s =
format (0,
"SCRIPT: nat64_add_del_prefix %U/%u vrf_id %u %s\n",
2686 s =
format (0,
"SCRIPT: nat64_prefix_dump\n");
2696 vl_api_nat64_add_del_interface_addr_reply_t *rmp;
2706 REPLY_MACRO (VL_API_NAT64_ADD_DEL_INTERFACE_ADDR_REPLY);
2714 s =
format (0,
"SCRIPT: nat64_add_del_interface_addr ");
2715 s =
format (s,
"sw_if_index %d %s",
2717 mp->
is_add ?
"" :
"del");
2723 #define foreach_snat_plugin_api_msg \ 2724 _(NAT_CONTROL_PING, nat_control_ping) \ 2725 _(NAT_SHOW_CONFIG, nat_show_config) \ 2726 _(NAT_SHOW_CONFIG_2, nat_show_config_2) \ 2727 _(NAT_SET_WORKERS, nat_set_workers) \ 2728 _(NAT_WORKER_DUMP, nat_worker_dump) \ 2729 _(NAT44_DEL_USER, nat44_del_user) \ 2730 _(NAT44_SET_SESSION_LIMIT, nat44_set_session_limit) \ 2731 _(NAT_SET_LOG_LEVEL, nat_set_log_level) \ 2732 _(NAT_IPFIX_ENABLE_DISABLE, nat_ipfix_enable_disable) \ 2733 _(NAT_SET_TIMEOUTS, nat_set_timeouts) \ 2734 _(NAT_GET_TIMEOUTS, nat_get_timeouts) \ 2735 _(NAT_SET_ADDR_AND_PORT_ALLOC_ALG, nat_set_addr_and_port_alloc_alg) \ 2736 _(NAT_GET_ADDR_AND_PORT_ALLOC_ALG, nat_get_addr_and_port_alloc_alg) \ 2737 _(NAT_SET_MSS_CLAMPING, nat_set_mss_clamping) \ 2738 _(NAT_GET_MSS_CLAMPING, nat_get_mss_clamping) \ 2739 _(NAT_HA_SET_LISTENER, nat_ha_set_listener) \ 2740 _(NAT_HA_SET_FAILOVER, nat_ha_set_failover) \ 2741 _(NAT_HA_GET_LISTENER, nat_ha_get_listener) \ 2742 _(NAT_HA_GET_FAILOVER, nat_ha_get_failover) \ 2743 _(NAT_HA_FLUSH, nat_ha_flush) \ 2744 _(NAT_HA_RESYNC, nat_ha_resync) \ 2745 _(NAT44_ADD_DEL_ADDRESS_RANGE, nat44_add_del_address_range) \ 2746 _(NAT44_INTERFACE_ADD_DEL_FEATURE, nat44_interface_add_del_feature) \ 2747 _(NAT44_ADD_DEL_STATIC_MAPPING, nat44_add_del_static_mapping) \ 2748 _(NAT44_ADD_DEL_STATIC_MAPPING_V2, nat44_add_del_static_mapping_v2) \ 2749 _(NAT44_ADD_DEL_IDENTITY_MAPPING, nat44_add_del_identity_mapping) \ 2750 _(NAT44_STATIC_MAPPING_DUMP, nat44_static_mapping_dump) \ 2751 _(NAT44_IDENTITY_MAPPING_DUMP, nat44_identity_mapping_dump) \ 2752 _(NAT44_ADDRESS_DUMP, nat44_address_dump) \ 2753 _(NAT44_INTERFACE_DUMP, nat44_interface_dump) \ 2754 _(NAT44_ADD_DEL_INTERFACE_ADDR, nat44_add_del_interface_addr) \ 2755 _(NAT44_INTERFACE_ADDR_DUMP, nat44_interface_addr_dump) \ 2756 _(NAT44_USER_DUMP, nat44_user_dump) \ 2757 _(NAT44_USER_SESSION_DUMP, nat44_user_session_dump) \ 2758 _(NAT44_INTERFACE_ADD_DEL_OUTPUT_FEATURE, \ 2759 nat44_interface_add_del_output_feature) \ 2760 _(NAT44_INTERFACE_OUTPUT_FEATURE_DUMP, \ 2761 nat44_interface_output_feature_dump) \ 2762 _(NAT44_ADD_DEL_LB_STATIC_MAPPING, nat44_add_del_lb_static_mapping) \ 2763 _(NAT44_LB_STATIC_MAPPING_ADD_DEL_LOCAL, \ 2764 nat44_lb_static_mapping_add_del_local) \ 2765 _(NAT44_LB_STATIC_MAPPING_DUMP, nat44_lb_static_mapping_dump) \ 2766 _(NAT44_DEL_SESSION, nat44_del_session) \ 2767 _(NAT44_FORWARDING_ENABLE_DISABLE, nat44_forwarding_enable_disable) \ 2768 _(NAT44_FORWARDING_IS_ENABLED, nat44_forwarding_is_enabled) \ 2769 _(NAT64_ADD_DEL_POOL_ADDR_RANGE, nat64_add_del_pool_addr_range) \ 2770 _(NAT64_POOL_ADDR_DUMP, nat64_pool_addr_dump) \ 2771 _(NAT64_ADD_DEL_INTERFACE, nat64_add_del_interface) \ 2772 _(NAT64_INTERFACE_DUMP, nat64_interface_dump) \ 2773 _(NAT64_ADD_DEL_STATIC_BIB, nat64_add_del_static_bib) \ 2774 _(NAT64_BIB_DUMP, nat64_bib_dump) \ 2775 _(NAT64_ST_DUMP, nat64_st_dump) \ 2776 _(NAT64_ADD_DEL_PREFIX, nat64_add_del_prefix) \ 2777 _(NAT64_PREFIX_DUMP, nat64_prefix_dump) \ 2778 _(NAT64_ADD_DEL_INTERFACE_ADDR, nat64_add_del_interface_addr) 2786 vl_msg_api_set_handlers((VL_API_##N + sm->msg_id_base), \ 2788 vl_api_##n##_t_handler, \ 2790 vl_api_##n##_t_endian, \ 2791 vl_api_##n##_t_print, \ 2792 sizeof(vl_api_##n##_t), 1); 2799 #define vl_msg_name_crc_list 2801 #undef vl_msg_name_crc_list 2806 #define _(id,n,crc) \ 2807 vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id + sm->msg_id_base); 2808 foreach_vl_msg_name_crc_nat;
2815 #define _(n,f) sm->api_main->msg_print_handlers \ 2816 [VL_API_##n + sm->msg_id_base] \ 2817 = (void *) vl_api_##f##_t_print; 2828 name =
format (0,
"nat_%08x%c", api_version, 0);
ip4_address_t external_addr
vl_api_ip4_address_t ext_host_address
NAT64 interface details response.
vl_api_interface_index_t external_sw_if_index
uword translation_memory_size
nat64_db_t * db
BIB and session DB per thread.
#define nat_log_info(...)
#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.
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)
u32 max_translations_per_user
static void vl_api_nat_worker_dump_t_handler(vl_api_nat_worker_dump_t *mp)
vl_api_interface_index_t sw_if_index
Get address and port assignment algorithm reply.
static int nat64_api_pool_walk(snat_address_t *a, void *arg)
NAT64 BIB details response.
static void * vl_api_nat44_user_dump_t_print(vl_api_nat44_user_dump_t *mp, void *handle)
static void * vl_api_nat_ha_set_listener_t_print(vl_api_nat_ha_set_listener_t *mp, void *handle)
static void * vl_api_nat_ipfix_enable_disable_t_print(vl_api_nat_ipfix_enable_disable_t *mp, void *handle)
vl_api_ip4_address_t external_addr
static void vl_api_nat_ha_set_listener_t_handler(vl_api_nat_ha_set_listener_t *mp)
Get values of timeouts for NAT sessions (seconds)
NAT workers details response.
int nat44_del_session(snat_main_t *sm, ip4_address_t *addr, u16 port, nat_protocol_t proto, u32 vrf_id, int is_in)
Delete NAT44 session.
vl_api_interface_index_t external_sw_if_index
Get values of timeouts for NAT sessions reply.
static void * vl_api_nat64_interface_dump_t_print(vl_api_nat64_interface_dump_t *mp, void *handle)
vl_api_interface_index_t sw_if_index
static void send_nat44_user_session_details(snat_session_t *s, vl_api_registration_t *reg, u32 context)
vl_api_ip4_address_t external_addr
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)
NAT44 identity mapping details response.
vl_api_ip4_address_t external_addr
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.
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vl_api_nat_config_flags_t flags
vl_api_nat_config_flags_t flags
static void vl_api_nat44_lb_static_mapping_dump_t_handler(vl_api_nat44_lb_static_mapping_dump_t *mp)
vl_api_nat_config_flags_t flags
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)
static void vl_api_nat64_bib_dump_t_handler(vl_api_nat64_bib_dump_t *mp)
static clib_error_t * snat_plugin_api_hookup(vlib_main_t *vm)
void nat_free_session_data(snat_main_t *sm, snat_session_t *s, u32 thread_index, u8 is_ha)
Free NAT44 session data (lookup keys, external address port)
static void * vl_api_nat64_bib_dump_t_print(vl_api_nat64_bib_dump_t *mp, void *handle)
Control ping from client to api server request.
static void vl_api_nat44_add_del_static_mapping_v2_t_handler(vl_api_nat44_add_del_static_mapping_v2_t *mp)
Set values of timeouts for NAT sessions (seconds)
#define vec_terminate_c_string(V)
(If necessary) NULL terminate a vector containing a c-string.
vl_api_ip4_address_t local_ip_address
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
vl_api_ip4_address_t ip_address
static void vl_api_nat44_del_user_t_handler(vl_api_nat44_del_user_t *mp)
static void vl_api_nat64_add_del_pool_addr_range_t_handler(vl_api_nat64_add_del_pool_addr_range_t *mp)
Add/delete NAT44 load-balancing static mapping rule backend.
NAT44 interface details response.
u32 session_refresh_interval
vl_api_ip6_prefix_t prefix
static void send_nat44_interface_addr_details(u32 sw_if_index, vl_api_registration_t *reg, u32 context, u8 twice_nat)
u8 * format_user_kvp(u8 *s, va_list *args)
NAT44 static mapping details response.
static void vl_api_nat_get_addr_and_port_alloc_alg_t_handler(vl_api_nat_get_addr_and_port_alloc_alg_t *mp)
vl_api_nat_config_flags_t flags
vl_api_ip4_address_t first_ip_address
bool static_mapping_connection_tracking
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.
vl_api_ip4_address_t or_addr
static void * vl_api_nat64_pool_addr_dump_t_print(vl_api_nat64_pool_addr_dump_t *mp, void *handle)
vl_api_ip4_address_t ip_address
Response to check if forwarding is enabled or disabled.
vl_api_nat_config_flags_t flags
static void nat_ed_session_delete(snat_main_t *sm, snat_session_t *ses, u32 thread_index, int lru_delete)
static void vl_api_nat_control_ping_t_handler(vl_api_nat_control_ping_t *mp)
int nat64_add_interface_address(u32 sw_if_index, int is_add)
NAT64 pool address from specific (DHCP addressed) interface.
static void vl_api_nat_show_config_2_t_handler(vl_api_nat_show_config_2_t *mp)
Get HA failover/remote settings reply.
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
Add/delete NAT64 pool address from specific interfce.
void * vl_msg_api_alloc(int nbytes)
#define snat_is_unk_proto_session(s)
Check if SNAT session for unknown protocol.
u32 max_translations_per_thread
Set HA failover (remote settings)
vl_api_nat_config_flags_t flags
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)
static void * vl_api_nat44_lb_static_mapping_add_del_local_t_print(vl_api_nat44_lb_static_mapping_add_del_local_t *mp, void *handle)
Enable/disable NAT64 feature on the interface.
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_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)
clib_bihash_8_8_t user_hash
#define clib_memcpy(d, s, n)
#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)
u32 session_refresh_interval
static void * vl_api_nat44_identity_mapping_dump_t_print(vl_api_nat44_identity_mapping_dump_t *mp, void *handle)
vl_api_nat_config_flags_t flags
vl_api_interface_index_t sw_if_index
vl_api_nat_config_flags_t flags
static void vl_api_nat44_user_dump_t_handler(vl_api_nat44_user_dump_t *mp)
vl_api_ip6_address_t ir_addr
int nat_ha_resync(u32 client_index, u32 pid, nat_ha_resync_event_cb_t event_callback)
Resync HA (resend existing sessions to new failover)
Check if forwarding is enabled or disabled.
vl_api_ip4_address_t o_addr
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
static nat_protocol_t ip_proto_to_nat_proto(u8 ip_proto)
Common NAT inline functions.
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_ha_get_listener_t_handler(vl_api_nat_ha_get_listener_t *mp)
static void vl_api_nat_set_addr_and_port_alloc_alg_t_handler(vl_api_nat_set_addr_and_port_alloc_alg_t *mp)
vl_api_nat_config_flags_t flags
static int nat64_api_st_walk(nat64_db_st_entry_t *ste, void *arg)
Enable/disbale NAT44 as an interface output feature (postrouting in2out translation) ...
vl_api_nat_config_flags_t flags
int snat_add_address(snat_main_t *sm, ip4_address_t *addr, u32 vrf_id, u8 twice_nat)
Add external address to NAT44 pool.
static void vl_api_nat_ha_resync_t_handler(vl_api_nat_ha_resync_t *mp)
int nat64_set_icmp_timeout(u32 timeout)
Set ICMP session timeout.
static void * vl_api_nat_ha_set_failover_t_print(vl_api_nat_ha_set_failover_t *mp, void *handle)
struct nat64_api_walk_ctx_t_ nat64_api_walk_ctx_t
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static void nat_ed_user_create_helper(snat_main_per_thread_data_t *tsm, snat_session_t *s)
static void nat_ed_users_create(snat_main_per_thread_data_t *tsm)
#define is_fwd_bypass_session(s)
Check if NAT session is forwarding bypass.
#define foreach_snat_plugin_api_msg
vl_api_ip6_address_t i_addr
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)
vl_api_ip4_address_t ip_address
static void vl_api_nat44_forwarding_enable_disable_t_handler(vl_api_nat44_forwarding_enable_disable_t *mp)
static void * vl_api_nat_set_log_level_t_print(vl_api_nat_set_log_level_t *mp, void *handle)
vl_api_nat_config_flags_t flags
Flush the current HA data (for testing)
vl_api_ip4_address_t external_ip_address
static void send_nat44_identity_mapping_details(snat_static_mapping_t *m, int index, vl_api_registration_t *reg, u32 context)
vl_api_nat_config_flags_t flags
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 void nat_ha_resync_completed_event_cb(u32 client_index, u32 pid, u32 missed_count)
static void * vl_api_nat_ha_resync_t_print(vl_api_nat_ha_resync_t *mp, void *handle)
static void * vl_api_nat_ha_get_listener_t_print(vl_api_nat_ha_get_listener_t *mp, void *handle)
static heap_elt_t * first(heap_header_t *h)
int nat44_set_session_limit(u32 session_limit, u32 vrf_id)
Set NAT44 session limit (session limit, vrf id)
twice_nat_type_t twice_nat
#define pool_flush(VAR, POOL, BODY)
Remove all elements from a pool in a safe way.
u32 * auto_add_sw_if_indices_twice_nat
u32 max_translations_per_user
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.
vl_api_nat_config_flags_t flags
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Control ping from the client to the server response.
static_always_inline int nat44_user_del(ip4_address_t *addr, u32 fib_index)
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)
static void * vl_api_nat_ha_flush_t_print(vl_api_nat_ha_flush_t *mp, void *handle)
nat_addr_and_port_alloc_alg_t addr_and_port_alloc_alg
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.
static void * vl_api_nat44_del_user_t_print(vl_api_nat44_del_user_t *mp, void *handle)
vl_api_nat_config_flags_t flags
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)
vl_api_nat_config_flags_t flags
u64 nat64_bib_memory_size
static void vl_api_nat_ha_get_failover_t_handler(vl_api_nat_ha_get_failover_t *mp)
static void send_nat44_interface_output_feature_details(snat_interface_t *i, vl_api_registration_t *reg, u32 context)
vl_api_nat_config_flags_t flags
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)
Tell client about a HA resync completion event.
snat_static_mapping_t * static_mappings
vl_api_ip4_address_t external_ip_address
void nat_ha_get_listener(ip4_address_t *addr, u16 *port, u32 *path_mtu)
Get HA listener/local configuration.
Set HA listener (local settings)
static void vl_api_nat_ha_set_failover_t_handler(vl_api_nat_ha_set_failover_t *mp)
void nat_ha_flush(u8 is_resync)
Flush the current HA data (for testing)
vl_api_ip6_address_t i_addr
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)
Dump NAT44 identity mappings.
u32 translation_memory_size
vl_api_ip4_address_t ext_host_nat_address
vl_api_ip4_address_t outside_ip_address
vl_api_ip4_address_t address
void nat_set_alloc_addr_and_port_default(void)
Set address and port assignment algorithm to default/standard.
static void vl_api_nat44_add_del_identity_mapping_t_handler(vl_api_nat44_add_del_identity_mapping_t *mp)
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.
vl_api_ip4_address_t ip_address
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)
vl_api_ip6_address_t il_addr
Get address and port assignment algorithm.
vl_api_ip4_address_t pool_ip_address
static void vl_api_nat44_del_session_t_handler(vl_api_nat44_del_session_t *mp)
u64 nat64_bib_memory_size
Add/delete NAT64 static BIB entry.
API main structure, used by both vpp and binary API clients.
Add/delete NAT44 static mapping.
static void * vl_api_nat_show_config_2_t_print(vl_api_nat_show_config_t *mp, void *handle)
static void vl_api_nat44_add_del_static_mapping_t_handler(vl_api_nat44_add_del_static_mapping_t *mp)
static void send_nat44_interface_details(snat_interface_t *i, vl_api_registration_t *reg, u32 context)
snat_interface_t * output_feature_interfaces
vl_api_ip4_address_t last_ip_address
An API client registration, only in vpp/vlib.
vl_api_interface_index_t sw_if_index
vl_api_ip4_address_t ip_address
#define BAD_SW_IF_INDEX_LABEL
static void vl_api_nat_ha_flush_t_handler(vl_api_nat_ha_flush_t *mp)
static void * vl_api_nat_set_timeouts_t_print(vl_api_nat_set_timeouts_t *mp, void *handle)
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)
Get HA failover/remote settings.
Dump interfaces with NAT44 feature.
void nat64_pool_addr_walk(nat64_pool_addr_walk_fn_t fn, void *ctx)
Walk NAT64 pool.
Show NAT plugin startup config reply.
u32 ft_table_id
Table ID (hash key) for this FIB.
static void vl_api_nat44_identity_mapping_dump_t_handler(vl_api_nat44_identity_mapping_dump_t *mp)
vl_api_ip4_address_t ip_address
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)
static void vl_api_nat_show_config_t_handler(vl_api_nat_show_config_t *mp)
sll srl srl sll sra u16x4 i
static void vl_api_nat44_add_del_lb_static_mapping_t_handler(vl_api_nat44_add_del_lb_static_mapping_t *mp)
u8 static_mapping_connection_tracking
Dump NAT44 load-balancing static mapping rules.
#define vec_free(V)
Free vector's memory (no header).
NAT44 user's sessions response.
static void * vl_api_nat44_interface_dump_t_print(vl_api_nat44_interface_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)
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)
vl_api_ip4_address_t ol_addr
vl_api_nat_config_flags_t flags
static void vl_api_nat64_add_del_prefix_t_handler(vl_api_nat64_add_del_prefix_t *mp)
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)
vl_api_ip4_address_t ext_host_address
static void send_nat44_lb_static_mapping_details(snat_static_mapping_t *m, vl_api_registration_t *reg, u32 context)
static void vl_api_nat44_lb_static_mapping_add_del_local_t_handler(vl_api_nat44_lb_static_mapping_add_del_local_t *mp)
u32 tcp_transitory_timeout
int nat_ha_set_listener(ip4_address_t *addr, u16 port, u32 path_mtu)
Set HA listener (local settings)
static void send_nat44_static_map_resolve_details(snat_static_map_resolve_t *m, vl_api_registration_t *reg, u32 context)
u32 * auto_add_sw_if_indices
static int nat64_api_bib_walk(nat64_db_bib_entry_t *bibe, void *arg)
static void * vl_api_nat44_add_del_static_mapping_t_print(vl_api_nat44_add_del_static_mapping_t *mp, void *handle)
Get HA listener/local configuration reply.
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).
int nat_ha_set_failover(ip4_address_t *addr, u16 port, u32 session_refresh_interval)
Set HA failover (remote settings)
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
static void * vl_api_nat_ha_get_failover_t_print(vl_api_nat_ha_get_failover_t *mp, void *handle)
NAT64 pool address details response.
static void vl_api_nat_ipfix_enable_disable_t_handler(vl_api_nat_ipfix_enable_disable_t *mp)
Dump NAT64 prefix details response.
static void send_nat_worker_details(u32 worker_index, vl_api_registration_t *reg, u32 context)
static void vl_api_nat44_set_session_limit_t_handler(vl_api_nat44_set_session_limit_t *mp)
Set address and port assignment algorithm.
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)
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.
int nat64_add_del_pool_addr(u32 thread_index, ip4_address_t *addr, u32 vrf_id, u8 is_add)
Add/delete address to NAT64 pool.
static void * vl_api_nat_set_mss_clamping_t_print(vl_api_nat_set_mss_clamping_t *mp, void *handle)
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.
vl_api_ip4_address_t o_addr
void nat64_interfaces_walk(nat64_interface_walk_fn_t fn, void *ctx)
Walk NAT64 interfaces.
vl_api_nat_config_flags_t flags
NAT64 global declarations.
int nat64_set_tcp_timeouts(u32 trans, u32 est)
Set TCP session timeouts.
bool static_mapping_connection_tracking
u64 translation_memory_size
static void * vl_api_nat44_add_del_static_mapping_v2_t_print(vl_api_nat44_add_del_static_mapping_v2_t *mp, void *handle)
static void * vl_api_nat44_add_del_address_range_t_print(vl_api_nat44_add_del_address_range_t *mp, void *handle)
vl_api_ip4_address_t local_ip_address
vl_api_interface_index_t sw_if_index
Add/delete NAT44 load-balancing static mapping rule.
Get TCP MSS rewriting configuration reply.
DEPRECATED: Show NAT plugin startup config reply.
int nat44_lb_static_mapping_add_del_local(ip4_address_t e_addr, u16 e_port, ip4_address_t l_addr, u16 l_port, nat_protocol_t proto, u32 vrf_id, u8 probability, u8 is_add)
static void vl_api_nat44_interface_dump_t_handler(vl_api_nat44_interface_dump_t *mp)
Add/delete NAT44 static mapping.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
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_nat_set_log_level_t_handler(vl_api_nat_set_log_level_t *mp)
static void * vl_api_nat44_user_session_dump_t_print(vl_api_nat44_user_session_dump_t *mp, void *handle)
vl_api_ip4_address_t start_addr
#define is_out2in_only_static_mapping(sm)
Check if NAT static mapping match only out2in direction.
static_always_inline u8 nat_proto_to_ip_proto(nat_protocol_t nat_proto)
Dump NAT44 static mappings.
vl_api_interface_index_t external_sw_if_index
vl_api_interface_index_t sw_if_index
static void * vl_api_nat44_set_session_limit_t_print(vl_api_nat44_set_session_limit_t *mp, void *handle)
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
vl_api_interface_index_t sw_if_index
vl_api_ip4_address_t ip_address
static void vl_api_nat_set_mss_clamping_t_handler(vl_api_nat_set_mss_clamping_t *mp)
static nat44_lb_addr_port_t * unformat_nat44_lb_addr_port(vl_api_nat44_lb_addr_port_t *addr_port_pairs, u32 addr_port_pair_num)
vl_api_interface_index_t sw_if_index
fib_table_t * fib_table_get(fib_node_index_t index, fib_protocol_t proto)
Get a pointer to a FIB table.
vl_api_ip4_address_t ip_address
Enable/disable NAT IPFIX logging.
vl_api_ip4_address_t end_addr
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 interface.
void nat_ha_get_failover(ip4_address_t *addr, u16 *port, u32 *session_refresh_interval)
Get HA failover/remote settings.
static void * vl_api_nat64_add_del_interface_t_print(vl_api_nat64_add_del_interface_t *mp, void *handle)
vl_api_ip4_address_t ip_address
vl_api_interface_index_t sw_if_index
snat_get_worker_in2out_function_t * worker_in2out_cb
snat_static_map_resolve_t * to_resolve
static void increment_v4_address(ip4_address_t *a)
vl_api_ip4_address_t external_ip_address
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.
vl_api_ip4_address_t inside_ip_address
vl_api_ip6_prefix_t prefix
#define vec_foreach(var, vec)
Vector iterator.
static void setup_message_id_table(snat_main_t *sm, api_main_t *am)
vl_api_ip4_address_t address
static void nat_ed_users_destroy(snat_main_per_thread_data_t *tsm)
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)
int nat44_add_del_lb_static_mapping(ip4_address_t e_addr, u16 e_port, nat_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)
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.
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, nat_protocol_t proto, int is_add, twice_nat_type_t twice_nat, u8 out2in_only, u8 *tag, u8 identity_nat, ip4_address_t pool_addr, int exact)
Add/delete NAT44 static mapping.
u32 max_translations_per_thread
#define is_twice_nat_session(s)
Check if NAT session is twice NAT.
vl_api_nat_config_flags_t flags
vl_api_ip4_address_t local_ip_address
static void * vl_api_nat44_interface_add_del_feature_t_print(vl_api_nat44_interface_add_del_feature_t *mp, void *handle)
Resync HA (resend existing sessions to new failover)
static void * vl_api_nat64_prefix_dump_t_print(vl_api_nat64_prefix_dump_t *mp, void *handle)
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.
vl_api_nat_log_level_t log_level
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.
vl_api_interface_index_t sw_if_index
snat_session_t * sessions
vl_api_interface_index_t sw_if_index
static void vl_api_nat44_static_mapping_dump_t_handler(vl_api_nat44_static_mapping_dump_t *mp)
vl_api_nat44_lb_addr_port_t local
Get HA listener/local configuration.
vl_api_interface_index_t sw_if_index
snat_interface_t * interfaces
vl_api_nat_config_flags_t flags
vl_api_ip4_address_t ip_address
#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.
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
static uword pool_elts(void *v)
Number of active elements in a pool.