FD.io VPP  v17.04.2-2-ga8f93f8
Vector Packet Processing
snat.c File Reference
+ Include dependency graph for snat.c:

Go to the source code of this file.

Macros

#define vl_typedefs
 
#define vl_endianfun
 
#define vl_print(handle, ...)   vlib_cli_output (handle, __VA_ARGS__)
 
#define REPLY_MSG_ID_BASE   sm->msg_id_base
 
#define vl_api_version(n, v)   static u32 api_version=(v);
 
#define FINISH
 
#define foreach_snat_plugin_api_msg
 
#define vl_msg_name_crc_list
 

Functions

 VNET_FEATURE_INIT (ip4_snat_in2out, static)
 
 VNET_FEATURE_INIT (ip4_snat_out2in, static)
 
 VNET_FEATURE_INIT (ip4_snat_det_in2out, static)
 
 VNET_FEATURE_INIT (ip4_snat_det_out2in, static)
 
 VNET_FEATURE_INIT (ip4_snat_in2out_worker_handoff, static)
 
 VNET_FEATURE_INIT (ip4_snat_out2in_worker_handoff, static)
 
 VNET_FEATURE_INIT (ip4_snat_in2out_fast, static)
 
 VNET_FEATURE_INIT (ip4_snat_out2in_fast, static)
 
 VLIB_PLUGIN_REGISTER ()
 
void snat_add_del_addr_to_fib (ip4_address_t *addr, u8 p_len, u32 sw_if_index, int is_add)
 Add/del NAT address to FIB. More...
 
void snat_add_address (snat_main_t *sm, ip4_address_t *addr, u32 vrf_id)
 
static int is_snat_address_used_in_static_mapping (snat_main_t *sm, ip4_address_t addr)
 
static void increment_v4_address (ip4_address_t *a)
 
static void snat_add_static_mapping_when_resolved (snat_main_t *sm, ip4_address_t l_addr, u16 l_port, u32 sw_if_index, u16 e_port, u32 vrf_id, snat_protocol_t proto, int addr_only, int is_add)
 
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)
 Add static mapping. More...
 
int snat_del_address (snat_main_t *sm, ip4_address_t addr, u8 delete_sm)
 
static int snat_interface_add_del (u32 sw_if_index, u8 is_inside, int is_del)
 
static int snat_set_workers (uword *bitmap)
 
static void vl_api_snat_add_address_range_t_handler (vl_api_snat_add_address_range_t *mp)
 
static void * vl_api_snat_add_address_range_t_print (vl_api_snat_add_address_range_t *mp, void *handle)
 
static void send_snat_address_details (snat_address_t *a, unix_shared_memory_queue_t *q, u32 context)
 
static void vl_api_snat_address_dump_t_handler (vl_api_snat_address_dump_t *mp)
 
static void * vl_api_snat_address_dump_t_print (vl_api_snat_address_dump_t *mp, void *handle)
 
static void vl_api_snat_interface_add_del_feature_t_handler (vl_api_snat_interface_add_del_feature_t *mp)
 
static void * vl_api_snat_interface_add_del_feature_t_print (vl_api_snat_interface_add_del_feature_t *mp, void *handle)
 
static void send_snat_interface_details (snat_interface_t *i, unix_shared_memory_queue_t *q, u32 context)
 
static void vl_api_snat_interface_dump_t_handler (vl_api_snat_interface_dump_t *mp)
 
static void * vl_api_snat_interface_dump_t_print (vl_api_snat_interface_dump_t *mp, void *handle)
 
static void vl_api_snat_add_static_mapping_t_handler (vl_api_snat_add_static_mapping_t *mp)
 
static void * vl_api_snat_add_static_mapping_t_print (vl_api_snat_add_static_mapping_t *mp, void *handle)
 
static void send_snat_static_mapping_details (snat_static_mapping_t *m, unix_shared_memory_queue_t *q, u32 context)
 
static void send_snat_static_map_resolve_details (snat_static_map_resolve_t *m, unix_shared_memory_queue_t *q, u32 context)
 
static void vl_api_snat_static_mapping_dump_t_handler (vl_api_snat_static_mapping_dump_t *mp)
 
