FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
dslite_in2out.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #include <nat/dslite/dslite.h>
16 #include <nat/lib/nat_syslog.h>
17 
18 typedef enum
19 {
26 
27 static char *dslite_in2out_error_strings[] = {
28 #define _(sym,string) string,
30 #undef _
31 };
32 
33 static u32
35  dslite_session_t ** sp, u32 next, u8 * error, u32 thread_index)
36 {
37  dslite_b4_t *b4;
38  clib_bihash_kv_16_8_t b4_kv, b4_value;
39  clib_bihash_kv_24_8_t in2out_kv;
40  clib_bihash_kv_8_8_t out2in_kv;
41  dlist_elt_t *head_elt, *oldest_elt, *elt;
42  u32 oldest_index;
43  dslite_session_t *s;
44  nat_session_key_t out2in_key;
45  nat_ip4_addr_port_t addr_port;
46  u32 b4_index;
47 
48  out2in_key.protocol = in2out_key->proto;
49  out2in_key.fib_index = 0;
50 
51  b4_kv.key[0] = in2out_key->softwire_id.as_u64[0];
52  b4_kv.key[1] = in2out_key->softwire_id.as_u64[1];
53 
54  if (clib_bihash_search_16_8
55  (&dm->per_thread_data[thread_index].b4_hash, &b4_kv, &b4_value))
56  {
58  clib_memset (b4, 0, sizeof (*b4));
59  b4->addr.as_u64[0] = in2out_key->softwire_id.as_u64[0];
60  b4->addr.as_u64[1] = in2out_key->softwire_id.as_u64[1];
61 
64  head_elt - dm->per_thread_data[thread_index].list_pool;
67 
68  b4_index = b4_kv.value = b4 - dm->per_thread_data[thread_index].b4s;
69  clib_bihash_add_del_16_8 (&dm->per_thread_data[thread_index].b4_hash,
70  &b4_kv, 1);
71 
73  pool_elts (dm->
75  }
76  else
77  {
78  b4_index = b4_value.value;
79  b4 =
81  b4_value.value);
82  }
83 
84  //TODO configurable quota
85  if (b4->nsessions >= 1000)
86  {
87  oldest_index =
90  ASSERT (oldest_index != ~0);
92  b4->sessions_per_b4_list_head_index, oldest_index);
93  oldest_elt =
95  oldest_index);
96  s =
98  oldest_elt->value);
99 
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];
103  clib_bihash_add_del_24_8 (&dm->per_thread_data[thread_index].in2out,
104  &in2out_kv, 0);
105  out2in_kv.key = s->out2in.as_u64;
106  clib_bihash_add_del_8_8 (&dm->per_thread_data[thread_index].out2in,
107  &out2in_kv, 0);
108 
109  addr_port.addr.as_u32 = s->out2in.addr.as_u32;
110  addr_port.port = s->out2in.port;
111 
113  s->out2in.protocol, &addr_port);
114 
115  nat_syslog_dslite_apmdel (b4_index, &s->in2out.softwire_id,
116  &s->in2out.addr, s->in2out.port,
117  &s->out2in.addr, s->out2in.port,
118  s->in2out.proto);
119 
121  (&dm->pool, 0, thread_index, thread_index,
122  dm->port_per_thread, out2in_key.protocol, &addr_port))
123  ASSERT (0);
124 
125  out2in_key.addr.as_u32 = addr_port.addr.as_u32;
126  out2in_key.port = addr_port.port;
127  }
128  else
129  {
131  (&dm->pool, 0, thread_index, thread_index,
132  dm->port_per_thread, out2in_key.protocol, &addr_port))
133  {
134  *error = DSLITE_ERROR_OUT_OF_PORTS;
136  }
137 
138  out2in_key.addr.as_u32 = addr_port.addr.as_u32;
139  out2in_key.port = addr_port.port;
140 
142  clib_memset (s, 0, sizeof (*s));
143  b4->nsessions++;
144 
148  elt->value = s - dm->per_thread_data[thread_index].sessions;
149  s->per_b4_index = elt - dm->per_thread_data[thread_index].list_pool;
150  s->per_b4_list_head_index = b4->sessions_per_b4_list_head_index;
152  s->per_b4_list_head_index,
154 
158  }
159 
160  s->in2out = *in2out_key;
161  s->out2in = out2in_key;
162  *sp = s;
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];
166  in2out_kv.value = s - dm->per_thread_data[thread_index].sessions;
167  clib_bihash_add_del_24_8 (&dm->per_thread_data[thread_index].in2out,
168  &in2out_kv, 1);
169  out2in_kv.key = s->out2in.as_u64;
170  out2in_kv.value = s - dm->per_thread_data[thread_index].sessions;
171  clib_bihash_add_del_8_8 (&dm->per_thread_data[thread_index].out2in,
172  &out2in_kv, 1);
173 
174  nat_syslog_dslite_apmadd (b4_index, &s->in2out.softwire_id, &s->in2out.addr,
175  s->in2out.port, &s->out2in.addr, s->out2in.port,
176  s->in2out.proto);
177 
178  return next;
179 }
180 
181 static inline u32
183  ip4_header_t * ip4, dslite_session_t ** sp, u32 next,
185 {
186  dslite_session_t *s = 0;
187  icmp46_header_t *icmp = ip4_next_header (ip4);
190  u32 n = next;
191  echo_header_t *echo;
192  u32 new_addr, old_addr;
193  u16 old_id, new_id;
194  ip_csum_t sum;
195 
196  if (icmp_type_is_error_message (icmp->type))
197  {
199  *error = DSLITE_ERROR_BAD_ICMP_TYPE;
200  goto done;
201  }
202 
203  echo = (echo_header_t *) (icmp + 1);
204 
205  key.addr = ip4->src_address;
206  key.port = echo->identifier;
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];
210  key.pad = 0;
211  kv.key[0] = key.as_u64[0];
212  kv.key[1] = key.as_u64[1];
213  kv.key[2] = key.as_u64[2];
214 
215  if (clib_bihash_search_24_8
216  (&dm->per_thread_data[thread_index].in2out, &kv, &value))
217  {
218  n = slow_path (dm, &key, &s, next, error, thread_index);
220  goto done;
221  }
222  else
223  {
224  s =
226  value.value);
227  }
228 
229  old_addr = ip4->src_address.as_u32;
230  ip4->src_address = s->out2in.addr;
231  new_addr = ip4->src_address.as_u32;
232  sum = ip4->checksum;
233  sum = ip_csum_update (sum, old_addr, new_addr, ip4_header_t, src_address);
234  ip4->checksum = ip_csum_fold (sum);
235 
236  old_id = echo->identifier;
237  echo->identifier = new_id = s->out2in.port;
238  sum = icmp->checksum;
239  sum = ip_csum_update (sum, old_id, new_id, echo_header_t, identifier);
240  icmp->checksum = ip_csum_fold (sum);
241 
242 done:
243  *sp = s;
244  return n;
245 }
246 
247 static inline uword
249  vlib_frame_t * frame, u8 is_slow_path)
250 {
251  u32 n_left_from, *from, *to_next;
253  u32 node_index;
254  vlib_node_runtime_t *error_node;
256  f64 now = vlib_time_now (vm);
257  dslite_main_t *dm = &dslite_main;
258 
259  node_index =
260  is_slow_path ? dm->dslite_in2out_slowpath_node_index :
262 
263  error_node = vlib_node_get_runtime (vm, node_index);
264 
266  n_left_from = frame->n_vectors;
267  next_index = node->cached_next_index;
268 
269  while (n_left_from > 0)
270  {
271  u32 n_left_to_next;
272 
273  vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
274 
275  while (n_left_from > 0 && n_left_to_next > 0)
276  {
277  u32 bi0;
278  vlib_buffer_t *b0;
280  ip4_header_t *ip40;
281  ip6_header_t *ip60;
282  u8 error0 = DSLITE_ERROR_IN2OUT;
283  u32 proto0;
284  dslite_session_t *s0 = 0;
285  clib_bihash_kv_24_8_t kv0, value0;
287  udp_header_t *udp0;
288  tcp_header_t *tcp0;
289  ip_csum_t sum0;
290  u32 new_addr0, old_addr0;
291  u16 old_port0, new_port0;
292 
293  /* speculatively enqueue b0 to the current next frame */
294  bi0 = from[0];
295  to_next[0] = bi0;
296  from += 1;
297  to_next += 1;
298  n_left_from -= 1;
299  n_left_to_next -= 1;
300 
301  b0 = vlib_get_buffer (vm, bi0);
302  ip60 = vlib_buffer_get_current (b0);
303 
304  if (PREDICT_FALSE (ip60->protocol != IP_PROTOCOL_IP_IN_IP))
305  {
306  if (ip60->protocol == IP_PROTOCOL_ICMP6)
307  {
309  goto trace0;
310  }
311  error0 = DSLITE_ERROR_BAD_IP6_PROTOCOL;
312  next0 = DSLITE_IN2OUT_NEXT_DROP;
313  goto trace0;
314  }
315 
316  ip40 = vlib_buffer_get_current (b0) + sizeof (ip6_header_t);
317  proto0 = ip_proto_to_nat_proto (ip40->protocol);
318 
319  if (PREDICT_FALSE (proto0 == NAT_PROTOCOL_OTHER))
320  {
321  error0 = DSLITE_ERROR_UNSUPPORTED_PROTOCOL;
322  next0 = DSLITE_IN2OUT_NEXT_DROP;
323  goto trace0;
324  }
325 
326  udp0 = ip4_next_header (ip40);
327  tcp0 = (tcp_header_t *) udp0;
328 
329  if (is_slow_path)
330  {
331  if (PREDICT_FALSE (proto0 == NAT_PROTOCOL_ICMP))
332  {
333  next0 =
334  dslite_icmp_in2out (dm, ip60, ip40, &s0, next0, &error0,
335  thread_index);
336  if (PREDICT_FALSE (next0 == DSLITE_IN2OUT_NEXT_DROP))
337  goto trace0;
338 
339  goto accounting0;
340  }
341  }
342  else
343  {
344  if (PREDICT_FALSE (proto0 == NAT_PROTOCOL_ICMP))
345  {
347  goto trace0;
348  }
349  }
350 
351  key0.addr = ip40->src_address;
352  key0.port = udp0->src_port;
353  key0.proto = proto0;
354  key0.softwire_id.as_u64[0] = ip60->src_address.as_u64[0];
355  key0.softwire_id.as_u64[1] = ip60->src_address.as_u64[1];
356  key0.pad = 0;
357  kv0.key[0] = key0.as_u64[0];
358  kv0.key[1] = key0.as_u64[1];
359  kv0.key[2] = key0.as_u64[2];
360 
361  if (clib_bihash_search_24_8
362  (&dm->per_thread_data[thread_index].in2out, &kv0, &value0))
363  {
364  if (is_slow_path)
365  {
366  next0 =
367  slow_path (dm, &key0, &s0, next0, &error0, thread_index);
368  if (PREDICT_FALSE (next0 == DSLITE_IN2OUT_NEXT_DROP))
369  goto trace0;
370  }
371  else
372  {
374  goto trace0;
375  }
376  }
377  else
378  {
379  s0 =
381  value0.value);
382  }
383 
384  old_addr0 = ip40->src_address.as_u32;
385  ip40->src_address = s0->out2in.addr;
386  new_addr0 = ip40->src_address.as_u32;
387  sum0 = ip40->checksum;
388  sum0 =
389  ip_csum_update (sum0, old_addr0, new_addr0, ip4_header_t,
390  src_address);
391  ip40->checksum = ip_csum_fold (sum0);
392  if (PREDICT_TRUE (proto0 == NAT_PROTOCOL_TCP))
393  {
394  old_port0 = tcp0->src_port;
395  tcp0->src_port = s0->out2in.port;
396  new_port0 = tcp0->src_port;
397 
398  sum0 = tcp0->checksum;
399  sum0 =
400  ip_csum_update (sum0, old_addr0, new_addr0, ip4_header_t,
401  dst_address);
402  sum0 =
403  ip_csum_update (sum0, old_port0, new_port0, ip4_header_t,
404  length);
405  //mss_clamping (&dslite_main, tcp0, &sum0);
406  tcp0->checksum = ip_csum_fold (sum0);
407  }
408  else
409  {
410  old_port0 = udp0->src_port;
411  udp0->src_port = s0->out2in.port;
412  udp0->checksum = 0;
413  }
414 
415  accounting0:
416  /* Accounting */
417  s0->last_heard = now;
418  s0->total_pkts++;
419  s0->total_bytes += vlib_buffer_length_in_chain (vm, b0);
420  /* Per-B4 LRU list maintenance */
422  s0->per_b4_index);
424  s0->per_b4_list_head_index, s0->per_b4_index);
425 
426  ip40->tos =
427  (clib_net_to_host_u32
428  (ip60->ip_version_traffic_class_and_flow_label) & 0x0ff00000) >>
429  20;
430  vlib_buffer_advance (b0, sizeof (ip6_header_t));
431 
432  trace0:
433  if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE)
434  && (b0->flags & VLIB_BUFFER_IS_TRACED)))
435  {
436  dslite_trace_t *t = vlib_add_trace (vm, node, b0, sizeof (*t));
437  t->next_index = next0;
438  t->session_index = ~0;
439  if (s0)
440  t->session_index =
442  }
443 
444  b0->error = error_node->errors[error0];
445 
446  /* verify speculative enqueue, maybe switch current next frame */
448  n_left_to_next, bi0, next0);
449  }
450  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
451  }
452 
453  return frame->n_vectors;
454 }
455 
459 {
461 }
462 
463 /* *INDENT-OFF* */
465  .name = "dslite-in2out",
466  .vector_size = sizeof (u32),
467  .format_trace = format_dslite_trace,
470  .error_strings = dslite_in2out_error_strings,
471  .n_next_nodes = DSLITE_IN2OUT_N_NEXT,
472  /* edit / add dispositions here */
473  .next_nodes = {
474  [DSLITE_IN2OUT_NEXT_DROP] = "error-drop",
475  [DSLITE_IN2OUT_NEXT_IP4_LOOKUP] = "ip4-lookup",
476  [DSLITE_IN2OUT_NEXT_IP6_ICMP] = "ip6-icmp-input",
477  [DSLITE_IN2OUT_NEXT_SLOWPATH] = "dslite-in2out-slowpath",
478  },
479 };
480 /* *INDENT-ON* */
481 
485 {
487 }
488 
489 /* *INDENT-OFF* */
491  .name = "dslite-in2out-slowpath",
492  .vector_size = sizeof (u32),
493  .format_trace = format_dslite_trace,
496  .error_strings = dslite_in2out_error_strings,
497  .n_next_nodes = DSLITE_IN2OUT_N_NEXT,
498  /* edit / add dispositions here */
499  .next_nodes = {
500  [DSLITE_IN2OUT_NEXT_DROP] = "error-drop",
501  [DSLITE_IN2OUT_NEXT_IP4_LOOKUP] = "ip4-lookup",
502  [DSLITE_IN2OUT_NEXT_IP6_ICMP] = "ip6-lookup",
503  [DSLITE_IN2OUT_NEXT_SLOWPATH] = "dslite-in2out-slowpath",
504  },
505 };
506 /* *INDENT-ON* */
507 
508 /*
509  * fd.io coding-style-patch-verification: ON
510  *
511  * Local Variables:
512  * eval: (c-set-style "gnu")
513  * End:
514  */
dslite_b4_t::sessions_per_b4_list_head_index
u32 sessions_per_b4_list_head_index
Definition: dslite.h:80
nat_session_key_t::port
u16 port
Definition: dslite.h:41
clib_dlist_remove_head
static u32 clib_dlist_remove_head(dlist_elt_t *pool, u32 head_index)
Definition: dlist.h:117
clib_dlist_init
static void clib_dlist_init(dlist_elt_t *pool, u32 index)
Definition: dlist.h:36
foreach_dslite_error
#define foreach_dslite_error
Definition: dslite.h:145
udp_header_t::src_port
u16 src_port
Definition: udp_packet.h:48
clib_bihash_kv_16_8_t::value
u64 value
Definition: bihash_16_8.h:43
thread_index
u32 thread_index
Definition: nat44_ei_hairpinning.c:492
DSLITE_IN2OUT_N_NEXT
@ DSLITE_IN2OUT_N_NEXT
Definition: dslite_in2out.c:24
frame
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
Definition: nat44_ei.c:3048
dslite.h
dslite_per_thread_data_t::b4_hash
clib_bihash_16_8_t b4_hash
Definition: dslite.h:91
nat_session_key_t::addr
ip4_address_t addr
Definition: dslite.h:40
dslite_main_t
Definition: dslite.h:103
dslite_main_t::per_thread_data
dslite_per_thread_data_t * per_thread_data
Definition: dslite.h:109
ip4
vl_api_ip4_address_t ip4
Definition: one.api:376
dslite_in2out_node
vlib_node_registration_t dslite_in2out_node
(constructor) VLIB_REGISTER_NODE (dslite_in2out_node)
Definition: dslite_in2out.c:464
next_index
nat44_ei_hairpin_src_next_t next_index
Definition: nat44_ei_hairpinning.c:412
dslite_main_t::pool
nat_ip4_pool_t pool
Definition: dslite.h:115
DSLITE_IN2OUT_NEXT_SLOWPATH
@ DSLITE_IN2OUT_NEXT_SLOWPATH
Definition: dslite_in2out.c:23
vlib_get_buffer
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
Definition: buffer_funcs.h:111
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:553
dslite_session_key_t::pad
u8 pad
Definition: dslite.h:58
ip6_header_t::protocol
u8 protocol
Definition: ip6_packet.h:304
dslite_per_thread_data_t::sessions
dslite_session_t * sessions
Definition: dslite.h:97
tcp_header_t
struct _tcp_header tcp_header_t
ip_proto_to_nat_proto
static nat_protocol_t ip_proto_to_nat_proto(u8 ip_proto)
Common NAT inline functions.
Definition: inlines.h:24
nat_session_key_t::protocol
u16 protocol
Definition: dslite.h:42
next
u16 * next
Definition: nat44_ei_out2in.c:718
dlist_elt_t::value
u32 value
Definition: dlist.h:32
echo_header_t
Definition: dslite.h:27
VLIB_NODE_TYPE_INTERNAL
@ VLIB_NODE_TYPE_INTERNAL
Definition: node.h:72
dslite_per_thread_data_t::out2in
clib_bihash_8_8_t out2in
Definition: dslite.h:87
node
vlib_main_t vlib_node_runtime_t * node
Definition: nat44_ei.c:3047
clib_bihash_kv_8_8_t::value
u64 value
the value
Definition: bihash_8_8.h:44
ip4_address_t::as_u32
u32 as_u32
Definition: ip4_packet.h:57
clib_bihash_kv_8_8_t::key
u64 key
the key
Definition: bihash_8_8.h:43
nat_ip4_addr_port_s::port
u16 port
Definition: alloc.h:57
clib_bihash_kv_24_8_t
Definition: bihash_24_8.h:40
u16
unsigned short u16
Definition: types.h:57
nat_syslog_dslite_apmadd
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)
Definition: nat_syslog.c:125
dslite_session_key_t::proto
u8 proto
Definition: dslite.h:57
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
nat_free_ip4_addr_and_port
int nat_free_ip4_addr_and_port(nat_ip4_pool_t *pool, u32 thread_index, u16 protocol, nat_ip4_addr_port_t *addr_port)
Definition: alloc.c:211
per_thread_data
Definition: main.c:66
node_index
node node_index
Definition: interface_output.c:420
vlib_frame_t
Definition: node.h:372
icmp_type_is_error_message
static_always_inline u8 icmp_type_is_error_message(u8 icmp_type)
Definition: cnat_node.h:109
vlib_buffer_length_in_chain
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
Definition: buffer_funcs.h:433
nat_alloc_ip4_addr_and_port
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)
Definition: alloc.c:195
dslite_in2out_next_t
dslite_in2out_next_t
Definition: dslite_in2out.c:18
udp_header_t
Definition: udp_packet.h:45
ip4_header_t
Definition: ip4_packet.h:87
ip4_header_t::tos
ip_dscp_t tos
Definition: ip4_packet.h:96
error
Definition: cJSON.c:88
key
typedef key
Definition: ipsec_types.api:88
vlib_node_runtime_t::errors
vlib_error_t * errors
Vector of errors for this node.
Definition: node.h:460
dslite_main_t::dslite_in2out_node_index
u32 dslite_in2out_node_index
Definition: dslite.h:122
vlib_buffer_advance
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
Definition: buffer.h:276
dslite_b4_t
Definition: dslite.h:77
vlib_buffer_t::error
vlib_error_t error
Error code for buffers to be enqueued to error handler.
Definition: buffer.h:145
nat_ip4_addr_port_s::addr
ip4_address_t addr
Definition: alloc.h:56
dslite_trace_t::session_index
u32 session_index
Definition: dslite.h:137
VLIB_NODE_FN
#define VLIB_NODE_FN(node)
Definition: node.h:202
dslite_main_t::total_b4s
vlib_simple_counter_main_t total_b4s
Definition: dslite.h:118
VLIB_NODE_FLAG_TRACE
#define VLIB_NODE_FLAG_TRACE
Definition: node.h:291
PREDICT_FALSE
#define PREDICT_FALSE(x)
Definition: clib.h:124
ARRAY_LEN
#define ARRAY_LEN(x)
Definition: clib.h:70
vlib_frame_vector_args
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
Definition: node_funcs.h:301
dslite_in2out_node_fn_inline
static uword dslite_in2out_node_fn_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u8 is_slow_path)
Definition: dslite_in2out.c:248
format_dslite_trace
u8 * format_dslite_trace(u8 *s, va_list *args)
Definition: dslite.c:258
nat_session_key_t::fib_index
u16 fib_index
Definition: dslite.h:42
slow_path
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)
Definition: dslite_in2out.c:34
uword
u64 uword
Definition: types.h:112
vlib_main_t::thread_index
u32 thread_index
Definition: main.h:213
clib_bihash_kv_24_8_t::value
u64 value
Definition: bihash_24_8.h:43
clib_dlist_remove
static void clib_dlist_remove(dlist_elt_t *pool, u32 index)
Definition: dlist.h:99
f64
double f64
Definition: types.h:142
nat_syslog_dslite_apmdel
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)
Definition: nat_syslog.c:135
pool_get
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
Definition: pool.h:255
dlist_elt_t
Definition: dlist.h:28
ip4_header_t::checksum
u16 checksum
Definition: ip4_packet.h:118
dslite_in2out_error_strings
static char * dslite_in2out_error_strings[]
Definition: dslite_in2out.c:27
dslite_session_key_t::softwire_id
ip6_address_t softwire_id
Definition: dslite.h:54
dslite_b4_t::nsessions
u32 nsessions
Definition: dslite.h:81
nat_ip4_addr_port_s
Definition: alloc.h:54
vlib_node_registration_t
struct _vlib_node_registration vlib_node_registration_t
dslite_main_t::total_sessions
vlib_simple_counter_main_t total_sessions
Definition: dslite.h:119
udp_header_t::checksum
u16 checksum
Definition: udp_packet.h:55
vlib_validate_buffer_enqueue_x1
#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.
Definition: buffer_node.h:224
ip4_header_t::src_address
ip4_address_t src_address
Definition: ip4_packet.h:125
icmp
icmp
Definition: map.api:387
dslite_per_thread_data_t::list_pool
dlist_elt_t * list_pool
Definition: dslite.h:100
vlib_set_simple_counter
static void vlib_set_simple_counter(vlib_simple_counter_main_t *cm, u32 thread_index, u32 index, u64 value)
Set a simple counter.
Definition: counter.h:109
clib_bihash_kv_16_8_t
Definition: bihash_16_8.h:40
ASSERT
#define ASSERT(truth)
Definition: error_bootstrap.h:69
vlib_put_next_frame
vlib_put_next_frame(vm, node, next_index, 0)
clib_bihash_kv_16_8_t::key
u64 key[2]
Definition: bihash_16_8.h:42
dslite_in2out_slowpath_node
vlib_node_registration_t dslite_in2out_slowpath_node
(constructor) VLIB_REGISTER_NODE (dslite_in2out_slowpath_node)
Definition: dslite_in2out.c:490
dslite_main_t::port_per_thread
u16 port_per_thread
Definition: dslite.h:112
u32
unsigned int u32
Definition: types.h:88
ip6
vl_api_ip6_address_t ip6
Definition: one.api:424
dslite_trace_t
Definition: dslite.h:134
clib_bihash_kv_24_8_t::key
u64 key[3]
Definition: bihash_24_8.h:42
clib_bihash_kv_8_8_t
8 octet key, 8 octet key value pair
Definition: bihash_8_8.h:41
DSLITE_IN2OUT_NEXT_IP4_LOOKUP
@ DSLITE_IN2OUT_NEXT_IP4_LOOKUP
Definition: dslite_in2out.c:20
pool_elts
static uword pool_elts(void *v)
Number of active elements in a pool.
Definition: pool.h:127
dslite_session_key_t::as_u64
u64 as_u64[3]
Definition: dslite.h:60
dslite_main_t::dslite_in2out_slowpath_node_index
u32 dslite_in2out_slowpath_node_index
Definition: dslite.h:123
vlib_node_get_runtime
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
Definition: node_funcs.h:116
value
u8 value
Definition: qos.api:54
ip6_header_t
Definition: ip6_packet.h:294
elt
app_rx_mq_elt_t * elt
Definition: application.c:488
dslite_per_thread_data_t::in2out
clib_bihash_24_8_t in2out
Definition: dslite.h:88
now
f64 now
Definition: nat44_ei_out2in.c:710
length
char const int length
Definition: cJSON.h:163
ip6_header_t::src_address
ip6_address_t src_address
Definition: ip6_packet.h:310
echo_header_t::identifier
u16 identifier
Definition: dslite.h:29
clib_memset
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vlib_main_t
Definition: main.h:102
ip_csum_update
#define ip_csum_update(sum, old, new, type, field)
Definition: ip_packet.h:295
vlib_add_trace
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
Definition: trace.c:628
u8
unsigned char u8
Definition: types.h:56
vlib_buffer_get_current
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
Definition: buffer.h:257
ip_csum_t
uword ip_csum_t
Definition: ip_packet.h:245
clib_dlist_addtail
static void clib_dlist_addtail(dlist_elt_t *pool, u32 head_index, u32 new_index)
Definition: dlist.h:43
dslite_icmp_in2out
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)
Definition: dslite_in2out.c:182
dslite_b4_t::addr
ip6_address_t addr
Definition: dslite.h:79
dslite_trace_t::next_index
u32 next_index
Definition: dslite.h:136
nat_session_key_t
Definition: dslite.h:34
dslite_session_key_t::port
u16 port
Definition: dslite.h:56
dslite_main
dslite_main_t dslite_main
Definition: dslite.c:21
vlib_time_now
static f64 vlib_time_now(vlib_main_t *vm)
Definition: main.h:325
DSLITE_IN2OUT_NEXT_DROP
@ DSLITE_IN2OUT_NEXT_DROP
Definition: dslite_in2out.c:22
vlib_node_runtime_t
Definition: node.h:454
dslite_session_key_t::addr
ip4_address_t addr
Definition: dslite.h:55
DSLITE_IN2OUT_NEXT_IP6_ICMP
@ DSLITE_IN2OUT_NEXT_IP6_ICMP
Definition: dslite_in2out.c:21
src_address
vl_api_address_union_t src_address
Definition: ip_types.api:122
from
from
Definition: nat44_ei_hairpinning.c:415
PREDICT_TRUE
#define PREDICT_TRUE(x)
Definition: clib.h:125
dslite_per_thread_data_t::b4s
dslite_b4_t * b4s
Definition: dslite.h:94
vlib_get_next_frame
#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).
Definition: node_funcs.h:395
ip_csum_fold
static u16 ip_csum_fold(ip_csum_t c)
Definition: ip_packet.h:301
n_left_from
n_left_from
Definition: nat44_ei_hairpinning.c:416
ip6_header_t::ip_version_traffic_class_and_flow_label
u32 ip_version_traffic_class_and_flow_label
Definition: ip6_packet.h:297
type
vl_api_fib_path_type_t type
Definition: fib_types.api:123
ip4_header_t::protocol
u8 protocol
Definition: ip4_packet.h:115
nat_syslog.h
NAT syslog logging.
ip4_next_header
static void * ip4_next_header(ip4_header_t *i)
Definition: ip4_packet.h:196
vlib_buffer_t::flags
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
Definition: buffer.h:133
vlib_buffer_t
VLIB buffer representation.
Definition: buffer.h:111
VLIB_REGISTER_NODE
#define VLIB_REGISTER_NODE(x,...)
Definition: node.h:169
dslite_session_key_t
Definition: dslite.h:48