FD.io VPP  v20.09-64-g4f7b92f0a
Vector Packet Processing
nat_inlines.h File Reference
+ Include dependency graph for nat_inlines.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static u64 calc_nat_key (ip4_address_t addr, u16 port, u32 fib_index, u8 proto)
 The NAT inline functions. More...
 
static void split_nat_key (u64 key, ip4_address_t *addr, u16 *port, u32 *fib_index, nat_protocol_t *proto)
 
static void init_nat_k (clib_bihash_kv_8_8_t *kv, ip4_address_t addr, u16 port, u32 fib_index, nat_protocol_t proto)
 
static void init_nat_kv (clib_bihash_kv_8_8_t *kv, ip4_address_t addr, u16 port, u32 fib_index, nat_protocol_t proto, u64 value)
 
static void init_nat_i2o_k (clib_bihash_kv_8_8_t *kv, snat_session_t *s)
 
static void init_nat_i2o_kv (clib_bihash_kv_8_8_t *kv, snat_session_t *s, u64 value)
 
static void init_nat_o2i_k (clib_bihash_kv_8_8_t *kv, snat_session_t *s)
 
static void init_nat_o2i_kv (clib_bihash_kv_8_8_t *kv, snat_session_t *s, u64 value)
 
static uword nat_pre_node_fn_inline (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u32 def_next)
 
static u8 is_interface_addr (snat_main_t *sm, vlib_node_runtime_t *node, u32 sw_if_index0, u32 ip4_addr)
 
static u8 maximum_sessions_exceeded (snat_main_t *sm, u32 thread_index)
 
static void user_session_increment (snat_main_t *sm, snat_user_t *u, u8 is_static)
 
static void nat44_delete_user_with_no_session (snat_main_t *sm, snat_user_t *u, u32 thread_index)
 
static void nat44_delete_session (snat_main_t *sm, snat_session_t *ses, u32 thread_index)
 
static int nat44_set_tcp_session_state_i2o (snat_main_t *sm, f64 now, snat_session_t *ses, vlib_buffer_t *b, u32 thread_index)
 Set TCP session state. More...
 
static int nat44_set_tcp_session_state_o2i (snat_main_t *sm, f64 now, snat_session_t *ses, u8 tcp_flags, u32 tcp_ack_number, u32 tcp_seq_number, u32 thread_index)
 
static u32 nat44_session_get_timeout (snat_main_t *sm, snat_session_t *s)
 
static void nat44_session_update_counters (snat_session_t *s, f64 now, uword bytes, u32 thread_index)
 
static void nat44_session_update_lru (snat_main_t *sm, snat_session_t *s, u32 thread_index)
 Per-user LRU list maintenance. More...
 
static void init_ed_k (clib_bihash_kv_16_8_t *kv, ip4_address_t l_addr, u16 l_port, ip4_address_t r_addr, u16 r_port, u32 fib_index, u8 proto)
 
static void init_ed_kv (clib_bihash_kv_16_8_t *kv, ip4_address_t l_addr, u16 l_port, ip4_address_t r_addr, u16 r_port, u32 fib_index, u8 proto, u32 thread_index, u32 session_index)
 
static u32 ed_value_get_thread_index (clib_bihash_kv_16_8_t *value)
 
static u32 ed_value_get_session_index (clib_bihash_kv_16_8_t *value)
 
static void split_ed_value (clib_bihash_kv_16_8_t *value, u32 *thread_index, u32 *session_index)
 
static void split_ed_kv (clib_bihash_kv_16_8_t *kv, ip4_address_t *l_addr, ip4_address_t *r_addr, u8 *proto, u32 *fib_index, u16 *l_port, u16 *r_port)
 
static_always_inline int get_icmp_i2o_ed_key (vlib_buffer_t *b, ip4_header_t *ip0, u32 rx_fib_index, u32 thread_index, u32 session_index, nat_protocol_t *nat_proto, u16 *l_port, u16 *r_port, clib_bihash_kv_16_8_t *kv)
 
static_always_inline int get_icmp_o2i_ed_key (vlib_buffer_t *b, ip4_header_t *ip0, u32 rx_fib_index, u32 thread_index, u32 session_index, nat_protocol_t *nat_proto, u16 *l_port, u16 *r_port, clib_bihash_kv_16_8_t *kv)
 
