|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
25 #include <vpp/app/version.h>
34 .arc_name =
"ip4-unicast",
35 .node_name =
"det44-in2out",
37 "ip4-sv-reassembly-feature"),
40 .arc_name =
"ip4-unicast",
41 .node_name =
"det44-out2in",
43 "ip4-sv-reassembly-feature",
44 "ip4-dhcp-client-detect"),
47 .version = VPP_BUILD_VER,
48 .description =
"Deterministic NAT (CGN)",
61 .ip4.as_u32 =
addr->as_u32,
125 return VNET_API_ERROR_VALUE_EXIST;
128 if (!found && !is_add)
129 return VNET_API_ERROR_NO_SUCH_ENTRY;
139 mp->
sharing_ratio = (1 << (32 - in_plen)) / (1 << (32 - out_plen));
144 1, empty_snat_det_session);
199 const char *feature_name;
217 feature_name = is_inside ?
"det44-in2out" :
"det44-out2in";
224 return VNET_API_ERROR_INVALID_VALUE;
242 det44_log_err (
"det44 is already enabled on this interface");
243 return VNET_API_ERROR_INVALID_VALUE;
296 if (!is_del && !found)
368 det44_log_err (
"inside %u, outside %u",
c.inside_vrf_id,
c.outside_vrf_id);
464 if (new_fib_index == old_fib_index)
487 if (outside_fib->
fib_index == old_fib_index)
498 if (outside_fib->
fib_index == new_fib_index)
556 #define _(v, N, str) case DET44_SESSION_##N: t = (u8 *) str; break;
560 t =
format (t,
"unknown");
571 u32 in_offset, out_offset;
573 u32 *
i = va_arg (*args,
u32 *);
577 clib_host_to_net_u32 (clib_net_to_host_u32 (det_map->
in_addr.
as_u32) +
580 clib_net_to_host_u32 (in_addr.
as_u32) -
584 clib_host_to_net_u32 (clib_net_to_host_u32 (det_map->
out_addr.
as_u32) +
588 "in %U:%d out %U:%d external host %U:%d state: %U expire: %d\n",
#define det44_interface_is_inside(i)
Check if Deterministic NAT interface is inside.
Deterministic NAT (CGN) definitions.
struct nat_timeouts_t::@742 tcp
vnet_interface_main_t * im
void det44_add_del_addr_to_fib(ip4_address_t *addr, u8 p_len, u32 sw_if_index, int is_add)
void fib_table_entry_delete(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source)
Delete a FIB entry.
int snat_det_add_map(ip4_address_t *in_addr, u8 in_plen, ip4_address_t *out_addr, u8 out_plen, int is_add)
Add/delete deterministic NAT mapping.
ip4_table_bind_callback_t * table_bind_callbacks
Functions to call when interface to table biding changes.
ip4_main_t ip4_main
Global ip4 main structure.
nat_timeouts_t det44_get_timeouts()
fib_node_index_t fib_table_entry_update_one_path(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, dpo_proto_t next_hop_proto, const ip46_address_t *next_hop, u32 next_hop_sw_if_index, u32 next_hop_fib_index, u32 next_hop_weight, fib_mpls_label_t *next_hop_labels, fib_route_path_flags_t path_flags)
Update the entry to have just one path.
clib_error_t * det44_api_hookup(vlib_main_t *vm)
ip4_address_t ext_host_addr
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
vlib_main_t vlib_node_runtime_t * node
u32 ip4_fib_table_get_index_for_sw_if_index(u32 sw_if_index)
#define pool_put(P, E)
Free an object E in pool P.
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
VNET_FEATURE_INIT(ip4_det44_in2out, static)
det44_interface_t * interfaces
@ FIB_ENTRY_FLAG_EXCLUSIVE
int ip4_sv_reass_enable_disable_with_refcnt(u32 sw_if_index, int is_enable)
int det44_plugin_disable()
static uword vlib_process_get_events(vlib_main_t *vm, uword **data_vector)
Return the first event type which has occurred and a vector of per-event data of that type,...
#define pool_foreach(VAR, POOL)
Iterate through pool.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
snat_det_map_t * det_maps
int det44_plugin_enable(det44_config_t c)
#define vec_dup(V)
Return copy of vector (no header, no alignment)
vnet_main_t * vnet_get_main(void)
u32 vlib_process_create(vlib_main_t *vm, char *name, vlib_node_function_t *f, u32 log2_n_stack_bytes)
Create a vlib process.
u32 fib_table_find_or_create_and_lock(fib_protocol_t proto, u32 table_id, fib_source_t src)
Get the index of the FIB for a Table-ID.
det44_fib_t * outside_fibs
void det44_reset_timeouts()
#define DET44_INTERFACE_FLAG_IS_OUTSIDE
#define det44_log_err(...)
#define DET44_INTERFACE_FLAG_IS_INSIDE
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
fib_source_t fib_source_allocate(const char *name, fib_source_priority_t prio, fib_source_behaviour_t bh)
static void det44_update_outside_fib(ip4_main_t *im, uword opaque, u32 sw_if_index, u32 new_fib_index, u32 old_fib_index)
#define FIB_SOURCE_PRIORITY_HI
Some priority values that plugins might use when they are not to concerned where in the list they'll ...
#define vec_free(V)
Free vector's memory (no header).
static_always_inline void snat_det_ses_close(snat_det_map_t *dm, snat_det_session_t *ses)
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
int det44_interface_add_del(u32 sw_if_index, u8 is_inside, int is_del)
@ FIB_ENTRY_FLAG_CONNECTED
unformat_function_t unformat_vnet_sw_interface
static f64 vlib_process_wait_for_event_or_clock(vlib_main_t *vm, f64 dt)
Suspend a cooperative multi-tasking thread Waits for an event, or for the indicated number of seconds...
description fragment has unexpected format
@ foreach_det44_session_state
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header,...
static_always_inline void nat_reset_timeouts(nat_timeouts_t *timeouts)
u32 fib_table_get_index_for_sw_if_index(fib_protocol_t proto, u32 sw_if_index)
Get the index of the FIB bound to the interface.
@ FIB_ROUTE_PATH_FLAG_NONE
#define VLIB_INIT_FUNCTION(x)
u8 * format_det44_session_state(u8 *s, va_list *args)
int det44_set_timeouts(nat_timeouts_t *timeouts)
#define vec_foreach(var, vec)
Vector iterator.
ip4_table_bind_function_t * function
snat_det_session_t * sessions
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vlib_log_class_t log_class
static vlib_main_t * vlib_get_main(void)
#define VNET_FEATURES(...)
vnet_interface_output_runtime_t * rt
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
u32 expire_walk_node_index
@ FIB_SOURCE_BH_SIMPLE
add paths without path extensions
#define pool_free(p)
Free a pool.
#define FIB_SOURCE_PRIORITY_LOW
static_always_inline u8 plugin_enabled()
#define DET44_SES_PER_USER
#define det44_interface_is_outside(i)
Check if Deterministic NAT interface is outside.
static uword det44_expire_walk_fn(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
The 'det44-expire-walk' process's main loop.
u8 * format_det_map_ses(u8 *s, va_list *args)
static clib_error_t * det44_init(vlib_main_t *vm)
static f64 vlib_time_now(vlib_main_t *vm)
vl_api_interface_index_t sw_if_index
Aggregate type for a prefix.
void det44_create_expire_walk_process()
#define vec_del1(v, i)
Delete the element at index I.