static void * vl_api_snat_static_mapping_dump_t_print (vl_api_snat_static_mapping_dump_t *mp, void *handle)
 
static void vl_api_snat_control_ping_t_handler (vl_api_snat_control_ping_t *mp)
 
static void * vl_api_snat_control_ping_t_print (vl_api_snat_control_ping_t *mp, void *handle)
 
static void vl_api_snat_show_config_t_handler (vl_api_snat_show_config_t *mp)
 
static void * vl_api_snat_show_config_t_print (vl_api_snat_show_config_t *mp, void *handle)
 
static void vl_api_snat_set_workers_t_handler (vl_api_snat_set_workers_t *mp)
 
static void * vl_api_snat_set_workers_t_print (vl_api_snat_set_workers_t *mp, void *handle)
 
static void send_snat_worker_details (u32 worker_index, unix_shared_memory_queue_t *q, u32 context)
 
static void vl_api_snat_worker_dump_t_handler (vl_api_snat_worker_dump_t *mp)
 
static void * vl_api_snat_worker_dump_t_print (vl_api_snat_worker_dump_t *mp, void *handle)
 
static int snat_add_interface_address (snat_main_t *sm, u32 sw_if_index, int is_del)
 
static void vl_api_snat_add_del_interface_addr_t_handler (vl_api_snat_add_del_interface_addr_t *mp)
 
static void * vl_api_snat_add_del_interface_addr_t_print (vl_api_snat_add_del_interface_addr_t *mp, void *handle)
 
static void send_snat_interface_addr_details (u32 sw_if_index, unix_shared_memory_queue_t *q, u32 context)
 
static void vl_api_snat_interface_addr_dump_t_handler (vl_api_snat_interface_addr_dump_t *mp)
 
static void * vl_api_snat_interface_addr_dump_t_print (vl_api_snat_interface_addr_dump_t *mp, void *handle)
 
static void vl_api_snat_ipfix_enable_disable_t_handler (vl_api_snat_ipfix_enable_disable_t *mp)
 
static void * vl_api_snat_ipfix_enable_disable_t_print (vl_api_snat_ipfix_enable_disable_t *mp, void *handle)
 
static void send_snat_user_details (snat_user_t *u, unix_shared_memory_queue_t *q, u32 context)
 
static void vl_api_snat_user_dump_t_handler (vl_api_snat_user_dump_t *mp)
 
static void * vl_api_snat_user_dump_t_print (vl_api_snat_user_dump_t *mp, void *handle)
 
static void send_snat_user_session_details (snat_session_t *s, unix_shared_memory_queue_t *q, u32 context)
 
static void vl_api_snat_user_session_dump_t_handler (vl_api_snat_user_session_dump_t *mp)
 
static void * vl_api_snat_user_session_dump_t_print (vl_api_snat_user_session_dump_t *mp, void *handle)
 
static void vl_api_snat_add_det_map_t_handler (vl_api_snat_add_det_map_t *mp)
 
static void * vl_api_snat_add_det_map_t_print (vl_api_snat_add_det_map_t *mp, void *handle)
 
static void vl_api_snat_det_forward_t_handler (vl_api_snat_det_forward_t *mp)
 
static void * vl_api_snat_det_forward_t_print (vl_api_snat_det_forward_t *mp, void *handle)
 
static void vl_api_snat_det_reverse_t_handler (vl_api_snat_det_reverse_t *mp)
 
static void * vl_api_snat_det_reverse_t_print (vl_api_snat_det_reverse_t *mp, void *handle)
 
static void sent_snat_det_map_details (snat_det_map_t *m, unix_shared_memory_queue_t *q, u32 context)
 
static void vl_api_snat_det_map_dump_t_handler (vl_api_snat_det_map_dump_t *mp)
 
static void * vl_api_snat_det_map_dump_t_print (vl_api_snat_det_map_dump_t *mp, void *handle)
 
static clib_error_tsnat_plugin_api_hookup (vlib_main_t *vm)
 
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 snat_ip4_add_del_interface_address_cb (ip4_main_t *im, uword opaque, u32 sw_if_index, ip4_address_t *address, u32 address_length, u32 if_address_index, u32 is_delete)
 