static int snat_not_translate_fast (snat_main_t *sm, vlib_node_runtime_t *node, u32 sw_if_index0, ip4_header_t *ip0, u32 proto0, u32 rx_fib_index0)
 Check if packet should be translated. More...
 
static void increment_v4_address (ip4_address_t *a)
 
static_always_inline u16 snat_random_port (u16 min, u16 max)
 

Function Documentation

◆ calc_nat_key()

static u64 calc_nat_key ( ip4_address_t  addr,
u16  port,
u32  fib_index,
u8  proto 
)
inlinestatic

The NAT inline functions.

Definition at line 27 of file nat_inlines.h.

+ Here is the caller graph for this function:

◆ ed_value_get_session_index()

static u32 ed_value_get_session_index ( clib_bihash_kv_16_8_t value)
inlinestatic

Definition at line 497 of file nat_inlines.h.

+ Here is the caller graph for this function:

◆ ed_value_get_thread_index()

static u32 ed_value_get_thread_index ( clib_bihash_kv_16_8_t value)
inlinestatic

Definition at line 491 of file nat_inlines.h.

+ Here is the caller graph for this function:

◆ get_icmp_i2o_ed_key()

static_always_inline int get_icmp_i2o_ed_key ( vlib_buffer_t b,
ip4_header_t ip0,
u32  rx_fib_index,
u32  thread_index,
u32  session_index,
nat_protocol_t nat_proto,
u16 l_port,
u16 r_port,
clib_bihash_kv_16_8_t kv 
)

Definition at line 548 of file nat_inlines.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_icmp_o2i_ed_key()

static_always_inline int get_icmp_o2i_ed_key ( vlib_buffer_t b,
ip4_header_t ip0,
u32  rx_fib_index,
u32  thread_index,
u32  session_index,
nat_protocol_t nat_proto,
u16 l_port,
u16 r_port,
clib_bihash_kv_16_8_t kv 
)

Definition at line 617 of file nat_inlines.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ increment_v4_address()

static void increment_v4_address ( ip4_address_t a)
inlinestatic

Definition at line 757 of file nat_inlines.h.

+ Here is the caller graph for this function:

◆ init_ed_k()

static void init_ed_k ( clib_bihash_kv_16_8_t kv,
ip4_address_t  l_addr,
u16  l_port,
ip4_address_t  r_addr,
u16  r_port,
u32  fib_index,
u8  proto 
)
inlinestatic

Definition at line 473 of file nat_inlines.h.

+ Here is the caller graph for this function:

◆ init_ed_kv()

static void init_ed_kv ( clib_bihash_kv_16_8_t kv,
ip4_address_t  l_addr,
u16  l_port,
ip4_address_t  r_addr,
u16  r_port,
u32  fib_index,
u8  proto,
u32  thread_index,
u32  session_index 
)
inlinestatic

Definition at line 482 of file nat_inlines.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_nat_i2o_k()

static void init_nat_i2o_k ( clib_bihash_kv_8_8_t kv,
snat_session_t *  s 
)
inlinestatic

Definition at line 74 of file nat_inlines.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_nat_i2o_kv()

static void init_nat_i2o_kv ( clib_bihash_kv_8_8_t kv,
snat_session_t *  s,
u64  value 
)
inlinestatic

Definition at line 81 of file nat_inlines.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_nat_k()

static void init_nat_k ( clib_bihash_kv_8_8_t kv,
ip4_address_t  addr,
u16  port,
u32  fib_index,
nat_protocol_t  proto 
)
inlinestatic

Definition at line 58 of file nat_inlines.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_nat_kv()

static void init_nat_kv ( clib_bihash_kv_8_8_t kv,
ip4_address_t  addr,
u16  port,
u32  fib_index,
nat_protocol_t  proto,
u64  value 
)
inlinestatic

Definition at line 66 of file nat_inlines.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_nat_o2i_k()

static void init_nat_o2i_k ( clib_bihash_kv_8_8_t kv,
snat_session_t *  s 
)
inlinestatic

Definition at line 89 of file nat_inlines.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_nat_o2i_kv()

static void init_nat_o2i_kv ( clib_bihash_kv_8_8_t kv,
snat_session_t *  s,
u64  value 
)
inlinestatic

Definition at line 96 of file nat_inlines.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_interface_addr()

