FD.io VPP  v19.04.4-rc0-5-ge88582fac
Vector Packet Processing
nat_reass.h File Reference

NAT plugin virtual fragmentation reassembly. More...

+ Include dependency graph for nat_reass.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  nat_reass_ip4_key_t
 
struct  nat_reass_ip6_key_t
 
struct  nat_reass_main_t
 

Macros

#define NAT_REASS_TIMEOUT_DEFAULT   2
 
#define NAT_MAX_REASS_DEAFULT   1024
 
#define NAT_MAX_FRAG_DEFAULT   5
 
#define NAT_REASS_HT_LOAD_FACTOR   (0.75)
 
#define NAT_REASS_FLAG_MAX_FRAG_DROP   1
 
#define NAT_REASS_FLAG_CLASSIFY_ED_CONTINUE   2
 
#define NAT_REASS_FLAG_ED_DONT_TRANSLATE   4
 

Typedefs

typedef int(* nat_ip4_reass_walk_fn_t) (nat_reass_ip4_t *reass, void *ctx)
 Call back function when walking IPv4 reassemblies, non-zero return value stop walk. More...
 
typedef int(* nat_ip6_reass_walk_fn_t) (nat_reass_ip6_t *reass, void *ctx)
 Call back function when walking IPv6 reassemblies, non-zero return value stop walk. More...
 

Enumerations

enum  { NAT_REASS_IP4_CLASSIFY_NONE, NAT_REASS_IP4_CLASSIFY_NEXT_IN2OUT, NAT_REASS_IP4_CLASSIFY_NEXT_OUT2IN }
 

Functions

typedef CLIB_PACKED (struct { nat_reass_ip4_key_t key;u32 lru_list_index;u32 sess_index;u32 thread_index;f64 last_heard;u32 frags_per_reass_list_head_index;u8 frag_n;u8 flags;u8 classify_next;}) nat_reass_ip4_t
 
typedef CLIB_PACKED (struct { nat_reass_ip6_key_t key;u32 lru_list_index;u32 sess_index;f64 last_heard;u32 frags_per_reass_list_head_index;u8 frag_n;u8 flags;}) nat_reass_ip6_t
 
int nat_reass_set (u32 timeout, u16 max_reass, u8 max_frag, u8 drop_frag, u8 is_ip6)
 Set NAT virtual fragmentation reassembly configuration. More...
 
u32 nat_reass_get_timeout (u8 is_ip6)
 Get reassembly timeout. More...
 
u16 nat_reass_get_max_reass (u8 is_ip6)
 Get maximum number of concurrent reassemblies. More...
 
u8 nat_reass_get_max_frag (u8 is_ip6)
 Get maximum number of fragmets per reassembly. More...
 
u8 nat_reass_is_drop_frag (u8 is_ip6)
 Get status of virtual fragmentation reassembly. More...
 
clib_error_tnat_reass_init (vlib_main_t *vm)
 Initialize NAT virtual fragmentation reassembly. More...
 
nat_reass_ip4_t * nat_ip4_reass_find (ip4_address_t src, ip4_address_t dst, u16 frag_id, u8 proto)
 Find reassembly. More...
 
nat_reass_ip4_t * nat_ip4_reass_create (ip4_address_t src, ip4_address_t dst, u16 frag_id, u8 proto)
 Create reassembly. More...
 
nat_reass_ip4_t * nat_ip4_reass_find_or_create (ip4_address_t src, ip4_address_t dst, u16 frag_id, u8 proto, u8 reset_timeout, u32 **bi_to_drop)
 Find or create reassembly. More...
 
int nat_ip4_reass_add_fragment (u32 thread_index, nat_reass_ip4_t *reass, u32 bi, u32 **bi_to_drop)
 Cache fragment. More...
 
void nat_ip4_reass_get_frags (nat_reass_ip4_t *reass, u32 **bi)
 Get cached fragments. More...
 
void nat_ip4_reass_walk (nat_ip4_reass_walk_fn_t fn, void *ctx)
 Walk IPv4 reassemblies. More...
 
nat_reass_ip6_t * nat_ip6_reass_find_or_create (ip6_address_t src, ip6_address_t dst, u32 frag_id, u8 proto, u8 reset_timeout, u32 **bi_to_drop)
 Find or create reassembly. More...
 
int nat_ip6_reass_add_fragment (u32 thread_index, nat_reass_ip6_t *reass, u32 bi, u32 **bi_to_drop)
 Cache fragment. More...
 
void nat_ip6_reass_get_frags (nat_reass_ip6_t *reass, u32 **bi)
 Get cached fragments. More...
 
void nat_ip6_reass_walk (nat_ip6_reass_walk_fn_t fn, void *ctx)
 Walk IPv6 reassemblies. More...
 

Detailed Description