static clib_error_tsnat_init (vlib_main_t *vm)
 
void snat_free_outside_address_and_port (snat_main_t *sm, snat_session_key_t *k, u32 address_index)
 
int snat_static_mapping_match (snat_main_t *sm, snat_session_key_t match, snat_session_key_t *mapping, u8 by_external, u8 *is_addr_only)
 Match SNAT static mapping. More...
 
int snat_alloc_outside_address_and_port (snat_main_t *sm, u32 fib_index, snat_session_key_t *k, u32 *address_indexp)
 
static clib_error_tadd_address_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tsnat_feature_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
uword unformat_snat_protocol (unformat_input_t *input, va_list *args)
 
u8format_snat_protocol (u8 *s, va_list *args)
 
static clib_error_tadd_static_mapping_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tset_workers_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tsnat_ipfix_logging_enable_disable_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static u32 snat_get_worker_in2out_cb (ip4_header_t *ip0, u32 rx_fib_index0)
 
static u32 snat_get_worker_out2in_cb (ip4_header_t *ip0, u32 rx_fib_index0)
 
static clib_error_tsnat_config (vlib_main_t *vm, unformat_input_t *input)
 
u8format_snat_session_state (u8 *s, va_list *args)
 
u8format_snat_key (u8 *s, va_list *args)
 
u8format_snat_session (u8 *s, va_list *args)
 
u8format_snat_user (u8 *s, va_list *args)
 
u8format_snat_static_mapping (u8 *s, va_list *args)
 
u8format_snat_static_map_to_resolve (u8 *s, va_list *args)
 
u8format_det_map_ses (u8 *s, va_list *args)
 
static clib_error_tshow_snat_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tsnat_add_interface_address_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tsnat_det_map_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tsnat_det_forward_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tsnat_det_reverse_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 

Variables

snat_main_t snat_main
 
static vlib_cli_command_t add_address_command
 (constructor) VLIB_CLI_COMMAND (add_address_command) More...
 
static vlib_cli_command_t set_interface_snat_command
 (constructor) VLIB_CLI_COMMAND (set_interface_snat_command) More...
 
static vlib_cli_command_t add_static_mapping_command
 (constructor) VLIB_CLI_COMMAND (add_static_mapping_command) More...
 
static vlib_cli_command_t set_workers_command
 (constructor) VLIB_CLI_COMMAND (set_workers_command) More...
 
static vlib_cli_command_t snat_ipfix_logging_enable_disable_command
 (constructor) VLIB_CLI_COMMAND (snat_ipfix_logging_enable_disable_command) More...
 
static vlib_cli_command_t show_snat_command
 (constructor) VLIB_CLI_COMMAND (show_snat_command) More...
 
static vlib_cli_command_t snat_add_interface_address_command
 (constructor) VLIB_CLI_COMMAND (snat_add_interface_address_command) More...
 
static vlib_cli_command_t snat_det_map_command
 (constructor) VLIB_CLI_COMMAND (snat_det_map_command) More...
 
static vlib_cli_command_t snat_det_forward_command
 (constructor) VLIB_CLI_COMMAND (snat_det_forward_command) More...
 
static vlib_cli_command_t snat_det_reverse_command
 (constructor) VLIB_CLI_COMMAND (snat_det_reverse_command) More...
 

Macro Definition Documentation

#define FINISH
Value:
vec_add1 (s, 0); \
vl_print (handle, (char *)s); \
vec_free (s); \
return handle;
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:522
#define vec_free(V)
Free vector's memory (no header).
Definition: vec.h:340
#define vl_print(handle,...)
Definition: snat.c:48

Definition at line 59 of file snat.c.

