FD.io VPP  v18.07.1-19-g511ce25
Vector Packet Processing
nat_reass.c File Reference

NAT plugin virtual fragmentation reassembly. More...

+ Include dependency graph for nat_reass.c:

Go to the source code of this file.

Functions

static u32 nat_reass_get_nbuckets (u8 is_ip6)
 
static_always_inline void nat_ip4_reass_get_frags_inline (nat_reass_ip4_t *reass, u32 **bi)
 
static_always_inline void nat_ip6_reass_get_frags_inline (nat_reass_ip6_t *reass, u32 **bi)
 
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...
 
static_always_inline nat_reass_ip4_t * nat_ip4_reass_lookup (nat_reass_ip4_key_t *k, f64 now)
 
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_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 (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...
 
static_always_inline nat_reass_ip6_t * nat_ip6_reass_lookup (nat_reass_ip6_key_t *k, f64 now)
 
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 (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...
 
clib_error_tnat_reass_init (vlib_main_t *vm)
 Initialize NAT virtual fragmentation reassembly. More...
 
static clib_error_tnat_reass_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static int nat_ip4_reass_walk_cli (nat_reass_ip4_t *reass, void *ctx)
 
static int nat_ip6_reass_walk_cli (nat_reass_ip6_t *reass, void *ctx)
 
static clib_error_tshow_nat_reass_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 

Variables

nat_reass_main_t nat_reass_main
 
static vlib_cli_command_t nat_reass_command
 (constructor) VLIB_CLI_COMMAND (nat_reass_command) More...
 
static vlib_cli_command_t show_nat_reass_command
 (constructor) VLIB_CLI_COMMAND (show_nat_reass_command) More...
 

Detailed Description

NAT plugin virtual fragmentation reassembly.

Definition in file nat_reass.c.

Function Documentation

int nat_ip4_reass_add_fragment ( 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 336 of file nat_reass.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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_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 220 of file nat_reass.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 368 of file nat_reass.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static_always_inline void nat_ip4_reass_get_frags_inline ( nat_reass_ip4_t *  reass,
u32 **  bi 
)

Definition at line 47 of file nat_reass.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static_always_inline nat_reass_ip4_t* nat_ip4_reass_lookup ( nat_reass_ip4_key_t k,
f64  now 
)

Definition at line 179 of file nat_reass.c.

+ Here is the caller graph for this function:

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 380 of file nat_reass.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int nat_ip4_reass_walk_cli ( nat_reass_ip4_t *  reass,
void *  ctx 
)
static

Definition at line 724 of file nat_reass.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int nat_ip6_reass_add_fragment ( 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 542 of file nat_reass.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 424 of file nat_reass.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 574 of file nat_reass.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static_always_inline void nat_ip6_reass_get_frags_inline ( nat_reass_ip6_t *  reass,
u32 **  bi 
)

Definition at line 66 of file nat_reass.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static_always_inline nat_reass_ip6_t* nat_ip6_reass_lookup ( nat_reass_ip6_key_t k,
f64  now 
)

Definition at line 399 of file nat_reass.c.

+ Here is the caller graph for this function:

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 586 of file nat_reass.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int nat_ip6_reass_walk_cli ( nat_reass_ip6_t *  reass,
void *  ctx 
)
static

Definition at line 738 of file nat_reass.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 662 of file nat_reass.c.

+ Here is the call graph for this function:

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:

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:

static u32 nat_reass_get_nbuckets ( u8  is_ip6)
static

Definition at line 27 of file nat_reass.c.

+ Here is the caller graph for this function:

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:

clib_error_t* nat_reass_init ( vlib_main_t vm)

Initialize NAT virtual fragmentation reassembly.

Parameters
vmvlib main.
Returns
error code.

Definition at line 605 of file nat_reass.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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:

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:

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

Definition at line 752 of file nat_reass.c.

+ Here is the call graph for this function:

Variable Documentation

vlib_cli_command_t nat_reass_command
static
Initial value:
=
{
.path = "nat virtual-reassembly",
.short_help = "nat virtual-reassembly ip4|ip6 [max-reassemblies <n>] "
"[max-fragments <n>] [timeout <sec>] [enable|disable]",
.function = nat_reass_command_fn,
}
static clib_error_t * nat_reass_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: nat_reass.c:662

(constructor) VLIB_CLI_COMMAND (nat_reass_command)

Definition at line 775 of file nat_reass.c.

nat_reass_main_t nat_reass_main

Definition at line 24 of file nat_reass.c.

vlib_cli_command_t show_nat_reass_command
static
Initial value:
=
{
.path = "show nat virtual-reassembly",
.short_help = "show nat virtual-reassembly",
}
static clib_error_t * show_nat_reass_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: nat_reass.c:752

(constructor) VLIB_CLI_COMMAND (show_nat_reass_command)

Definition at line 783 of file nat_reass.c.