NAT plugin virtual fragmentation reassembly.

Definition in file nat_reass.h.

Macro Definition Documentation

◆ NAT_MAX_FRAG_DEFAULT

#define NAT_MAX_FRAG_DEFAULT   5

Definition at line 30 of file nat_reass.h.

◆ NAT_MAX_REASS_DEAFULT

#define NAT_MAX_REASS_DEAFULT   1024

Definition at line 29 of file nat_reass.h.

◆ NAT_REASS_FLAG_CLASSIFY_ED_CONTINUE

#define NAT_REASS_FLAG_CLASSIFY_ED_CONTINUE   2

Definition at line 34 of file nat_reass.h.

◆ NAT_REASS_FLAG_ED_DONT_TRANSLATE

#define NAT_REASS_FLAG_ED_DONT_TRANSLATE   4

Definition at line 35 of file nat_reass.h.

◆ NAT_REASS_FLAG_MAX_FRAG_DROP

#define NAT_REASS_FLAG_MAX_FRAG_DROP   1

Definition at line 33 of file nat_reass.h.

◆ NAT_REASS_HT_LOAD_FACTOR

#define NAT_REASS_HT_LOAD_FACTOR   (0.75)

Definition at line 31 of file nat_reass.h.

◆ NAT_REASS_TIMEOUT_DEFAULT

#define NAT_REASS_TIMEOUT_DEFAULT   2

Definition at line 28 of file nat_reass.h.

Typedef Documentation

◆ nat_ip4_reass_walk_fn_t

typedef int(* nat_ip4_reass_walk_fn_t) (nat_reass_ip4_t *reass, void *ctx)

Call back function when walking IPv4 reassemblies, non-zero return value stop walk.

Definition at line 271 of file nat_reass.h.

◆ nat_ip6_reass_walk_fn_t

typedef int(* nat_ip6_reass_walk_fn_t) (nat_reass_ip6_t *reass, void *ctx)

Call back function when walking IPv6 reassemblies, non-zero return value stop walk.

Definition at line 322 of file nat_reass.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
NAT_REASS_IP4_CLASSIFY_NONE 
NAT_REASS_IP4_CLASSIFY_NEXT_IN2OUT 
NAT_REASS_IP4_CLASSIFY_NEXT_OUT2IN 

Definition at line 54 of file nat_reass.h.

Function Documentation

◆ CLIB_PACKED() [1/2]

typedef CLIB_PACKED ( struct { nat_reass_ip4_key_t key;u32 lru_list_index;u32 sess_index;u32 thread_index;f64 last_heard;u32 frags_per_reass_list_head_index;u8 frag_n;u8 flags;u8 classify_next;}  )

◆ CLIB_PACKED() [2/2]

typedef CLIB_PACKED ( struct { nat_reass_ip6_key_t key;u32 lru_list_index;u32 sess_index;f64 last_heard;u32 frags_per_reass_list_head_index;u8 frag_n;u8 flags;}  )

◆ nat_ip4_reass_add_fragment()

int nat_ip4_reass_add_fragment ( u32  thread_index,
nat_reass_ip4_t *  reass,
u32  bi,
u32 **  bi_to_drop 
)

Cache fragment.

Parameters
reassReassembly data.
biBuffer index.
bi_to_dropFragments to drop.
Returns
0 on success, non-zero value otherwise.

Definition at line 392 of file nat_reass.c.

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

◆ nat_ip4_reass_create()

nat_reass_ip4_t* nat_ip4_reass_create ( ip4_address_t  src,
ip4_address_t  dst,
u16  frag_id,
u8  proto 
)

Create reassembly.

Parameters
srcSource IPv4 address.
dstDestination IPv4 address.
frag_idFragment ID.
protoL4 protocol.
Returns
Reassembly data or 0 on failure.

Definition at line 220 of file nat_reass.c.

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

◆ nat_ip4_reass_find()

nat_reass_ip4_t* nat_ip4_reass_find ( ip4_address_t  src,
ip4_address_t  dst,
u16  frag_id,
u8  proto 
)

Find reassembly.

Parameters
srcSource IPv4 address.
dstDestination IPv4 address.
frag_idFragment ID.
protoL4 protocol.
Returns
Reassembly data or 0 if not found.

Definition at line 199 of file nat_reass.c.

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

◆ nat_ip4_reass_find_or_create()

nat_reass_ip4_t* nat_ip4_reass_find_or_create ( ip4_address_t  src,
ip4_address_t  dst,
u16  frag_id,
u8  proto,
u8  reset_timeout,
u32 **  bi_to_drop 
)

Find or create reassembly.

Parameters
srcSource IPv4 address.
dstDestination IPv4 address.
frag_idFragment ID.
protoL4 protocol.
reset_timeoutIf non-zero value reset timeout.
bi_to_dropFragments to drop.
Returns
Reassembly data or 0 on failure.