#define foreach_snat_plugin_api_msg
Value:
_(SNAT_ADD_ADDRESS_RANGE, snat_add_address_range) \
_(SNAT_INTERFACE_ADD_DEL_FEATURE, snat_interface_add_del_feature) \
_(SNAT_ADD_STATIC_MAPPING, snat_add_static_mapping) \
_(SNAT_CONTROL_PING, snat_control_ping) \
_(SNAT_STATIC_MAPPING_DUMP, snat_static_mapping_dump) \
_(SNAT_SHOW_CONFIG, snat_show_config) \
_(SNAT_ADDRESS_DUMP, snat_address_dump) \
_(SNAT_INTERFACE_DUMP, snat_interface_dump) \
_(SNAT_SET_WORKERS, snat_set_workers) \
_(SNAT_WORKER_DUMP, snat_worker_dump) \
_(SNAT_ADD_DEL_INTERFACE_ADDR, snat_add_del_interface_addr) \
_(SNAT_INTERFACE_ADDR_DUMP, snat_interface_addr_dump) \
_(SNAT_IPFIX_ENABLE_DISABLE, snat_ipfix_enable_disable) \
_(SNAT_USER_DUMP, snat_user_dump) \
_(SNAT_USER_SESSION_DUMP, snat_user_session_dump) \
_(SNAT_ADD_DET_MAP, snat_add_det_map) \
_(SNAT_DET_FORWARD, snat_det_forward) \
_(SNAT_DET_REVERSE, snat_det_reverse) \
_(SNAT_DET_MAP_DUMP, snat_det_map_dump)
static void snat_det_reverse(snat_det_map_t *dm, ip4_address_t *out_addr, u16 out_port, ip4_address_t *in_addr)
Definition: snat_det.h:89
static void snat_det_forward(snat_det_map_t *dm, ip4_address_t *in_addr, ip4_address_t *out_addr, u16 *lo_port)
Definition: snat_det.h:74
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)
Add static mapping.
Definition: snat.c:254
static int snat_set_workers(uword *bitmap)
Definition: snat.c:726

Definition at line 1658 of file snat.c.

#define REPLY_MSG_ID_BASE   sm->msg_id_base

Definition at line 50 of file snat.c.

#define vl_api_version (   n,
  v 
)    static u32 api_version=(v);

Definition at line 54 of file snat.c.

#define vl_endianfun

Definition at line 44 of file snat.c.

#define vl_msg_name_crc_list

Definition at line 1698 of file snat.c.

#define vl_print (   handle,
  ... 
)    vlib_cli_output (handle, __VA_ARGS__)

Definition at line 48 of file snat.c.

#define vl_typedefs

Definition at line 39 of file snat.c.

Function Documentation

static clib_error_t* add_address_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 1953 of file snat.c.

+ Here is the call graph for this function:

static clib_error_t* add_static_mapping_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 2154 of file snat.c.

+ Here is the call graph for this function:

u8* format_det_map_ses ( u8 s,
va_list *  args 
)

Definition at line 2741 of file snat.c.

+ Here is the call graph for this function:

u8* format_snat_key ( u8 s,
va_list *  args 
)

Definition at line 2623 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8* format_snat_protocol ( u8 s,
va_list *  args 
)

Definition at line 2136 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8* format_snat_session ( u8 s,
va_list *  args 
)

Definition at line 2642 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8* format_snat_session_state ( u8 s,
va_list *  args 
)

Definition at line 2606 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8* format_snat_static_map_to_resolve ( u8 s,
va_list *  args 
)

Definition at line 2719 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8* format_snat_static_mapping ( u8 s,
va_list *  args 
)

Definition at line 2700 of file snat.c.

+ Here is the call graph for this function:

u8* format_snat_user ( u8 s,
va_list *  args 
)

Definition at line 2660 of file snat.c.

+ Here is the call graph for this function:

static void increment_v4_address ( ip4_address_t a)
static

Definition at line 206 of file snat.c.

+ Here is the caller graph for this function:

static int is_snat_address_used_in_static_mapping ( snat_main_t sm,
ip4_address_t  addr 
)
static

Definition at line 193 of file snat.c.

+ Here is the caller graph for this function:

static void plugin_custom_dump_configure ( snat_main_t sm)
static

Definition at line 1711 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void send_snat_address_details ( snat_address_t a,
unix_shared_memory_queue_t q,
u32  context 
)
static

Definition at line 821 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void send_snat_interface_addr_details ( u32  sw_if_index,
unix_shared_memory_queue_t q,
u32  context 
)
static

