|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
28 #define _(sym,string) string,
54 if (clib_bihash_search_16_8
78 b4_index = b4_value.
value;
90 ASSERT (oldest_index != ~0);
100 in2out_kv.
key[0] = s->in2out.as_u64[0];
101 in2out_kv.
key[1] = s->in2out.as_u64[1];
102 in2out_kv.
key[2] = s->in2out.as_u64[2];
105 out2in_kv.
key = s->out2in.as_u64;
109 addr_port.
addr.
as_u32 = s->out2in.addr.as_u32;
110 addr_port.
port = s->out2in.port;
113 s->out2in.protocol, &addr_port);
116 &s->in2out.addr, s->in2out.port,
117 &s->out2in.addr, s->out2in.port,
134 *
error = DSLITE_ERROR_OUT_OF_PORTS;
152 s->per_b4_list_head_index,
160 s->in2out = *in2out_key;
161 s->out2in = out2in_key;
163 in2out_kv.
key[0] = s->in2out.as_u64[0];
164 in2out_kv.
key[1] = s->in2out.as_u64[1];
165 in2out_kv.
key[2] = s->in2out.as_u64[2];
169 out2in_kv.
key = s->out2in.as_u64;
175 s->in2out.port, &s->out2in.addr, s->out2in.port,
186 dslite_session_t *s = 0;
192 u32 new_addr, old_addr;
199 *
error = DSLITE_ERROR_BAD_ICMP_TYPE;
205 key.addr =
ip4->src_address;
207 key.proto = NAT_PROTOCOL_ICMP;
208 key.softwire_id.as_u64[0] =
ip6->src_address.as_u64[0];
209 key.softwire_id.as_u64[1] =
ip6->src_address.as_u64[1];
211 kv.
key[0] =
key.as_u64[0];
212 kv.
key[1] =
key.as_u64[1];
213 kv.
key[2] =
key.as_u64[2];
215 if (clib_bihash_search_24_8
229 old_addr =
ip4->src_address.as_u32;
230 ip4->src_address = s->out2in.addr;
231 new_addr =
ip4->src_address.as_u32;
238 sum =
icmp->checksum;
282 u8 error0 = DSLITE_ERROR_IN2OUT;
284 dslite_session_t *s0 = 0;
290 u32 new_addr0, old_addr0;
291 u16 old_port0, new_port0;
306 if (ip60->
protocol == IP_PROTOCOL_ICMP6)
311 error0 = DSLITE_ERROR_BAD_IP6_PROTOCOL;
321 error0 = DSLITE_ERROR_UNSUPPORTED_PROTOCOL;
361 if (clib_bihash_search_24_8
394 old_port0 = tcp0->src_port;
395 tcp0->src_port = s0->out2in.port;
396 new_port0 = tcp0->src_port;
398 sum0 = tcp0->checksum;
417 s0->last_heard =
now;
424 s0->per_b4_list_head_index, s0->per_b4_index);
427 (clib_net_to_host_u32
434 && (b0->
flags & VLIB_BUFFER_IS_TRACED)))
448 n_left_to_next, bi0, next0);
453 return frame->n_vectors;
465 .name =
"dslite-in2out",
466 .vector_size =
sizeof (
u32),
491 .name =
"dslite-in2out-slowpath",
492 .vector_size =
sizeof (
u32),
u32 sessions_per_b4_list_head_index
static u32 clib_dlist_remove_head(dlist_elt_t *pool, u32 head_index)
static void clib_dlist_init(dlist_elt_t *pool, u32 index)
#define foreach_dslite_error
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
clib_bihash_16_8_t b4_hash
dslite_per_thread_data_t * per_thread_data
vlib_node_registration_t dslite_in2out_node
(constructor) VLIB_REGISTER_NODE (dslite_in2out_node)
nat44_ei_hairpin_src_next_t next_index
@ DSLITE_IN2OUT_NEXT_SLOWPATH
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
dslite_session_t * sessions
struct _tcp_header tcp_header_t
static nat_protocol_t ip_proto_to_nat_proto(u8 ip_proto)
Common NAT inline functions.
@ VLIB_NODE_TYPE_INTERNAL
vlib_main_t vlib_node_runtime_t * node
void nat_syslog_dslite_apmadd(u32 ssubix, ip6_address_t *sv6enc, ip4_address_t *isaddr, u16 isport, ip4_address_t *xsaddr, u16 xsport, nat_protocol_t proto)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
int nat_free_ip4_addr_and_port(nat_ip4_pool_t *pool, u32 thread_index, u16 protocol, nat_ip4_addr_port_t *addr_port)
static_always_inline u8 icmp_type_is_error_message(u8 icmp_type)
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
int nat_alloc_ip4_addr_and_port(nat_ip4_pool_t *pool, u32 fib_index, u32 thread_index, u32 nat_thread_index, u16 port_per_thread, u16 protocol, nat_ip4_addr_port_t *out)
vlib_error_t * errors
Vector of errors for this node.
u32 dslite_in2out_node_index
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
vlib_error_t error
Error code for buffers to be enqueued to error handler.
#define VLIB_NODE_FN(node)
vlib_simple_counter_main_t total_b4s
#define VLIB_NODE_FLAG_TRACE
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static uword dslite_in2out_node_fn_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u8 is_slow_path)
u8 * format_dslite_trace(u8 *s, va_list *args)
static u32 slow_path(dslite_main_t *dm, dslite_session_key_t *in2out_key, dslite_session_t **sp, u32 next, u8 *error, u32 thread_index)
static void clib_dlist_remove(dlist_elt_t *pool, u32 index)
void nat_syslog_dslite_apmdel(u32 ssubix, ip6_address_t *sv6enc, ip4_address_t *isaddr, u16 isport, ip4_address_t *xsaddr, u16 xsport, nat_protocol_t proto)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
static char * dslite_in2out_error_strings[]
ip6_address_t softwire_id
struct _vlib_node_registration vlib_node_registration_t
vlib_simple_counter_main_t total_sessions
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
static void vlib_set_simple_counter(vlib_simple_counter_main_t *cm, u32 thread_index, u32 index, u64 value)
Set a simple counter.
vlib_put_next_frame(vm, node, next_index, 0)
vlib_node_registration_t dslite_in2out_slowpath_node
(constructor) VLIB_REGISTER_NODE (dslite_in2out_slowpath_node)
8 octet key, 8 octet key value pair
@ DSLITE_IN2OUT_NEXT_IP4_LOOKUP
static uword pool_elts(void *v)
Number of active elements in a pool.
u32 dslite_in2out_slowpath_node_index
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
clib_bihash_24_8_t in2out
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
#define ip_csum_update(sum, old, new, type, field)
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static void clib_dlist_addtail(dlist_elt_t *pool, u32 head_index, u32 new_index)
static u32 dslite_icmp_in2out(dslite_main_t *dm, ip6_header_t *ip6, ip4_header_t *ip4, dslite_session_t **sp, u32 next, u8 *error, u32 thread_index)
dslite_main_t dslite_main
static f64 vlib_time_now(vlib_main_t *vm)
@ DSLITE_IN2OUT_NEXT_DROP
@ DSLITE_IN2OUT_NEXT_IP6_ICMP
vl_api_address_union_t src_address
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
static u16 ip_csum_fold(ip_csum_t c)
vl_api_fib_path_type_t type
static void * ip4_next_header(ip4_header_t *i)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
VLIB buffer representation.
#define VLIB_REGISTER_NODE(x,...)