|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
81 cc = (AF_IP4 == addr->version ? cnat_client_ip4_find (&ip_addr_v4 (addr)) :
82 cnat_client_ip6_find (&ip_addr_v6 (addr)));
86 cnat_client_t *ccp = cnat_client_get (cc->parent_cci);
87 clib_atomic_add_fetch (&ccp->session_refcnt, refcnt);
88 vec_add1 (del_vec, *addr);
250 u32 indent = va_arg (*args,
u32);
254 s =
format (s,
"[%d] cnat-client:[%U] tr:%d sess:%d", cci,
259 s =
format (s,
" exclusive");
262 s =
format (s,
"\n%Uclone of [%d]\n%U%U",
305 .path =
"show cnat client",
307 .short_help =
"show cnat client",
357 u32 indent = va_arg (*ap,
u32);
378 sizeof (ip6_address_t),
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
static void clib_spinlock_init(clib_spinlock_t *p)
static_always_inline cnat_client_t * cnat_client_ip6_find(const ip6_address_t *ip)
Find a client from an IP6 address.
dpo_type_t dpo_register_new_type(const dpo_vft_t *vft, const char *const *const *nodes)
Create and register a new DPO type.
index_t dpoi_index
the index of objects of that type
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
fib_node_index_t fib_table_entry_special_dpo_add(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, const dpo_id_t *dpo)
Add a 'special' entry to the FIB that links to the DPO passed A special entry is an entry that the FI...
static void cnat_client_db_add(cnat_client_t *cc)
void cnat_client_throttle_pool_process()
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
u8 * format_cnat_client(u8 *s, va_list *args)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static_always_inline u32 cnat_client_cnt_session(cnat_client_t *cc)
Add a session refcnt to this client.
static_always_inline u8 cnat_client_is_clone(cnat_client_t *cc)
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P with alignment A.
void cnat_client_learn(const ip_address_t *addr)
Called in the main thread by RPC from the workers to learn a new client.
#define clib_error_return(e, args...)
#define FIB_NODE_INDEX_INVALID
void ip_address_to_fib_prefix(const ip_address_t *addr, fib_prefix_t *prefix)
convert from a IP address to a FIB prefix
cnat_timestamp_t * cnat_timestamps
#define pool_put(P, E)
Free an object E in pool P.
static_always_inline cnat_client_t * cnat_client_ip4_find(const ip4_address_t *ip)
Find a client from an IP4 address.
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
cnat_client_t * cnat_client_pool
@ FIB_ENTRY_FLAG_EXCLUSIVE
@ FIB_ENTRY_FLAG_INTERPOSE
void cnat_client_translation_added(index_t cci)
A translation that references this VIP was added.
const static char *const cnat_client_dpo_ip4_nodes[]
ip_address_t cc_ip
the client's IP address
dpo_id_t cc_parent
How to send packets to this client post translation.
static void cnat_client_dpo_interpose(const dpo_id_t *original, const dpo_id_t *parent, dpo_id_t *clone)
Interpose a policy DPO.
u32 cc_locks
number of DPO locks
@ FIB_ENTRY_FLAG_LOOSE_URPF_EXEMPT
#define hash_set(h, key, value)
#define ip_addr_version(_a)
void dpo_stack(dpo_type_t child_type, dpo_proto_t child_proto, dpo_id_t *dpo, const dpo_id_t *parent)
Stack one DPO object on another, and thus establish a child-parent relationship.
const static char *const cnat_client_dpo_ip6_nodes[]
index_t parent_cci
Parent cnat_client index if cloned via interpose or own index if vanilla client.
static void cnat_client_destroy(cnat_client_t *cc)
u32 session_refcnt
Session refcount for cleanup.
static_always_inline void clib_spinlock_lock(clib_spinlock_t *p)
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
#define static_always_inline
u32 fib_node_index_t
A typedef of a node index.
u8 * format_ip_address(u8 *s, va_list *args)
void cnat_client_free_by_ip(ip46_address_t *ip, u8 af)
static void hash_unset_mem_free(uword **h, const void *key)
#define hash_create_mem(elts, key_bytes, value_bytes)
enum dpo_type_t_ dpo_type_t
Common types of data-path objects New types can be dynamically added using dpo_register_new_type()
static void hash_set_mem_alloc(uword **h, const void *key, uword v)
#define VLIB_CLI_COMMAND(x,...)
dpo_lock_fn_t dv_lock
A reference counting lock function.
u8 * format_cnat_client_dpo(u8 *s, va_list *ap)
#define CLIB_CACHE_LINE_BYTES
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
dpo_proto_t dpoi_proto
the data-path protocol of the type.
dpo_proto_t fib_proto_to_dpo(fib_protocol_t fib_proto)
cnat_client_db_t cnat_client_db
u8 * format_dpo_id(u8 *s, va_list *args)
Format a DPO_id_t oject.
index_t cnat_client_add(const ip_address_t *ip, u8 flags)
static uword hash_elts(void *v)
#define pool_foreach_index(i, v)
u32 tr_refcnt
Translations refcount for cleanup.
int fib_entry_is_sourced(fib_node_index_t fib_entry_index, fib_source_t source)
description fragment has unexpected format
const static char *const *const cnat_client_dpo_nodes[DPO_PROTO_NUM]
static_always_inline u32 cnat_client_uncnt_session(cnat_client_t *cc)
Del a session refcnt to this client.
fib_source_t cnat_fib_source
#define VLIB_INIT_FUNCTION(x)
fib_node_index_t cc_fei
the FIB entry this client sources
#define vec_foreach(var, vec)
Vector iterator.
static uword pool_elts(void *v)
Number of active elements in a pool.
static_always_inline void clib_spinlock_unlock(clib_spinlock_t *p)
fib_protocol_t fp_proto
protocol type
dpo_type_t cnat_client_dpo
static void cnat_client_dpo_lock(dpo_id_t *dpo)
#define hash_unset(h, key)
int cnat_client_purge(void)
Check all the clients were purged by translation & session purge.
static_always_inline cnat_client_t * cnat_client_get(index_t i)
const dpo_id_t * drop_dpo_get(dpo_proto_t proto)
A virtual function table regisitered for a DPO type.
#define pool_get_zero(P, E)
Allocate an object E from a pool P and zero it.
static void cnat_client_db_remove(cnat_client_t *cc)
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
static vlib_cli_command_t cnat_client_show_cmd_node
(constructor) VLIB_CLI_COMMAND (cnat_client_show_cmd_node)
#define clib_warning(format, args...)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
void fib_table_entry_delete_index(fib_node_index_t fib_entry_index, fib_source_t source)
Delete a FIB entry.
static clib_error_t * cnat_client_init(vlib_main_t *vm)
void dpo_set(dpo_id_t *dpo, dpo_type_t type, dpo_proto_t proto, index_t index)
Set/create a DPO ID The DPO will be locked.
#define hash_foreach_mem(key_var, value_var, h, body)
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
void ip_address_copy(ip_address_t *dst, const ip_address_t *src)
A client is a representation of an IP address behind the NAT.
static void cnat_client_dpo_unlock(dpo_id_t *dpo)
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
const static dpo_vft_t cnat_client_dpo_vft
Aggregate type for a prefix.
void cnat_client_translation_deleted(index_t cci)
A translation that references this VIP was deleted.
static clib_error_t * cnat_client_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
clib_spinlock_t throttle_lock
vl_api_wireguard_peer_flags_t flags