Definition at line 1279 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void send_snat_interface_details ( snat_interface_t i,
unix_shared_memory_queue_t q,
u32  context 
)
static

Definition at line 901 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void send_snat_static_map_resolve_details ( snat_static_map_resolve_t m,
unix_shared_memory_queue_t q,
u32  context 
)
static

Definition at line 1031 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void send_snat_static_mapping_details ( snat_static_mapping_t m,
unix_shared_memory_queue_t q,
u32  context 
)
static

Definition at line 1007 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void send_snat_user_details ( snat_user_t u,
unix_shared_memory_queue_t q,
u32  context 
)
static

Definition at line 1352 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void send_snat_user_session_details ( snat_session_t *  s,
unix_shared_memory_queue_t q,
u32  context 
)
static

Definition at line 1404 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void send_snat_worker_details ( u32  worker_index,
unix_shared_memory_queue_t q,
u32  context 
)
static

Definition at line 1195 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void sent_snat_det_map_details ( snat_det_map_t m,
unix_shared_memory_queue_t q,
u32  context 
)
static

Definition at line 1610 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* set_workers_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 2267 of file snat.c.

+ Here is the call graph for this function:

static void setup_message_id_table ( snat_main_t sm,
api_main_t am 
)
static

Definition at line 1703 of file snat.c.

+ Here is the caller graph for this function:

static clib_error_t* show_snat_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 2771 of file snat.c.

+ Here is the call graph for this function:

void snat_add_address ( snat_main_t sm,
ip4_address_t addr,
u32  vrf_id 
)

Definition at line 159 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void snat_add_del_addr_to_fib ( ip4_address_t addr,
u8  p_len,
u32  sw_if_index,
int  is_add 
)

Add/del NAT address to FIB.

Add the external NAT address to the FIB as receive entries. This ensures that VPP will reply to ARP for this address and we don't need to enable proxy ARP on the outside interface.

Parameters
addrIPv4 address.
plenaddress prefix length
sw_if_indexInterface.
is_addIf 0 delete, otherwise add.

Definition at line 127 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int snat_add_interface_address ( snat_main_t sm,
u32  sw_if_index,
int  is_del 
)
static

Definition at line 3045 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* snat_add_interface_address_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 3105 of file snat.c.

+ Here is the call graph for this function:

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 
)

Add static mapping.

Create static mapping between local addr+port and external addr+port.

Parameters
l_addrLocal IPv4 address.
e_addrExternal IPv4 address.
l_portLocal port number.
e_portExternal port number.
vrf_idVRF ID.
addr_onlyIf 0 address port and pair mapping, otherwise address only.
sw_if_indexExternal port instead of specific IP address.
is_addIf 0 delete static mapping, otherwise add.
Returns

Definition at line 254 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void snat_add_static_mapping_when_resolved ( snat_main_t sm,
ip4_address_t  l_addr,
u16  l_port,
u32  sw_if_index,
u16  e_port,
u32  vrf_id,
snat_protocol_t  proto,
int  addr_only,
int  is_add 
)
static

Definition at line 215 of file snat.c.

+ Here is the caller graph for this function:

int snat_alloc_outside_address_and_port ( snat_main_t sm,
u32  fib_index,
snat_session_key_t k,
u32 address_indexp 
)

Definition at line 1901 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* snat_config ( vlib_main_t vm,
unformat_input_t input 
)
static

Definition at line 2487 of file snat.c.

+ Here is the call graph for this function:

int snat_del_address ( snat_main_t sm,
ip4_address_t  addr,
u8  delete_sm 
)

Definition at line 552 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* snat_det_forward_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 3227 of file snat.c.

+ Here is the call graph for this function:

static clib_error_t* snat_det_map_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 3161 of file snat.c.

+ Here is the call graph for this function:

static clib_error_t* snat_det_reverse_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 3289 of file snat.c.

+ Here is the call graph for this function:

static clib_error_t* snat_feature_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 2052 of file snat.c.

+ Here is the call graph for this function:

void snat_free_outside_address_and_port ( snat_main_t sm,
snat_session_key_t k,
u32  address_index 
)

Definition at line 1804 of file snat.c.

+ Here is the caller graph for this function:

static u32 snat_get_worker_in2out_cb ( ip4_header_t ip0,
u32  rx_fib_index0 
)
static

Definition at line 2397 of file snat.c.

+ Here is the caller graph for this function:

static u32 snat_get_worker_out2in_cb ( ip4_header_t ip0,
u32  rx_fib_index0 
)
static

Definition at line 2431 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* snat_init ( vlib_main_t vm)
static

Definition at line 1730 of file snat.c.

+ Here is the call graph for this function:

static int snat_interface_add_del ( u32  sw_if_index,
u8  is_inside,
int  is_del 
)
static

Definition at line 652 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void snat_ip4_add_del_interface_address_cb ( ip4_main_t im,
uword  opaque,
u32  sw_if_index,
ip4_address_t address,
u32  address_length,
u32  if_address_index,
u32  is_delete 
)
static

Definition at line 2976 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* snat_ipfix_logging_enable_disable_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 2336 of file snat.c.

+ Here is the call graph for this function:

static clib_error_t* snat_plugin_api_hookup ( vlib_main_t vm)
static

Definition at line 1681 of file snat.c.

+ Here is the caller graph for this function:

static int snat_set_workers ( uword bitmap)
static

Definition at line 726 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int snat_static_mapping_match ( snat_main_t sm,
snat_session_key_t  match,
snat_session_key_t mapping,
u8  by_external,
u8 is_addr_only 
)

Match SNAT static mapping.

Parameters
smSNAT main.
matchAddress and port to match.
mappingExternal or local address and port of the matched mapping.
by_externalIf 0 match by local address otherwise match by external address.
is_addr_onlyIf matched mapping is address only
Returns
0 if match found otherwise 1.

Definition at line 1845 of file snat.c.

+ Here is the caller graph for this function:

uword unformat_snat_protocol ( unformat_input_t input,
va_list *  args 
)

Definition at line 2122 of file snat.c.

+ Here is the caller graph for this function:

static void vl_api_snat_add_address_range_t_handler ( vl_api_snat_add_address_range_t mp)
static

Definition at line 748 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void* vl_api_snat_add_address_range_t_print ( vl_api_snat_add_address_range_t mp,
void *  handle 
)
static

Definition at line 806 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void vl_api_snat_add_del_interface_addr_t_handler ( vl_api_snat_add_del_interface_addr_t mp)
static

Definition at line 1247 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void* vl_api_snat_add_del_interface_addr_t_print ( vl_api_snat_add_del_interface_addr_t mp,
void *  handle 
)
static

Definition at line 1265 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void vl_api_snat_add_det_map_t_handler ( vl_api_snat_add_det_map_t mp)
static

Definition at line 1492 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void* vl_api_snat_add_det_map_t_print ( vl_api_snat_add_det_map_t mp,
void *  handle 
)
static

Definition at line 1508 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void vl_api_snat_add_static_mapping_t_handler ( vl_api_snat_add_static_mapping_t mp)
static

Definition at line 945 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void* vl_api_snat_add_static_mapping_t_print ( vl_api_snat_add_static_mapping_t mp,
void *  handle 
)
static

Definition at line 981 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void vl_api_snat_address_dump_t_handler ( vl_api_snat_address_dump_t mp)
static

Definition at line 842 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void* vl_api_snat_address_dump_t_print ( vl_api_snat_address_dump_t mp,
void *  handle 
)
static

Definition at line 857 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void vl_api_snat_control_ping_t_handler ( vl_api_snat_control_ping_t mp)
static

Definition at line 1090 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void* vl_api_snat_control_ping_t_print ( vl_api_snat_control_ping_t mp,
void *  handle 
)
static

Definition at line 1103 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void vl_api_snat_det_forward_t_handler ( vl_api_snat_det_forward_t mp)
static

Definition at line 1522 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void* vl_api_snat_det_forward_t_print ( vl_api_snat_det_forward_t mp,
void *  handle 
)
static