static u8 is_interface_addr ( snat_main_t sm,
vlib_node_runtime_t node,
u32  sw_if_index0,
u32  ip4_addr 
)
inlinestatic

Definition at line 206 of file nat_inlines.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ maximum_sessions_exceeded()

static u8 maximum_sessions_exceeded ( snat_main_t sm,
u32  thread_index 
)
inlinestatic

Definition at line 231 of file nat_inlines.h.

+ Here is the call graph for this function:

◆ nat44_delete_session()

static void nat44_delete_session ( snat_main_t sm,
snat_session_t *  ses,
u32  thread_index 
)
inlinestatic

Definition at line 275 of file nat_inlines.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_delete_user_with_no_session()

static void nat44_delete_user_with_no_session ( snat_main_t sm,
snat_user_t u,
u32  thread_index 
)
inlinestatic

Definition at line 253 of file nat_inlines.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_session_get_timeout()

static u32 nat44_session_get_timeout ( snat_main_t sm,
snat_session_t *  s 
)
inlinestatic

Definition at line 411 of file nat_inlines.h.

+ Here is the caller graph for this function:

◆ nat44_session_update_counters()

static void nat44_session_update_counters ( snat_session_t *  s,
f64  now,
uword  bytes,
u32  thread_index 
)
inlinestatic

Definition at line 434 of file nat_inlines.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_session_update_lru()

static void nat44_session_update_lru ( snat_main_t sm,
snat_session_t *  s,
u32  thread_index 
)
inlinestatic

Per-user LRU list maintenance.

Definition at line 448 of file nat_inlines.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_set_tcp_session_state_i2o()

static int nat44_set_tcp_session_state_i2o ( snat_main_t sm,
f64  now,
snat_session_t *  ses,
vlib_buffer_t b,
u32  thread_index 
)
inlinestatic

Set TCP session state.

Returns
1 if session was closed, otherwise 0

Definition at line 316 of file nat_inlines.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat44_set_tcp_session_state_o2i()

static int nat44_set_tcp_session_state_o2i ( snat_main_t sm,
f64  now,
snat_session_t *  ses,
u8  tcp_flags,
u32  tcp_ack_number,
u32  tcp_seq_number,
u32  thread_index 
)
inlinestatic

Definition at line 366 of file nat_inlines.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nat_pre_node_fn_inline()

static uword nat_pre_node_fn_inline ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame,
u32  def_next 
)
inlinestatic

Definition at line 104 of file nat_inlines.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ snat_not_translate_fast()

static int snat_not_translate_fast ( snat_main_t sm,
vlib_node_runtime_t node,
u32  sw_if_index0,
ip4_header_t ip0,
u32  proto0,
u32  rx_fib_index0 
)
inlinestatic

Check if packet should be translated.

Packets aimed at outside interface and external address with active session should be translated.

Parameters
smNAT main
rtNAT runtime data
sw_if_index0index of the inside interface
ip0IPv4 header
proto0NAT protocol
rx_fib_index0RX FIB index
Returns
0 if packet should be translated otherwise 1

Definition at line 700 of file nat_inlines.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ snat_random_port()

static_always_inline u16 snat_random_port ( u16  min,
u16  max 
)

Definition at line 766 of file nat_inlines.h.

+ Here is the call graph for this function:

◆ split_ed_kv()

static void split_ed_kv ( clib_bihash_kv_16_8_t kv,
ip4_address_t l_addr,
ip4_address_t r_addr,
u8 proto,
u32 fib_index,
u16 l_port,
u16 r_port 
)
inlinestatic

Definition at line 517 of file nat_inlines.h.

+ Here is the caller graph for this function:

◆ split_ed_value()

static void split_ed_value ( clib_bihash_kv_16_8_t value,
u32 thread_index,
u32 session_index 
)
inlinestatic

Definition at line 503 of file nat_inlines.h.

+ Here is the call graph for this function:

◆ split_nat_key()

static void split_nat_key ( u64  key,
ip4_address_t addr,
u16 port,
u32 fib_index,
nat_protocol_t proto 
)
inlinestatic

Definition at line 36 of file nat_inlines.h.

+ Here is the caller graph for this function:

◆ user_session_increment()

static void user_session_increment ( snat_main_t sm,
snat_user_t u,
u8  is_static 
)
inlinestatic

Definition at line 241 of file nat_inlines.h.

+ Here is the caller graph for this function: