|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
25 #include <nat/nat44-ei/nat44_ei.api_enum.h>
26 #include <nat/nat44-ei/nat44_ei.api_types.h>
31 #define REPLY_MSG_ID_BASE nm->msg_id_base
44 VL_API_NAT44_EI_SHOW_RUNNING_CONFIG_REPLY, ({
76 vl_api_nat44_ei_set_workers_reply_t *rmp;
85 rv = VNET_API_ERROR_FEATURE_DISABLED;
138 vl_api_nat44_ei_set_log_level_reply_t *rmp;
142 rv = VNET_API_ERROR_UNSUPPORTED;
155 vl_api_nat44_ei_plugin_enable_disable_reply_t *rmp;
167 c.users = ntohl (mp->
users);
178 REPLY_MACRO (VL_API_NAT44_EI_PLUGIN_ENABLE_DISABLE_REPLY);
186 vl_api_nat44_ei_ipfix_enable_disable_reply_t *rmp;
191 clib_host_to_net_u16 (mp->
src_port));
193 REPLY_MACRO (VL_API_NAT44_EI_IPFIX_ENABLE_DISABLE_REPLY);
200 vl_api_nat44_ei_set_timeouts_reply_t *rmp;
216 vl_api_nat44_ei_set_addr_and_port_alloc_alg_reply_t *rmp;
218 u16 port_start, port_end;
222 case NAT44_EI_ADDR_AND_PORT_ALLOC_ALG_DEFAULT:
225 case NAT44_EI_ADDR_AND_PORT_ALLOC_ALG_MAPE:
229 case NAT44_EI_ADDR_AND_PORT_ALLOC_ALG_RANGE:
232 if (port_end <= port_start)
234 rv = VNET_API_ERROR_INVALID_VALUE;
240 rv = VNET_API_ERROR_INVALID_VALUE;
245 REPLY_MACRO (VL_API_NAT44_EI_SET_ADDR_AND_PORT_ALLOC_ALG_REPLY);
256 REPLY_MACRO2 (VL_API_NAT44_EI_GET_ADDR_AND_PORT_ALLOC_ALG_REPLY, ({
271 vl_api_nat44_ei_set_mss_clamping_reply_t *rmp;
279 REPLY_MACRO (VL_API_NAT44_EI_SET_MSS_CLAMPING_REPLY);
290 REPLY_MACRO2 (VL_API_NAT44_EI_GET_MSS_CLAMPING_REPLY, ({
301 vl_api_nat44_ei_ha_set_listener_reply_t *rmp;
307 clib_net_to_host_u16 (mp->
port),
308 clib_net_to_host_u32 (mp->
path_mtu));
310 REPLY_MACRO (VL_API_NAT44_EI_HA_SET_LISTENER_REPLY);
328 rmp->
port = clib_host_to_net_u16 (
port);
338 vl_api_nat44_ei_ha_set_failover_reply_t *rmp;
347 REPLY_MACRO (VL_API_NAT44_EI_HA_SET_FAILOVER_REPLY);
359 u32 session_refresh_interval;
365 rmp->
port = clib_host_to_net_u16 (
port);
367 clib_host_to_net_u32 (session_refresh_interval);
375 vl_api_nat44_ei_ha_flush_reply_t *rmp;
409 vl_api_nat44_ei_ha_resync_reply_t *rmp;
423 vl_api_nat44_ei_del_user_reply_t *rmp;
436 vl_api_nat44_ei_add_del_address_range_reply_t *rmp;
439 u32 start_host_order, end_host_order;
447 rv = VNET_API_ERROR_FEATURE_DISABLED;
454 start_host_order = clib_host_to_net_u32 (
tmp[0]);
456 end_host_order = clib_host_to_net_u32 (
tmp[0]);
458 count = (end_host_order - start_host_order) + 1;
486 REPLY_MACRO (VL_API_NAT44_EI_ADD_DEL_ADDRESS_RANGE_REPLY);
500 if (
a->fib_index != ~0)
534 vl_api_nat44_ei_interface_add_del_feature_reply_t *rmp;
548 REPLY_MACRO (VL_API_NAT44_EI_INTERFACE_ADD_DEL_FEATURE_REPLY);
596 vl_api_nat44_ei_interface_add_del_output_feature_reply_t *rmp;
606 REPLY_MACRO (VL_API_NAT44_EI_INTERFACE_ADD_DEL_OUTPUT_FEATURE_REPLY);
653 vl_api_nat44_ei_add_del_static_mapping_reply_t *rmp;
655 u16 local_port = 0, external_port = 0;
674 mp->
tag[
sizeof (mp->
tag) - 1] = 0;
679 local_addr, external_addr, local_port, external_port,
proto,
685 REPLY_MACRO (VL_API_NAT44_EI_ADD_DEL_STATIC_MAPPING_REPLY);
790 vl_api_nat44_ei_add_del_identity_mapping_reply_t *rmp;
809 mp->
tag[
sizeof (mp->
tag) - 1] = 0;
819 REPLY_MACRO (VL_API_NAT44_EI_ADD_DEL_IDENTITY_MAPPING_REPLY);
915 vl_api_nat44_ei_add_del_interface_addr_reply_t *rmp;
927 REPLY_MACRO (VL_API_NAT44_EI_ADD_DEL_INTERFACE_ADDR_REPLY);
1027 rmp->
last_heard = clib_host_to_net_u64 ((
u64) s->last_heard);
1028 rmp->
total_bytes = clib_host_to_net_u64 (s->total_bytes);
1053 nat44_ei_session_t *s;
1057 u32 session_index, head_index, elt_index;
1079 if (!u->nsessions && !u->nstaticsessions)
1082 head_index = u->sessions_per_user_list_head_index;
1084 elt_index = head->
next;
1086 session_index =
elt->value;
1087 while (session_index != ~0)
1095 session_index =
elt->value;
1103 vl_api_nat44_ei_del_session_reply_t *rmp;
1130 vl_api_nat44_ei_forwarding_enable_disable_reply_t *rmp;
1132 u32 *ses_to_be_removed = 0, *ses_index;
1134 nat44_ei_session_t *s;
1153 REPLY_MACRO (VL_API_NAT44_EI_FORWARDING_ENABLE_DISABLE_REPLY);
1160 vl_api_nat44_ei_set_fq_options_reply_t *rmp;
1164 REPLY_MACRO (VL_API_NAT44_EI_SET_FQ_OPTIONS_REPLY);
1184 #include <nat/nat44-ei/nat44_ei.api.c>
@ NAT44_EI_STATIC_MAPPING_ONLY
Dump interfaces with NAT44 feature.
void nat44_ei_add_del_address_dpo(ip4_address_t addr, u8 is_add)
int nat_ipfix_logging_enabled()
nat44_ei_main_per_thread_data_t * tnm
vl_api_ip4_address_t local_ip_address
@ NAT44_EI_ADDR_ONLY_MAPPING
clib_error_t * nat44_ei_api_hookup(vlib_main_t *vm)
vl_api_ip4_address_t ip_address
vl_api_nat44_ei_config_flags_t flags
vnet_interface_main_t * im
#define VALIDATE_SW_IF_INDEX(mp)
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
vl_api_interface_index_t external_sw_if_index
@ NAT44_EI_STATIC_MAPPING
nat44_ei_config_t rconfig
vl_api_nat44_ei_config_flags_t flags
vl_api_nat44_ei_config_flags_t flags
Add/delete NAT44 pool address from specific interfce.
static void vl_api_nat44_ei_interface_add_del_feature_t_handler(vl_api_nat44_ei_interface_add_del_feature_t *mp)
struct app_rx_mq_elt_ * next
Show NAT44 plugin running config reply.
#define REPLY_MACRO2(t, body)
Get TCP MSS rewriting configuration.
#define clib_memcpy(d, s, n)
struct nat_timeouts_t::@732 tcp
vl_api_nat44_ei_config_flags_t flags
vl_api_ip4_address_t ip_address
NAT44 interface with output feature details response.
static void send_nat44_ei_address_details(nat44_ei_address_t *a, vl_api_registration_t *reg, u32 context)
ip4_main_t ip4_main
Global ip4 main structure.
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
Set TCP MSS rewriting configuration.
nat44_ei_static_mapping_t * static_mappings
void nat44_ei_delete_session(nat44_ei_main_t *nm, nat44_ei_session_t *ses, u32 thread_index)
void nat_ha_get_listener(ip4_address_t *addr, u16 *port, u32 *path_mtu)
Get HA listener/local configuration.
void nat_ha_flush(u8 is_resync)
Flush the current HA data (for testing)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static void vl_api_nat44_ei_get_addr_and_port_alloc_alg_t_handler(vl_api_nat44_ei_get_addr_and_port_alloc_alg_t *mp)
vl_api_nat44_ei_config_flags_t flags
static void vl_api_nat44_ei_ha_get_failover_t_handler(vl_api_nat44_ei_ha_get_failover_t *mp)
static void vl_api_nat44_ei_identity_mapping_dump_t_handler(vl_api_nat44_ei_identity_mapping_dump_t *mp)
nat44_ei_interface_t * interfaces
static nat_protocol_t ip_proto_to_nat_proto(u8 ip_proto)
Common NAT inline functions.
#define REPLY_MACRO2_ZERO(t, body)
Get HA listener/local configuration.
#define nat44_ei_interface_is_outside(ip)
vl_api_nat44_ei_config_flags_t flags
static void vl_api_nat44_ei_forwarding_enable_disable_t_handler(vl_api_nat44_ei_forwarding_enable_disable_t *mp)
static void vl_api_nat44_ei_user_dump_t_handler(vl_api_nat44_ei_user_dump_t *mp)
int nat44_ei_plugin_enable(nat44_ei_config_t c)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static void vl_api_nat44_ei_user_session_dump_t_handler(vl_api_nat44_ei_user_session_dump_t *mp)
vl_api_ip4_address_t external_ip_address
int nat44_ei_set_frame_queue_nelts(u32 frame_queue_nelts)
static void send_nat44_ei_identity_mapping_details(nat44_ei_static_mapping_t *m, int index, vl_api_registration_t *reg, u32 context)
nat44_ei_addr_and_port_alloc_alg_t addr_and_port_alloc_alg
nat44_ei_address_t * addresses
Get address and port assignment algorithm.
Set HA listener (local settings)
Dump interfaces with NAT44 output feature.
vlib_worker_thread_t * vlib_worker_threads
vl_api_interface_index_t sw_if_index
Set address and port assignment algorithm.
static void vl_api_nat44_ei_set_addr_and_port_alloc_alg_t_handler(vl_api_nat44_ei_set_addr_and_port_alloc_alg_t *mp)
vl_api_interface_index_t sw_if_index
Show NAT44 plugin running config.
static void send_nat44_ei_static_map_resolve_details(nat44_ei_static_map_resolve_t *m, vl_api_registration_t *reg, u32 context)
static void send_nat_worker_details(u32 worker_index, vl_api_registration_t *reg, u32 context)
vl_api_nat_log_level_t log_level
nat44_ei_session_t * sessions
vl_api_ip4_address_t inside_ip_address
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
static void vl_api_nat44_ei_del_session_t_handler(vl_api_nat44_ei_del_session_t *mp)
vl_api_interface_index_t sw_if_index
Dump NAT44 pool addresses interfaces.
static void vl_api_nat44_ei_address_dump_t_handler(vl_api_nat44_ei_address_dump_t *mp)
static void setup_message_id_table(api_main_t *am)
Add/delete NAT44 identity mapping.
vl_api_ip4_address_t ip_address
A protocol Independent FIB table.
Flush the current HA data (for testing)
u32 session_refresh_interval
static void vl_api_nat44_ei_ha_resync_t_handler(vl_api_nat44_ei_ha_resync_t *mp)
#define pool_foreach(VAR, POOL)
Iterate through pool.
Add/delete NAT44 static mapping.
#define nat44_ei_is_session_static(sp)
vl_api_ip4_address_t last_ip_address
nat44_ei_static_map_resolve_t * to_resolve
Dump NAT44 static mappings.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
u32 nat44_ei_get_in2out_worker_index(ip4_header_t *ip0, u32 rx_fib_index0, u8 is_output)
vl_api_ip4_address_t ip_address
vl_api_ip4_address_t outside_ip_address
int nat44_ei_add_address(nat44_ei_main_t *nm, ip4_address_t *addr, u32 vrf_id)
nat44_ei_main_t nat44_ei_main
vl_api_ip4_address_t ip_address
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
vl_api_ip4_address_t ip_address
static void vl_api_nat44_ei_show_fq_options_t_handler(vl_api_nat44_ei_show_fq_options_t *mp)
u32 ft_table_id
Table ID (hash key) for this FIB.
static void vl_api_nat44_ei_set_mss_clamping_t_handler(vl_api_nat44_ei_set_mss_clamping_t *mp)
An API client registration, only in vpp/vlib.
int nat44_ei_user_del(ip4_address_t *addr, u32 fib_index)
Delete specific NAT44 EI user and his sessions.
vl_api_ip4_address_t ip_address
static_always_inline u8 nat_proto_to_ip_proto(nat_protocol_t nat_proto)
void nat44_ei_free_session_data(nat44_ei_main_t *nm, nat44_ei_session_t *s, u32 thread_index, u8 is_ha)
vl_api_nat44_ei_config_flags_t flags
#define clib_bitmap_free(v)
Free a bitmap.
NAT44 interface details response.
Dump NAT44 identity mappings.
vl_api_nat44_ei_config_flags_t flags
vl_api_nat44_ei_config_flags_t flags
static void vl_api_nat44_ei_plugin_enable_disable_t_handler(vl_api_nat44_ei_plugin_enable_disable_t *mp)
@ NAT44_EI_CONNECTION_TRACKING
int nat44_ei_add_del_static_mapping(ip4_address_t l_addr, ip4_address_t e_addr, u16 l_port, u16 e_port, nat_protocol_t proto, u32 sw_if_index, u32 vrf_id, u8 addr_only, u8 identity_nat, u8 *tag, u8 is_add)
Add/delete NAT44-EI static mapping.
int nat44_ei_add_interface_address(nat44_ei_main_t *nm, u32 sw_if_index, int is_del)
Get HA failover/remote settings reply.
Tell client about a HA resync completion event.
sll srl srl sll sra u16x4 i
static void vl_api_nat44_ei_set_log_level_t_handler(vl_api_nat44_ei_set_log_level_t *mp)
nat44_ei_main_per_thread_data_t * per_thread_data
Set HA failover (remote settings)
bool ipfix_logging_enabled
vl_api_ip4_address_t ext_host_address
static void send_nat44_ei_static_mapping_details(nat44_ei_static_mapping_t *m, vl_api_registration_t *reg, u32 context)
NAT44 static mapping details response.
void nat44_ei_set_alloc_mape(u16 psid, u16 psid_offset, u16 psid_length)
Set address and port assignment algorithm for MAP-E CE.
void nat44_ei_set_alloc_range(u16 start_port, u16 end_port)
Set address and port assignment algorithm for port range.
int nat44_ei_del_session(nat44_ei_main_t *nm, ip4_address_t *addr, u16 port, nat_protocol_t proto, u32 vrf_id, int is_in)
Delete NAT44-EI session.
ip4_address_t external_addr
vl_api_ip4_address_t external_ip_address
static void vl_api_nat44_ei_set_workers_t_handler(vl_api_nat44_ei_set_workers_t *mp)
static void vl_api_nat44_ei_set_fq_options_t_handler(vl_api_nat44_ei_set_fq_options_t *mp)
vl_api_interface_index_t sw_if_index
#define nat44_ei_interface_is_inside(ip)
NAT44 pool addresses interfaces details response.
Get address and port assignment algorithm reply.
Get TCP MSS rewriting configuration reply.
Show NAT handoff frame queue options.
nat44_ei_interface_t * output_feature_interfaces
static void increment_v4_address(ip4_address_t *a)
#define BAD_SW_IF_INDEX_LABEL
vl_api_nat_timeouts_t timeouts
Get HA listener/local configuration reply.
Enable/disable NAT IPFIX logging.
vl_api_interface_index_t sw_if_index
static void vl_api_nat44_ei_add_del_interface_addr_t_handler(vl_api_nat44_ei_add_del_interface_addr_t *mp)
static void send_nat44_ei_user_session_details(nat44_ei_session_t *s, vl_api_registration_t *reg, u32 context)
#define vec_free(V)
Free vector's memory (no header).
Enable/disable NAT44 feature on the interface.
vl_api_interface_index_t external_sw_if_index
clib_bihash_8_8_t user_hash
static void vl_api_nat44_ei_ha_set_listener_t_handler(vl_api_nat44_ei_ha_set_listener_t *mp)
int nat_ipfix_logging_enable_disable(int enable, u32 domain_id, u16 src_port)
Enable/disable NAT plugin IPFIX logging.
#define pool_foreach_index(i, v)
int nat44_ei_plugin_disable()
static void vl_api_nat44_ei_add_del_identity_mapping_t_handler(vl_api_nat44_ei_add_del_identity_mapping_t *mp)
vl_api_interface_index_t sw_if_index
description fragment has unexpected format
int nat44_ei_interface_add_del(u32 sw_if_index, u8 is_inside, int is_del)
fib_table_t * fib_table_get(fib_node_index_t index, fib_protocol_t proto)
Get a pointer to a FIB table.
NAT44 user's sessions response.
Set NAT handoff frame queue options.
Enable/disable forwarding for NAT44 Forward packets which don't match existing translation or static ...
vl_api_interface_index_t sw_if_index
static void vl_api_nat44_ei_worker_dump_t_handler(vl_api_nat44_ei_worker_dump_t *mp)
static void vl_api_nat44_ei_set_timeouts_t_handler(vl_api_nat44_ei_set_timeouts_t *mp)
#define vec_foreach(var, vec)
Vector iterator.
int nat44_ei_interface_add_del_output_feature(u32 sw_if_index, u8 is_inside, int is_del)
8 octet key, 8 octet key value pair
static void vl_api_nat44_ei_ipfix_enable_disable_t_handler(vl_api_nat44_ei_ipfix_enable_disable_t *mp)
int nat44_ei_set_workers(uword *bitmap)
vl_api_nat44_ei_config_flags_t flags
static void send_nat44_ei_interface_output_feature_details(nat44_ei_interface_t *i, vl_api_registration_t *reg, u32 context)
u32 session_refresh_interval
static void vl_api_nat44_ei_static_mapping_dump_t_handler(vl_api_nat44_ei_static_mapping_dump_t *mp)
static void nat_ha_resync_completed_event_cb(u32 client_index, u32 pid, u32 missed_count)
static void vl_api_nat44_ei_del_user_t_handler(vl_api_nat44_ei_del_user_t *mp)
static void vl_api_nat44_ei_get_mss_clamping_t_handler(vl_api_nat44_ei_get_mss_clamping_t *mp)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static void vl_api_nat44_ei_show_running_config_t_handler(vl_api_nat44_ei_show_running_config_t *mp)
static vlib_main_t * vlib_get_main(void)
#define nat44_ei_is_identity_static_mapping(mp)
int nat_ha_set_failover(vlib_main_t *vm, ip4_address_t *addr, u16 port, u32 session_refresh_interval)
Set HA failover (remote settings)
static void vl_api_nat44_ei_ha_get_listener_t_handler(vl_api_nat44_ei_ha_get_listener_t *mp)
Enable/disbale NAT44 as an interface output feature (postrouting in2out translation)
NAT workers details response.
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)
#define vec_terminate_c_string(V)
(If necessary) NULL terminate a vector containing a c-string.
Enable/disable NAT44 plugin.
static void vl_api_nat44_ei_ha_set_failover_t_handler(vl_api_nat44_ei_ha_set_failover_t *mp)
static void vl_api_nat44_ei_interface_output_feature_dump_t_handler(vl_api_nat44_ei_interface_output_feature_dump_t *mp)
static void vl_api_nat44_ei_ha_flush_t_handler(vl_api_nat44_ei_ha_flush_t *mp)
static void vl_api_nat44_ei_interface_addr_dump_t_handler(vl_api_nat44_ei_interface_addr_dump_t *mp)
vl_api_ip4_address_t ip_address
Resync HA (resend existing sessions to new failover)
static void vl_api_nat44_ei_interface_dump_t_handler(vl_api_nat44_ei_interface_dump_t *mp)
static void send_nat44_ei_identity_map_resolve_details(nat44_ei_static_map_resolve_t *m, vl_api_registration_t *reg, u32 context)
Get HA failover/remote settings.
int nat_ha_set_listener(vlib_main_t *vm, ip4_address_t *addr, u16 port, u32 path_mtu)
Set HA listener (local settings)
vl_api_ip4_address_t local_ip_address
u32 * auto_add_sw_if_indices
#define nat44_ei_log_info(...)
vl_api_ip4_address_t first_ip_address
static void send_nat44_ei_interface_addr_details(u32 sw_if_index, vl_api_registration_t *reg, u32 context)
#define nat44_ei_is_unk_proto_session(sp)
vl_api_interface_index_t sw_if_index
#define nat44_ei_is_addr_only_static_mapping(mp)
Show NAT handoff frame queue options reply.
vl_api_ip4_address_t address
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
vl_api_interface_index_t sw_if_index
int nat44_ei_del_address(nat44_ei_main_t *nm, ip4_address_t addr, u8 delete_sm)
static void vl_api_nat44_ei_interface_add_del_output_feature_t_handler(vl_api_nat44_ei_interface_add_del_output_feature_t *mp)
NAT44 identity mapping details response.
vl_api_nat44_ei_config_flags_t flags
vl_api_ip4_address_t ip_address
void nat_ha_get_failover(ip4_address_t *addr, u16 *port, u32 *session_refresh_interval)
Get HA failover/remote settings.
void nat44_ei_set_alloc_default()
Set address and port assignment algorithm to default/standard.
Add/del NAT44 address range.
vl_api_nat44_ei_config_flags_t flags
static void send_nat44_ei_interface_details(nat44_ei_interface_t *i, vl_api_registration_t *reg, u32 context)
NAT44 address details response.
static void send_nat44_ei_user_details(nat44_ei_user_t *u, vl_api_registration_t *reg, u32 context)
vl_api_ip4_address_t ip_address
static void vl_api_nat44_ei_add_del_static_mapping_t_handler(vl_api_nat44_ei_add_del_static_mapping_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_nat44_ei_add_del_address_range_t_handler(vl_api_nat44_ei_add_del_address_range_t *mp)
nat44_ei_lb_addr_port_t * locals
Set values of timeouts for NAT sessions (seconds)
void * vl_msg_api_alloc(int nbytes)