Definition at line 1555 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void vl_api_snat_det_map_dump_t_handler ( vl_api_snat_det_map_dump_t mp)
static

Definition at line 1633 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void* vl_api_snat_det_map_dump_t_print ( vl_api_snat_det_map_dump_t mp,
void *  handle 
)
static

Definition at line 1648 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void vl_api_snat_det_reverse_t_handler ( vl_api_snat_det_reverse_t mp)
static

Definition at line 1568 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void* vl_api_snat_det_reverse_t_print ( vl_api_snat_det_reverse_t mp,
void *  handle 
)
static

Definition at line 1597 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void vl_api_snat_interface_add_del_feature_t_handler ( vl_api_snat_interface_add_del_feature_t mp)
static

Definition at line 868 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void* vl_api_snat_interface_add_del_feature_t_print ( vl_api_snat_interface_add_del_feature_t mp,
void *  handle 
)
static

Definition at line 886 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void vl_api_snat_interface_addr_dump_t_handler ( vl_api_snat_interface_addr_dump_t mp)
static

Definition at line 1295 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void* vl_api_snat_interface_addr_dump_t_print ( vl_api_snat_interface_addr_dump_t mp,
void *  handle 
)
static

Definition at line 1310 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void vl_api_snat_interface_dump_t_handler ( vl_api_snat_interface_dump_t mp)
static

Definition at line 918 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void* vl_api_snat_interface_dump_t_print ( vl_api_snat_interface_dump_t mp,
void *  handle 
)
static

Definition at line 935 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void vl_api_snat_ipfix_enable_disable_t_handler ( vl_api_snat_ipfix_enable_disable_t mp)
static

Definition at line 1321 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void* vl_api_snat_ipfix_enable_disable_t_print ( vl_api_snat_ipfix_enable_disable_t mp,
void *  handle 
)
static

Definition at line 1335 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void vl_api_snat_set_workers_t_handler ( vl_api_snat_set_workers_t mp)
static

Definition at line 1148 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void* vl_api_snat_set_workers_t_print ( vl_api_snat_set_workers_t mp,
void *  handle 
)
static

Definition at line 1171 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void vl_api_snat_show_config_t_handler ( vl_api_snat_show_config_t mp)
static

Definition at line 1114 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void* vl_api_snat_show_config_t_print ( vl_api_snat_show_config_t mp,
void *  handle 
)
static

Definition at line 1137 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void vl_api_snat_static_mapping_dump_t_handler ( vl_api_snat_static_mapping_dump_t mp)
static

Definition at line 1054 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void* vl_api_snat_static_mapping_dump_t_print ( vl_api_snat_static_mapping_dump_t mp,
void *  handle 
)
static

Definition at line 1079 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void vl_api_snat_user_dump_t_handler ( vl_api_snat_user_dump_t mp)
static

Definition at line 1376 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void* vl_api_snat_user_dump_t_print ( vl_api_snat_user_dump_t mp,
void *  handle 
)
static

Definition at line 1393 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void vl_api_snat_user_session_dump_t_handler ( vl_api_snat_user_session_dump_t mp)
static

Definition at line 1429 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void* vl_api_snat_user_session_dump_t_print ( vl_api_snat_user_session_dump_t mp,
void *  handle 
)
static

Definition at line 1478 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void vl_api_snat_worker_dump_t_handler ( vl_api_snat_worker_dump_t mp)
static

Definition at line 1215 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void* vl_api_snat_worker_dump_t_print ( vl_api_snat_worker_dump_t mp,
void *  handle 
)
static

Definition at line 1232 of file snat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

VLIB_PLUGIN_REGISTER ( )
VNET_FEATURE_INIT ( ip4_snat_in2out  ,
static   
)
VNET_FEATURE_INIT ( ip4_snat_out2in  ,
static   
)
VNET_FEATURE_INIT ( ip4_snat_det_in2out  ,
static   
)
VNET_FEATURE_INIT ( ip4_snat_det_out2in  ,
static   
)
VNET_FEATURE_INIT ( ip4_snat_in2out_worker_handoff  ,
static   
)
VNET_FEATURE_INIT ( ip4_snat_out2in_worker_handoff  ,
static   
)
VNET_FEATURE_INIT ( ip4_snat_in2out_fast  ,
static   
)
VNET_FEATURE_INIT ( ip4_snat_out2in_fast  ,
static   
)

