FD.io VPP  v20.09-64-g4f7b92f0a
Vector Packet Processing
cnat_translation.c File Reference
+ Include dependency graph for cnat_translation.c:

Go to the source code of this file.

Functions

static void cnat_tracker_release (cnat_ep_trk_t *trk)
 
static void cnat_tracker_track (index_t cti, const cnat_endpoint_tuple_t *path, cnat_ep_trk_t *trk)
 
void cnat_add_translation_to_db (index_t cci, u16 port, ip_protocol_t proto, index_t cti)
 Add a translation to the bihash. More...
 
void cnat_remove_translation_from_db (index_t cci, u16 port, ip_protocol_t proto)
 Remove a translation from the bihash. More...
 
static void cnat_translation_stack (cnat_translation_t *ct)
 
int cnat_translation_delete (u32 id)
 Delete a translation. More...
 
u32 cnat_translation_update (const cnat_endpoint_t *vip, ip_protocol_t proto, const cnat_endpoint_tuple_t *paths, u8 flags)
 create or update a translation More...
 
void cnat_translation_walk (cnat_translation_walk_cb_t cb, void *ctx)
 Walk/visit each of the translations. More...
 
static u8format_cnat_ep_trk (u8 *s, va_list *args)
 
u8format_cnat_translation (u8 *s, va_list *args)
 
