57 s =
format (s,
"created: %U\n tr: %U",
63 s =
format (s,
"not found");
100 if (iproto != IP_PROTOCOL_UDP && iproto != IP_PROTOCOL_TCP
101 && iproto != IP_PROTOCOL_ICMP && iproto != IP_PROTOCOL_ICMP6)
138 clib_host_to_net_u16 (udp0->
dst_port), iproto);
150 u32 hash_c0, bucket0;
151 u32 rsession_flags = 0;
199 rv = cspm->
vip_policy (vm, b, session, &rsession_flags, ct, ctx);
201 rv = cspm->
default_policy (vm, b, session, &rsession_flags, ct, ctx);
206 CNAT_ERROR_EXHAUSTED_PORTS, 1);
275 .name =
"ip4-cnat-tx",
276 .vector_size =
sizeof (
u32),
289 .name =
"ip6-cnat-tx",
290 .vector_size =
sizeof (
u32),
u16 lb_n_buckets
number of buckets in the load-balance.
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
vlib_node_registration_t cnat_vip_ip6_node
(constructor) VLIB_REGISTER_NODE (cnat_vip_ip6_node)
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 thread_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
static_always_inline cnat_translation_t * cnat_translation_get(index_t cti)
static u32 ip4_compute_flow_hash(const ip4_header_t *ip, flow_hash_config_t flow_hash_config)
cnat_src_policy_main_t cnat_src_policy_main
flow_hash_config_t lb_hash_config
the hash config to use when selecting a bucket.
static const dpo_id_t * load_balance_get_fwd_bucket(const load_balance_t *lb, u16 bucket)
u16 cs_port[VLIB_N_DIR]
ports in rx/tx
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
u8 * format_cnat_session(u8 *s, va_list *args)
dpo_id_t cc_parent
How to send packets to this client post translation.
A Translation represents the translation of a VEP to one of a set of real server addresses.
enum cnat_translation_next_t_ cnat_translation_next_t
index_t parent_cci
Parent cnat_client index if cloned via interpose or own index if vanilla client.
static_always_inline void ip46_address_set_ip6(ip46_address_t *dst, const ip6_address_t *src)
#define VLIB_NODE_FN(node)
static void cnat_timestamp_update(u32 index, f64 t)
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
cnat_translation_t * cnat_translation_pool
#define clib_memcpy(d, s, n)
A session represents the memory of a translation.
static_always_inline cnat_translation_t * cnat_find_translation(index_t cti, u16 port, ip_protocol_t proto)
description fragment has unexpected format
ip46_address_t cs_ip[VLIB_N_DIR]
IP 4/6 address in the rx/tx direction.
u32 cs_ts_index
Timestamp index this session was last used.
vl_api_fib_path_type_t type
Indicates a return path session that was source NATed on the way in.
static_always_inline u32 cnat_client_cnt_session(cnat_client_t *cc)
Add a session refcnt to this client.
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
enum ip_protocol ip_protocol_t
static_always_inline void ip46_address_copy(ip46_address_t *dst, const ip46_address_t *src)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
bool ip_address_is_zero(const ip_address_t *ip)
static_always_inline void cnat_translation_ip6(const cnat_session_t *session, ip6_header_t *ip6, udp_header_t *udp)
cnat_ep_trk_t * ct_paths
The vector of tracked back-ends.
u32 ct_index
Persist translation->ct_lb.dpoi_next_node when cs_lbi != INDEX_INVALID.
index_t cs_lbi
The load balance object to use to forward.
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
static_always_inline cnat_client_t * cnat_client_get(index_t i)
cnat_vip_source_policy_t default_policy
#define VLIB_REGISTER_NODE(x,...)
cnat_endpoint_t ct_ep[VLIB_N_DIR]
The EP being tracked.
static u8 * format_cnat_translation_trace(u8 *s, va_list *args)
struct cnat_translation_trace_t_ cnat_translation_trace_t
vlib_node_registration_t cnat_vip_ip4_node
(constructor) VLIB_REGISTER_NODE (cnat_vip_ip4_node)
vlib_main_t vlib_node_runtime_t * node
u32 flags
session flags if cs_lbi == INDEX_INVALID
static_always_inline void cnat_translation_ip4(const cnat_session_t *session, ip4_header_t *ip4, udp_header_t *udp)
dpo_id_t ct_lb
The LB used to forward to the backends.
static load_balance_t * load_balance_get(index_t lbi)
u8 * format_cnat_translation(u8 *s, va_list *args)
static u32 ip6_compute_flow_hash(const ip6_header_t *ip, flow_hash_config_t flow_hash_config)
struct _vlib_node_registration vlib_node_registration_t
vlib_combined_counter_main_t cnat_translation_counters
Counters for each translation.
index_t dpoi_index
the index of objects of that type
static uword cnat_vip_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_buffer_t *b, cnat_node_ctx_t *ctx, int rv, cnat_session_t *session)
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
VLIB buffer representation.
A collection of combined counters.
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static_always_inline void cnat_session_create(cnat_session_t *session, cnat_node_ctx_t *ctx, u8 rsession_flags)
Create NAT sessions.
u16 dpoi_next_node
The next VLIB node to follow.
#define VLIB_NODE_FLAG_TRACE
Data used to track an EP in the FIB.
static void ip46_address_set_ip4(ip46_address_t *ip46, const ip4_address_t *ip)
static uword cnat_node_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, cnat_node_sub_t cnat_sub, ip_address_family_t af, u8 do_trace)
cnat_vip_source_policy_t vip_policy
struct cnat_session_t_::@633 value
this value sits in the same memory location a 'value' in the bihash kvp
A client is a representation of an IP address behind the NAT.