Variable Documentation

vlib_cli_command_t add_address_command
static
Initial value:
= {
.path = "snat add address",
.short_help = "snat add addresses <ip4-range-start> [- <ip4-range-end>] "
"[tenant-vrf <vrf-id>] [del]",
}
static clib_error_t * add_address_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: snat.c:1953

(constructor) VLIB_CLI_COMMAND (add_address_command)

Definition at line 2044 of file snat.c.

vlib_cli_command_t add_static_mapping_command
static
Initial value:
= {
.path = "snat add static mapping",
.short_help =
"snat add static mapping local tcp|udp|icmp <addr> [<port>] external <addr> [<port>] [vrf <table-id>] [del]",
}
static clib_error_t * add_static_mapping_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: snat.c:2154

(constructor) VLIB_CLI_COMMAND (add_static_mapping_command)

Definition at line 2259 of file snat.c.

vlib_cli_command_t set_interface_snat_command
static
Initial value:
= {
.path = "set interface snat",
.short_help = "set interface snat in <intfc> out <intfc> [del]",
}
static clib_error_t * snat_feature_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: snat.c:2052

(constructor) VLIB_CLI_COMMAND (set_interface_snat_command)

Definition at line 2115 of file snat.c.

vlib_cli_command_t set_workers_command
static
Initial value:
= {
.path = "set snat workers",
.short_help =
"set snat workers <workers-list>",
}
static clib_error_t * set_workers_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: snat.c:2267

(constructor) VLIB_CLI_COMMAND (set_workers_command)

Definition at line 2328 of file snat.c.

vlib_cli_command_t show_snat_command
static
Initial value:
= {
.path = "show snat",
.short_help = "show snat",
.function = show_snat_command_fn,
}
static clib_error_t * show_snat_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: snat.c:2771

(constructor) VLIB_CLI_COMMAND (show_snat_command)

Definition at line 2968 of file snat.c.

vlib_cli_command_t snat_add_interface_address_command
static
Initial value:
= {
.path = "snat add interface address",
.short_help = "snat add interface address <interface> [del]",
}
static clib_error_t * snat_add_interface_address_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: snat.c:3105

(constructor) VLIB_CLI_COMMAND (snat_add_interface_address_command)

Definition at line 3154 of file snat.c.

vlib_cli_command_t snat_det_forward_command
static
Initial value:
= {
.path = "snat deterministic forward",
.short_help = "snat deterministic forward <addr>",
}
static clib_error_t * snat_det_forward_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: snat.c:3227

(constructor) VLIB_CLI_COMMAND (snat_det_forward_command)

Definition at line 3282 of file snat.c.

vlib_cli_command_t snat_det_map_command
static
Initial value:
= {
.path = "snat deterministic add",
.short_help = "snat deterministic add in <addr>/<plen> out <addr>/<plen> [del]",
}
static clib_error_t * snat_det_map_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: snat.c:3161

(constructor) VLIB_CLI_COMMAND (snat_det_map_command)

Definition at line 3220 of file snat.c.

vlib_cli_command_t snat_det_reverse_command
static
Initial value:
= {
.path = "snat deterministic reverse",
.short_help = "snat deterministic reverse <addr>:<port>",
}
static clib_error_t * snat_det_reverse_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: snat.c:3289

(constructor) VLIB_CLI_COMMAND (snat_det_reverse_command)

Definition at line 3347 of file snat.c.

vlib_cli_command_t snat_ipfix_logging_enable_disable_command
static
Initial value:
= {
.path = "snat ipfix logging",
.short_help = "snat ipfix logging [domain <domain-id>] [src-port <port>] [disable]",
}
static clib_error_t * snat_ipfix_logging_enable_disable_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: snat.c:2336

(constructor) VLIB_CLI_COMMAND (snat_ipfix_logging_enable_disable_command)

Definition at line 2390 of file snat.c.

snat_main_t snat_main

Definition at line 33 of file snat.c.