static clib_error_tcnat_translation_show (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
int cnat_translation_purge (void)
 Purge all the trahslations. More...
 
static fib_node_tcnat_translation_get_node (fib_node_index_t index)
 
static cnat_translation_tcnat_translation_get_from_node (fib_node_t *node)
 
static void cnat_translation_last_lock_gone (fib_node_t *node)
 
static fib_node_back_walk_rc_t cnat_translation_back_walk_notify (fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
 
static clib_error_tcnat_translation_cli_add_del (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tcnat_translation_init (vlib_main_t *vm)
 

Variables

cnat_translation_tcnat_translation_pool
 
clib_bihash_8_8_t cnat_translation_db
 
static fib_node_type_t cnat_translation_fib_node_type
 
vlib_combined_counter_main_t cnat_translation_counters
 Counters for each translation. More...
 
static vlib_cli_command_t cnat_translation_show_cmd_node
 (constructor) VLIB_CLI_COMMAND (cnat_translation_show_cmd_node) More...
 
static const fib_node_vft_t cnat_translation_vft
 
static vlib_cli_command_t cnat_translation_cli_add_del_command
 (constructor) VLIB_CLI_COMMAND (cnat_translation_cli_add_del_command) More...
 

Function Documentation

◆ cnat_add_translation_to_db()

void cnat_add_translation_to_db ( index_t  cci,
u16  port,
ip_protocol_t  proto,
index_t  cti 
)

Add a translation to the bihash.

Parameters
ccithe ID of the parent client
portthe translation port
protothe translation proto
ctithe translation index to be used as value

Definition at line 66 of file cnat_translation.c.

+ Here is the caller graph for this function:

◆ cnat_remove_translation_from_db()

void cnat_remove_translation_from_db ( index_t  cci,
u16  port,
ip_protocol_t  proto 
)

Remove a translation from the bihash.

Parameters
ccithe ID of the parent client
portthe translation port
protothe translation proto

Definition at line 82 of file cnat_translation.c.

+ Here is the caller graph for this function:

◆ cnat_tracker_release()

static void cnat_tracker_release ( cnat_ep_trk_t trk)
static

Definition at line 37 of file cnat_translation.c.

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

◆ cnat_tracker_track()

static void cnat_tracker_track ( index_t  cti,
const cnat_endpoint_tuple_t path,
cnat_ep_trk_t trk 
)
static

Definition at line 43 of file cnat_translation.c.

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

◆ cnat_translation_back_walk_notify()

static fib_node_back_walk_rc_t cnat_translation_back_walk_notify ( fib_node_t node,
fib_node_back_walk_ctx_t ctx 
)
static

Definition at line 337 of file cnat_translation.c.

+ Here is the call graph for this function:

◆ cnat_translation_cli_add_del()

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

Definition at line 360 of file cnat_translation.c.

+ Here is the call graph for this function:

◆ cnat_translation_delete()

int cnat_translation_delete ( u32  id)

Delete a translation.

Parameters
idthe ID as returned from the create

Definition at line 117 of file cnat_translation.c.

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

◆ cnat_translation_get_from_node()

static cnat_translation_t* cnat_translation_get_from_node ( fib_node_t node)
static

Definition at line 321 of file cnat_translation.c.

+ Here is the caller graph for this function:

◆ cnat_translation_get_node()

static fib_node_t* cnat_translation_get_node ( fib_node_index_t  index)
static

Definition at line 314 of file cnat_translation.c.

+ Here is the call graph for this function:

◆ cnat_translation_init()

static clib_error_t* cnat_translation_init ( vlib_main_t vm)
static

Definition at line 411 of file cnat_translation.c.

+ Here is the call graph for this function:

◆ cnat_translation_last_lock_gone()

static void cnat_translation_last_lock_gone ( fib_node_t node)
static

Definition at line 329 of file cnat_translation.c.

◆ cnat_translation_purge()

int cnat_translation_purge ( void  )

Purge all the trahslations.

Definition at line 283 of file cnat_translation.c.

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

◆ cnat_translation_show()

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

Definition at line 247 of file cnat_translation.c.

+ Here is the call graph for this function:

◆ cnat_translation_stack()

static void cnat_translation_stack ( cnat_translation_t ct)
static

Definition at line 96 of file cnat_translation.c.

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

◆ cnat_translation_update()

u32 cnat_translation_update ( const cnat_endpoint_t vip,
ip_protocol_t  ip_proto,
const cnat_endpoint_tuple_t backends,
u8  flags 
)

create or update a translation

Parameters
vipThe Virtual Endpoint
ip_protoThe ip protocol to translate
backendsthe backends to choose from
Returns
the ID of the translation. used to delete and gather stats

Definition at line 140 of file cnat_translation.c.

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

◆ cnat_translation_walk()

void cnat_translation_walk ( cnat_translation_walk_cb_t  cb,
void *  ctx 
)

Walk/visit each of the translations.

Definition at line 194 of file cnat_translation.c.

+ Here is the caller graph for this function:

◆ format_cnat_ep_trk()

static u8* format_cnat_ep_trk ( u8 s,
va_list *  args 
)
static

Definition at line 208 of file cnat_translation.c.

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

◆ format_cnat_translation()

u8* format_cnat_translation ( u8 s,
va_list *  args 
)

Definition at line 223 of file cnat_translation.c.

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

Variable Documentation

◆ cnat_translation_cli_add_del_command

vlib_cli_command_t cnat_translation_cli_add_del_command
static
Initial value:
=
{
.path = "cnat translation",
.short_help = "cnat translation [add|del] proto [TCP|UDP] [vip|real] [ip] [port] [to [ip] [port]->[ip] [port]]",
}
static clib_error_t * cnat_translation_cli_add_del(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)

(constructor) VLIB_CLI_COMMAND (cnat_translation_cli_add_del_command)

Definition at line 402 of file cnat_translation.c.

◆ cnat_translation_counters

vlib_combined_counter_main_t cnat_translation_counters
Initial value:
= {
.name = "cnat-translation",
.stat_segment_name = "/net/cnat-translation",
}

Counters for each translation.

Definition at line 31 of file cnat_translation.c.

◆ cnat_translation_db

clib_bihash_8_8_t cnat_translation_db

Definition at line 27 of file cnat_translation.c.

◆ cnat_translation_fib_node_type

fib_node_type_t cnat_translation_fib_node_type
static

Definition at line 29 of file cnat_translation.c.

◆ cnat_translation_pool

cnat_translation_t* cnat_translation_pool

Definition at line 26 of file cnat_translation.c.

◆ cnat_translation_show_cmd_node

vlib_cli_command_t cnat_translation_show_cmd_node
static
Initial value:
= {
.path = "show cnat translation",
.function = cnat_translation_show,
.short_help = "show cnat translation <VIP>",
.is_mp_safe = 1,
}
static clib_error_t * cnat_translation_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)

(constructor) VLIB_CLI_COMMAND (cnat_translation_show_cmd_node)

Definition at line 305 of file cnat_translation.c.

◆ cnat_translation_vft

const fib_node_vft_t cnat_translation_vft
static
Initial value:
= {
}
static fib_node_back_walk_rc_t cnat_translation_back_walk_notify(fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
static void cnat_translation_last_lock_gone(fib_node_t *node)
static fib_node_t * cnat_translation_get_node(fib_node_index_t index)

Definition at line 353 of file cnat_translation.c.