Definition at line 274 of file nat_reass.c.

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

◆ nat_ip4_reass_get_frags()

void nat_ip4_reass_get_frags ( nat_reass_ip4_t *  reass,
u32 **  bi 
)

Get cached fragments.

Parameters
reassReassembly data.
biVector of buffer indexes.

Definition at line 424 of file nat_reass.c.

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

◆ nat_ip4_reass_walk()

void nat_ip4_reass_walk ( nat_ip4_reass_walk_fn_t  fn,
void *  ctx 
)

Walk IPv4 reassemblies.

Parameters
fnThe function to invoke on each entry visited.
ctxA context passed in the visit function.

Definition at line 436 of file nat_reass.c.

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

◆ nat_ip6_reass_add_fragment()

int nat_ip6_reass_add_fragment ( u32  thread_index,
nat_reass_ip6_t *  reass,
u32  bi,
u32 **  bi_to_drop 
)

Cache fragment.

Parameters
reassReassembly data.
biBuffer index.
bi_to_dropFragments to drop.
Returns
0 on success, non-zero value otherwise.

Definition at line 598 of file nat_reass.c.

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

◆ nat_ip6_reass_find_or_create()

nat_reass_ip6_t* nat_ip6_reass_find_or_create ( ip6_address_t  src,
ip6_address_t  dst,
u32  frag_id,
u8  proto,
u8  reset_timeout,
u32 **  bi_to_drop 
)

Find or create reassembly.

Parameters
srcSource IPv6 address.
dstDestination IPv6 address.
frag_idFragment ID.
protoL4 protocol.
reset_timeoutIf non-zero value reset timeout.
bi_to_dropFragments to drop.
Returns
Reassembly data or 0 on failure.

Definition at line 480 of file nat_reass.c.

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

◆ nat_ip6_reass_get_frags()

void nat_ip6_reass_get_frags ( nat_reass_ip6_t *  reass,
u32 **  bi 
)

Get cached fragments.

Parameters
reassReassembly data.
biVector of buffer indexes.

Definition at line 630 of file nat_reass.c.

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

◆ nat_ip6_reass_walk()

void nat_ip6_reass_walk ( nat_ip6_reass_walk_fn_t  fn,
void *  ctx 
)

Walk IPv6 reassemblies.

Parameters
fnThe function to invoke on each entry visited.
ctxA context passed in the visit function.

Definition at line 642 of file nat_reass.c.

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

◆ nat_reass_get_max_frag()

u8 nat_reass_get_max_frag ( u8  is_ip6)

Get maximum number of fragmets per reassembly.

Parameters
is_ip61 if IPv6, 0 if IPv4.
Returns
maximum number of fragmets per reassembly.

Definition at line 157 of file nat_reass.c.

+ Here is the caller graph for this function:

◆ nat_reass_get_max_reass()

u16 nat_reass_get_max_reass ( u8  is_ip6)

Get maximum number of concurrent reassemblies.

Parameters
is_ip61 if IPv6, 0 if IPv4.
Returns
maximum number of concurrent reassemblies.

Definition at line 146 of file nat_reass.c.

+ Here is the caller graph for this function:

◆ nat_reass_get_timeout()

u32 nat_reass_get_timeout ( u8  is_ip6)

Get reassembly timeout.

Parameters
is_ip61 if IPv6, 0 if IPv4.
Returns
reassembly timeout.

Definition at line 135 of file nat_reass.c.

+ Here is the caller graph for this function:

◆ nat_reass_init()

clib_error_t* nat_reass_init ( vlib_main_t vm)

Initialize NAT virtual fragmentation reassembly.

Parameters
vmvlib main.
Returns
error code.

Definition at line 661 of file nat_reass.c.

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

◆ nat_reass_is_drop_frag()

u8 nat_reass_is_drop_frag ( u8  is_ip6)

Get status of virtual fragmentation reassembly.

Parameters
is_ip61 if IPv6, 0 if IPv4.
Returns
zero if translate fragments, non-zero value if drop fragments.

Definition at line 168 of file nat_reass.c.

+ Here is the caller graph for this function:

◆ nat_reass_set()

int nat_reass_set ( u32  timeout,
u16  max_reass,
u8  max_frag,
u8  drop_frag,
u8  is_ip6 
)

Set NAT virtual fragmentation reassembly configuration.

Parameters
timeoutReassembly timeout.
max_reassMaximum number of concurrent reassemblies.
max_fragMaximum number of fragmets per reassembly
drop_fragIf zero translate fragments, otherwise drop fragments.
is_ip61 if IPv6, 0 if IPv4.
Returns
0 on success, non-zero value otherwise.

Definition at line 85 of file nat_reass.c.

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