31 #include <nat/nat44.api_enum.h> 32 #include <nat/nat44.api_types.h> 40 #define REPLY_MSG_ID_BASE sm->msg_id_base 53 rmp->
vpe_pid = ntohl (getpid ());
157 vl_api_nat_set_workers_reply_t *rmp;
166 rv = VNET_API_ERROR_FEATURE_DISABLED;
219 vl_api_nat44_session_cleanup_reply_t *rmp;
229 vl_api_nat44_set_session_limit_reply_t *rmp;
235 REPLY_MACRO (VL_API_NAT44_SET_SESSION_LIMIT_REPLY);
242 vl_api_nat_set_log_level_reply_t *rmp;
246 rv = VNET_API_ERROR_UNSUPPORTED;
259 vl_api_nat44_plugin_enable_disable_reply_t *rmp;
283 REPLY_MACRO (VL_API_NAT44_PLUGIN_ENABLE_DISABLE_REPLY);
291 vl_api_nat_ipfix_enable_disable_reply_t *rmp;
297 clib_host_to_net_u16 (mp->
src_port));
299 REPLY_MACRO (VL_API_NAT_IPFIX_ENABLE_DISABLE_REPLY);
306 vl_api_nat_set_timeouts_reply_t *rmp;
340 vl_api_nat_set_addr_and_port_alloc_alg_reply_t *rmp;
342 u16 port_start, port_end;
346 rv = VNET_API_ERROR_UNSUPPORTED;
352 case NAT_ADDR_AND_PORT_ALLOC_ALG_DEFAULT:
355 case NAT_ADDR_AND_PORT_ALLOC_ALG_MAPE:
359 case NAT_ADDR_AND_PORT_ALLOC_ALG_RANGE:
362 if (port_end <= port_start)
364 rv = VNET_API_ERROR_INVALID_VALUE;
370 rv = VNET_API_ERROR_INVALID_VALUE;
375 REPLY_MACRO (VL_API_NAT_SET_ADDR_AND_PORT_ALLOC_ALG_REPLY);
387 REPLY_MACRO2 (VL_API_NAT_GET_ADDR_AND_PORT_ALLOC_ALG_REPLY,
403 vl_api_nat_set_mss_clamping_reply_t *rmp;
434 vl_api_nat_ha_set_listener_reply_t *rmp;
438 memcpy (&addr, &mp->
ip_address, sizeof (addr));
441 clib_net_to_host_u32 (mp->
path_mtu));
462 rmp->
port = clib_host_to_net_u16 (port);
463 rmp->
path_mtu = clib_host_to_net_u32 (path_mtu);
472 vl_api_nat_ha_set_failover_reply_t *rmp;
476 memcpy (&addr, &mp->
ip_address, sizeof (addr));
492 u32 session_refresh_interval;
500 rmp->
port = clib_host_to_net_u16 (port);
510 vl_api_nat_ha_flush_reply_t *rmp;
544 vl_api_nat_ha_resync_reply_t *rmp;
559 vl_api_nat44_del_user_reply_t *rmp;
572 vl_api_nat44_add_del_address_range_reply_t *rmp;
574 u8 is_add, twice_nat;
575 u32 start_host_order, end_host_order;
583 rv = VNET_API_ERROR_FEATURE_DISABLED;
588 twice_nat = mp->
flags & NAT_API_IS_TWICE_NAT;
591 start_host_order = clib_host_to_net_u32 (tmp[0]);
593 end_host_order = clib_host_to_net_u32 (tmp[0]);
595 count = (end_host_order - start_host_order) + 1;
597 vrf_id = clib_host_to_net_u32 (mp->
vrf_id);
606 for (i = 0; i <
count; i++)
623 REPLY_MACRO (VL_API_NAT44_ADD_DEL_ADDRESS_RANGE_REPLY);
646 rmp->
flags |= NAT_API_IS_TWICE_NAT;
676 vl_api_nat44_interface_add_del_feature_reply_t *rmp;
691 REPLY_MACRO (VL_API_NAT44_INTERFACE_ADD_DEL_FEATURE_REPLY);
707 rmp->
flags |= NAT_API_IS_INSIDE;
709 rmp->
flags |= NAT_API_IS_OUTSIDE;
740 vl_api_nat44_interface_add_del_output_feature_reply_t *rmp;
747 mp->
flags & NAT_API_IS_INSIDE,
751 REPLY_MACRO (VL_API_NAT44_INTERFACE_ADD_DEL_OUTPUT_FEATURE_REPLY);
770 rmp->
flags |= NAT_API_IS_INSIDE;
800 vl_api_nat44_add_del_static_mapping_reply_t *rmp;
802 u16 local_port = 0, external_port = 0;
812 if (!(mp->
flags & NAT_API_IS_ADDR_ONLY))
818 vrf_id = clib_net_to_host_u32 (mp->
vrf_id);
822 if (mp->
flags & NAT_API_IS_TWICE_NAT)
824 else if (mp->
flags & NAT_API_IS_SELF_TWICE_NAT)
826 mp->
tag[
sizeof (mp->
tag) - 1] = 0;
831 external_port, vrf_id,
832 mp->
flags & NAT_API_IS_ADDR_ONLY,
833 external_sw_if_index, proto,
835 mp->
flags & NAT_API_IS_OUT2IN_ONLY, tag, 0,
839 REPLY_MACRO (VL_API_NAT44_ADD_DEL_STATIC_MAPPING_REPLY);
847 vl_api_nat44_add_del_static_mapping_v2_reply_t *rmp;
849 u16 local_port = 0, external_port = 0;
860 if (!(mp->
flags & NAT_API_IS_ADDR_ONLY))
866 vrf_id = clib_net_to_host_u32 (mp->
vrf_id);
870 if (mp->
flags & NAT_API_IS_TWICE_NAT)
872 else if (mp->
flags & NAT_API_IS_SELF_TWICE_NAT)
874 mp->
tag[
sizeof (mp->
tag) - 1] = 0;
879 external_port, vrf_id,
880 mp->
flags & NAT_API_IS_ADDR_ONLY,
881 external_sw_if_index, proto,
883 mp->
flags & NAT_API_IS_OUT2IN_ONLY, tag, 0,
887 REPLY_MACRO (VL_API_NAT44_ADD_DEL_STATIC_MAPPING_V2_REPLY);
910 rmp->
flags |= NAT_API_IS_TWICE_NAT;
912 rmp->
flags |= NAT_API_IS_SELF_TWICE_NAT;
915 rmp->
flags |= NAT_API_IS_OUT2IN_ONLY;
919 rmp->
flags |= NAT_API_IS_ADDR_ONLY;
952 rmp->
flags |= NAT_API_IS_TWICE_NAT;
956 rmp->
flags |= NAT_API_IS_ADDR_ONLY;
1005 vl_api_nat44_add_del_identity_mapping_reply_t *rmp;
1013 if (!(mp->
flags & NAT_API_IS_ADDR_ONLY))
1018 vrf_id = clib_net_to_host_u32 (mp->
vrf_id);
1019 sw_if_index = clib_net_to_host_u32 (mp->
sw_if_index);
1020 if (sw_if_index != ~0)
1024 mp->
tag[
sizeof (mp->
tag) - 1] = 0;
1030 mp->
flags & NAT_API_IS_ADDR_ONLY, sw_if_index,
1031 proto, mp->
is_add, 0, 0, tag, 1, pool_addr, 0);
1034 REPLY_MACRO (VL_API_NAT44_ADD_DEL_IDENTITY_MAPPING_REPLY);
1051 rmp->
flags |= NAT_API_IS_ADDR_ONLY;
1079 rmp->
flags = (vl_api_nat_config_flags_t) NAT_API_IS_ADDR_ONLY;
1132 vl_api_nat44_add_del_interface_addr_reply_t *rmp;
1142 mp->
flags & NAT_API_IS_TWICE_NAT);
1145 REPLY_MACRO (VL_API_NAT44_ADD_DEL_INTERFACE_ADDR_REPLY);
1163 rmp->
flags = (vl_api_nat_config_flags_t) NAT_API_IS_TWICE_NAT;
1220 k.
addr = s->in2out.addr;
1225 if (clib_bihash_search_8_8 (&tsm->
user_hash, &key, &value))
1233 clib_bihash_add_del_8_8 (&tsm->
user_hash, &key, 1);
1316 rmp->
flags |= NAT_API_IS_STATIC;
1319 rmp->
flags |= NAT_API_IS_TWICE_NAT;
1322 rmp->
flags |= NAT_API_IS_EXT_HOST_VALID;
1324 rmp->
last_heard = clib_host_to_net_u64 ((
u64) s->last_heard);
1325 rmp->
total_bytes = clib_host_to_net_u64 (s->total_bytes);
1365 u32 session_index, head_index, elt_index;
1385 if (clib_bihash_search_8_8 (&tsm->user_hash, &key, &value))
1393 elt_index = head->
next;
1395 session_index = elt->
value;
1396 while (session_index != ~0)
1402 elt_index = elt->
next;
1404 session_index = elt->
value;
1411 if (s->in2out.addr.as_u32 == ukey.
addr.
as_u32)
1422 u32 addr_port_pair_num)
1426 vl_api_nat44_lb_addr_port_t *ap;
1428 for (i = 0; i < addr_port_pair_num; i++)
1430 ap = &addr_port_pairs[
i];
1431 clib_memset (&lb_addr_port, 0,
sizeof (lb_addr_port));
1433 lb_addr_port.port = ap->port;
1434 lb_addr_port.probability = ap->probability;
1435 lb_addr_port.vrf_id = clib_net_to_host_u32 (ap->vrf_id);
1436 vec_add1 (lb_addr_port_pairs, lb_addr_port);
1439 return lb_addr_port_pairs;
1447 vl_api_nat44_add_del_lb_static_mapping_reply_t *rmp;
1457 rv = VNET_API_ERROR_UNSUPPORTED;
1467 if (mp->
flags & NAT_API_IS_TWICE_NAT)
1469 else if (mp->
flags & NAT_API_IS_SELF_TWICE_NAT)
1471 mp->
tag[
sizeof (mp->
tag) - 1] = 0;
1478 proto, locals, mp->
is_add,
1480 mp->
flags & NAT_API_IS_OUT2IN_ONLY, tag,
1481 clib_net_to_host_u32 (mp->
affinity));
1487 REPLY_MACRO (VL_API_NAT44_ADD_DEL_LB_STATIC_MAPPING_REPLY);
1495 vl_api_nat44_lb_static_mapping_add_del_local_reply_t *rmp;
1502 rv = VNET_API_ERROR_UNSUPPORTED;
1516 clib_net_to_host_u32 (mp->
1521 REPLY_MACRO (VL_API_NAT44_LB_STATIC_MAPPING_ADD_DEL_LOCAL_REPLY);
1532 vl_api_nat44_lb_addr_port_t *locals;
1549 rmp->
flags |= NAT_API_IS_TWICE_NAT;
1551 rmp->
flags |= NAT_API_IS_SELF_TWICE_NAT;
1553 rmp->
flags |= NAT_API_IS_OUT2IN_ONLY;
1557 locals = (vl_api_nat44_lb_addr_port_t *) rmp->
locals;
1562 locals->port = ap->
port;
1564 locals->vrf_id = ntohl (ap->
vrf_id);
1602 vl_api_nat44_del_session_reply_t *rmp;
1612 vrf_id = clib_net_to_host_u32 (mp->
vrf_id);
1617 is_in = mp->
flags & NAT_API_IS_INSIDE;
1619 if (mp->
flags & NAT_API_IS_EXT_HOST_VALID)
1634 vl_api_nat44_forwarding_enable_disable_reply_t *rmp;
1636 u32 *ses_to_be_removed = 0, *ses_index;
1674 REPLY_MACRO (VL_API_NAT44_FORWARDING_ENABLE_DISABLE_REPLY);
1702 #include <nat/nat44.api.c> ip4_address_t external_addr
static void vl_api_nat44_add_del_static_mapping_t_handler(vl_api_nat44_add_del_static_mapping_t *mp)
vl_api_ip4_address_t ext_host_address
vl_api_interface_index_t external_sw_if_index
#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
static void vl_api_nat_set_mss_clamping_t_handler(vl_api_nat_set_mss_clamping_t *mp)
static void vl_api_nat_set_log_level_t_handler(vl_api_nat_set_log_level_t *mp)
static void vl_api_nat44_interface_output_feature_dump_t_handler(vl_api_nat44_interface_output_feature_dump_t *mp)
NAT44 load-balancing static mapping rule details response.
static void vl_api_nat44_add_del_static_mapping_v2_t_handler(vl_api_nat44_add_del_static_mapping_v2_t *mp)
static void vl_api_nat44_lb_static_mapping_add_del_local_t_handler(vl_api_nat44_lb_static_mapping_add_del_local_t *mp)
#define pool_foreach_index(i, v)
Run nat44 garbage collection.
int snat_del_address(snat_main_t *sm, ip4_address_t addr, u8 delete_sm, u8 twice_nat)
Delete external address from NAT44 pool.
Enable/disable NAT44 plugin.
static void vl_api_nat_show_config_t_handler(vl_api_nat_show_config_t *mp)
u32 max_translations_per_user
vl_api_interface_index_t sw_if_index
Get address and port assignment algorithm reply.
struct nat_timeouts_t::@86 tcp
static void vl_api_nat_ha_resync_t_handler(vl_api_nat_ha_resync_t *mp)
vl_api_ip4_address_t external_addr
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.
vl_api_nat44_config_flags_t flags
vl_api_interface_index_t sw_if_index
vl_api_ip4_address_t external_addr
NAT44 interface with output feature details response.
#define pool_foreach(VAR, POOL)
Iterate through pool.
static void vl_api_nat_ha_flush_t_handler(vl_api_nat_ha_flush_t *mp)
clib_error_t * nat44_api_hookup(vlib_main_t *vm)
Dump NAT44 pool addresses interfaces.
#define is_ed_session(s)
Check if NAT session is endpoint dependent.
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)
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_send_msg(vl_api_registration_t *rp, u8 *elem)
bool ipfix_logging_enabled
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)
Control ping from client to api server request.
Set values of timeouts for NAT sessions (seconds)
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)
#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_nat_get_timeouts_t_handler(vl_api_nat_get_timeouts_t *mp)
Add/delete NAT44 load-balancing static mapping rule backend.
NAT44 interface details response.
u32 session_refresh_interval
u8 * format_user_kvp(u8 *s, va_list *args)
NAT44 static mapping details response.
vl_api_nat_config_flags_t flags
vl_api_ip4_address_t first_ip_address
bool static_mapping_connection_tracking
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 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)
#define REPLY_MACRO2_ZERO(t, body)
static void vl_api_nat44_add_del_lb_static_mapping_t_handler(vl_api_nat44_add_del_lb_static_mapping_t *mp)
int nat_ipfix_logging_enable_disable(int enable, u32 domain_id, u16 src_port)
Enable/disable NAT plugin IPFIX logging.
Get HA failover/remote settings reply.
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
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
static void vl_api_nat_ha_get_listener_t_handler(vl_api_nat_ha_get_listener_t *mp)
Set HA failover (remote settings)
vl_api_nat_config_flags_t flags
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
clib_bihash_8_8_t user_hash
static void vl_api_nat44_interface_dump_t_handler(vl_api_nat44_interface_dump_t *mp)
#define clib_memcpy(d, s, n)
int nat44_plugin_enable(nat44_config_t c)
Enable NAT44 plugin.
#define nat_interface_is_outside(i)
Check if NAT interface is outside.
u32 max_translations_per_user
u32 session_refresh_interval
static void vl_api_nat44_del_user_t_handler(vl_api_nat44_del_user_t *mp)
vl_api_nat_config_flags_t flags
static void send_nat44_identity_map_resolve_details(snat_static_map_resolve_t *m, vl_api_registration_t *reg, u32 context)
Check if forwarding is enabled or disabled.
static void vl_api_nat_ipfix_enable_disable_t_handler(vl_api_nat_ipfix_enable_disable_t *mp)
static nat_protocol_t ip_proto_to_nat_proto(u8 ip_proto)
Common NAT inline functions.
static void vl_api_nat_set_workers_t_handler(vl_api_nat_set_workers_t *mp)
vl_api_nat_config_flags_t flags
static void vl_api_nat44_interface_add_del_feature_t_handler(vl_api_nat44_interface_add_del_feature_t *mp)
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.
description fragment has unexpected format
static void nat_ha_resync_completed_event_cb(u32 client_index, u32 pid, u32 missed_count)
#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.
static void vl_api_nat44_identity_mapping_dump_t_handler(vl_api_nat44_identity_mapping_dump_t *mp)
static void vl_api_nat44_add_del_interface_addr_t_handler(vl_api_nat44_add_del_interface_addr_t *mp)
static void send_nat44_static_mapping_details(snat_static_mapping_t *m, 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.
vl_api_ip4_address_t ip_address
vl_api_nat_config_flags_t flags
static void vl_api_nat44_user_session_dump_t_handler(vl_api_nat44_user_session_dump_t *mp)
Flush the current HA data (for testing)
vl_api_ip4_address_t external_ip_address
vl_api_nat_config_flags_t flags
static void nat_ed_users_destroy(snat_main_per_thread_data_t *tsm)
static void nat44_delete_session(snat_main_t *sm, snat_session_t *ses, u32 thread_index)
static void vl_api_nat_ha_get_failover_t_handler(vl_api_nat_ha_get_failover_t *mp)
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
vlib_worker_thread_t * vlib_worker_threads
Get TCP MSS rewriting configuration.
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 void send_nat44_identity_mapping_details(snat_static_mapping_t *m, int index, vl_api_registration_t *reg, u32 context)
nat_addr_and_port_alloc_alg_t addr_and_port_alloc_alg
int nat44_plugin_disable()
Disable NAT44 plugin.
static void vl_api_nat_set_timeouts_t_handler(vl_api_nat_set_timeouts_t *mp)
vl_api_nat_config_flags_t flags
vl_api_nat_config_flags_t flags
vl_api_nat_config_flags_t flags
Enable/disable forwarding for NAT44 Forward packets which don't match existing translation or static ...
Tell client about a HA resync completion event.
snat_static_mapping_t * static_mappings
int nat_ipfix_logging_enabled()
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 send_nat44_static_map_resolve_details(snat_static_map_resolve_t *m, vl_api_registration_t *reg, u32 context)
void nat_ha_flush(u8 is_resync)
Flush the current HA data (for testing)
Show NAT44 plugin running config.
#define nat_interface_is_inside(i)
Check if NAT interface is inside.
Dump NAT44 identity mappings.
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.
Add/delete NAT44 pool address from specific interfce.
vl_api_ip4_address_t ip_address
static void vl_api_nat44_user_dump_t_handler(vl_api_nat44_user_dump_t *mp)
Get address and port assignment algorithm.
static void vl_api_nat44_interface_add_del_output_feature_t_handler(vl_api_nat44_interface_add_del_output_feature_t *mp)
vl_api_ip4_address_t pool_ip_address
Add/delete NAT44 static mapping.
snat_interface_t * output_feature_interfaces
vl_api_ip4_address_t last_ip_address
An API client registration, only in vpp/vlib.
vl_api_ip4_address_t ip_address
static void setup_message_id_table(api_main_t *am)
#define BAD_SW_IF_INDEX_LABEL
static void vl_api_nat_control_ping_t_handler(vl_api_nat_control_ping_t *mp)
static void vl_api_nat_worker_dump_t_handler(vl_api_nat_worker_dump_t *mp)
Get HA failover/remote settings.
Dump interfaces with NAT44 feature.
static void vl_api_nat_ha_set_failover_t_handler(vl_api_nat_ha_set_failover_t *mp)
Show NAT plugin startup config reply.
u32 ft_table_id
Table ID (hash key) for this FIB.
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
void nat44_add_del_address_dpo(ip4_address_t addr, u8 is_add)
Add/delete external address to FIB DPO (out2in DPO mode)
sll srl srl sll sra u16x4 i
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.
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_nat_config_flags_t flags
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_nat44_address_dump_t_handler(vl_api_nat44_address_dump_t *mp)
static void send_nat_worker_details(u32 worker_index, vl_api_registration_t *reg, u32 context)
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
8 octet key, 8 octet key value pair
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
static void increment_v4_address(ip4_address_t *a)
vl_api_ip4_address_t ext_host_address
int nat_ha_set_listener(ip4_address_t *addr, u16 port, u32 path_mtu)
Set HA listener (local settings)
u32 * auto_add_sw_if_indices
static void send_nat44_user_session_details(snat_session_t *s, vl_api_registration_t *reg, u32 context)
Get HA listener/local configuration reply.
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)
#define is_identity_static_mapping(sm)
Check if NAT static mapping is identity NAT.
static void send_nat44_interface_details(snat_interface_t *i, vl_api_registration_t *reg, u32 context)
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 send_nat44_interface_output_feature_details(snat_interface_t *i, vl_api_registration_t *reg, u32 context)
Set address and port assignment algorithm.
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.
#define clib_bitmap_free(v)
Free a bitmap.
static void vl_api_nat44_session_cleanup_t_handler(vl_api_nat44_session_cleanup_t *mp)
snat_address_t * twice_nat_addresses
Set TCP MSS rewriting configuration.
vl_api_nat_config_flags_t flags
static void vl_api_nat44_forwarding_is_enabled_t_handler(vl_api_nat44_forwarding_is_enabled_t *mp)
#define is_lb_static_mapping(sm)
Check if NAT static mapping is load-balancing.
bool static_mapping_connection_tracking
static void vl_api_nat44_forwarding_enable_disable_t_handler(vl_api_nat44_forwarding_enable_disable_t *mp)
vl_api_ip4_address_t local_ip_address
vl_api_interface_index_t sw_if_index
static void vl_api_nat44_plugin_enable_disable_t_handler(vl_api_nat44_plugin_enable_disable_t *mp)
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)
Add/delete NAT44 static mapping.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static void vl_api_nat44_static_mapping_dump_t_handler(vl_api_nat44_static_mapping_dump_t *mp)
#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 nat_ed_users_create(snat_main_per_thread_data_t *tsm)
NAT44 pool addresses interfaces details response.
snat_main_per_thread_data_t * per_thread_data
static void vl_api_nat_set_addr_and_port_alloc_alg_t_handler(vl_api_nat_set_addr_and_port_alloc_alg_t *mp)
static void vl_api_nat44_add_del_identity_mapping_t_handler(vl_api_nat44_add_del_identity_mapping_t *mp)
vl_api_ip4_address_t ip_address
static void send_nat44_lb_static_mapping_details(snat_static_mapping_t *m, vl_api_registration_t *reg, u32 context)
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
static void vl_api_nat44_show_running_config_t_handler(vl_api_nat44_show_running_config_t *mp)
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 interface.
void nat_ha_get_failover(ip4_address_t *addr, u16 *port, u32 *session_refresh_interval)
Get HA failover/remote settings.
vl_api_ip4_address_t ip_address
vl_api_interface_index_t sw_if_index
static void send_nat44_interface_addr_details(u32 sw_if_index, vl_api_registration_t *reg, u32 context, u8 twice_nat)
snat_get_worker_in2out_function_t * worker_in2out_cb
snat_static_map_resolve_t * to_resolve
vl_api_ip4_address_t external_ip_address
ip4_main_t ip4_main
Global ip4 main structure.
static void send_nat44_user_details(snat_user_t *u, vl_api_registration_t *reg, u32 context)
struct fib_table_t_ * fibs
Vector of FIBs.
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)
vl_api_ip4_address_t inside_ip_address
#define vec_foreach(var, vec)
Vector iterator.
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)
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_nat_ha_set_listener_t_handler(vl_api_nat_ha_set_listener_t *mp)
static void vl_api_nat44_interface_addr_dump_t_handler(vl_api_nat44_interface_addr_dump_t *mp)
int nat44_ei_user_del(ip4_address_t *addr, u32 fib_index)
Delete specific NAT44 EI user and his sessions.
Resync HA (resend existing sessions to new failover)
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.
static void send_nat44_address_details(snat_address_t *a, vl_api_registration_t *reg, u32 context, u8 twice_nat)
vl_api_nat_timeouts_t timeouts
vl_api_nat_log_level_t log_level
Enable/disable NAT44 feature on the interface.
vl_api_interface_index_t sw_if_index
static void vl_api_nat44_set_session_limit_t_handler(vl_api_nat44_set_session_limit_t *mp)
static void nat_ed_user_create_helper(snat_main_per_thread_data_t *tsm, snat_session_t *s)
static void vl_api_nat44_lb_static_mapping_dump_t_handler(vl_api_nat44_lb_static_mapping_dump_t *mp)
snat_session_t * sessions
vl_api_interface_index_t sw_if_index
Show NAT44 plugin running config reply.
vl_api_nat44_lb_addr_port_t local
static void vl_api_nat_get_mss_clamping_t_handler(vl_api_nat_get_mss_clamping_t *mp)
Get HA listener/local configuration.
vl_api_interface_index_t sw_if_index
snat_interface_t * interfaces
static void vl_api_nat44_del_session_t_handler(vl_api_nat44_del_session_t *mp)
vl_api_ip4_address_t ip_address
#define VALIDATE_SW_IF_INDEX(mp)
A protocol Independent FIB table.
static void vl_api_nat_show_config_2_t_handler(vl_api_nat_show_config_2_t *mp)
Show NAT plugin startup config.
Show NAT plugin startup config.
vl_api_nat44_config_flags_t flags
NAT44 address details response.
static uword pool_elts(void *v)
Number of active elements in a pool.