FD.io VPP  v19.08.1-401-g8e4ed521a
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.h>
16 #include <nat/nat_inlines.h>
17 #include <nat/nat_syslog.h>
18 
19 typedef enum
20 {
27 
28 static char *dslite_in2out_error_strings[] = {
29 #define _(sym,string) string,
31 #undef _
32 };
33 
34 static u32
36  dslite_session_t ** sp, u32 next, u8 * error, u32 thread_index)
37 {
38  dslite_b4_t *b4;
39  clib_bihash_kv_16_8_t b4_kv, b4_value;
40  clib_bihash_kv_24_8_t in2out_kv;
41  clib_bihash_kv_8_8_t out2in_kv;
42  dlist_elt_t *head_elt, *oldest_elt, *elt;
43  u32 oldest_index;
44  dslite_session_t *s;
45  snat_session_key_t out2in_key;
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  {
57  pool_get (dm->per_thread_data[thread_index].b4s, b4);
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 
62  pool_get (dm->per_thread_data[thread_index].list_pool, head_elt);
64  head_elt - dm->per_thread_data[thread_index].list_pool;
65  clib_dlist_init (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 
72  vlib_set_simple_counter (&dm->total_b4s, thread_index, 0,
73  pool_elts (dm->
74  per_thread_data[thread_index].b4s));
75  }
76  else
77  {
78  b4_index = b4_value.value;
79  b4 =
80  pool_elt_at_index (dm->per_thread_data[thread_index].b4s,
81  b4_value.value);
82  }
83 
84  //TODO configurable quota
85  if (b4->nsessions >= 1000)
86  {
87  oldest_index =
90  ASSERT (oldest_index != ~0);
91  clib_dlist_addtail (dm->per_thread_data[thread_index].list_pool,
92  b4->sessions_per_b4_list_head_index, oldest_index);
93  oldest_elt =
94  pool_elt_at_index (dm->per_thread_data[thread_index].list_pool,
95  oldest_index);
96  s =
97  pool_elt_at_index (dm->per_thread_data[thread_index].sessions,
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);
109  &s->out2in);
110 
111  nat_syslog_dslite_apmdel (b4_index, &s->in2out.softwire_id,
112  &s->in2out.addr, s->in2out.port,
113  &s->out2in.addr, s->out2in.port,
114  s->in2out.proto);
115 
117  (dm->addr_pool, 0, thread_index, &out2in_key,
118  dm->port_per_thread, thread_index))
119  ASSERT (0);
120  }
121  else
122  {
124  (dm->addr_pool, 0, thread_index, &out2in_key,
125  dm->port_per_thread, thread_index))
126  {
127  *error = DSLITE_ERROR_OUT_OF_PORTS;
129  }
130  pool_get (dm->per_thread_data[thread_index].sessions, s);
131  clib_memset (s, 0, sizeof (*s));
132  b4->nsessions++;
133 
134  pool_get (dm->per_thread_data[thread_index].list_pool, elt);
135  clib_dlist_init (dm->per_thread_data[thread_index].list_pool,
136  elt - dm->per_thread_data[thread_index].list_pool);
137  elt->value = s - dm->per_thread_data[thread_index].sessions;
138  s->per_b4_index = elt - dm->per_thread_data[thread_index].list_pool;
139  s->per_b4_list_head_index = b4->sessions_per_b4_list_head_index;
140  clib_dlist_addtail (dm->per_thread_data[thread_index].list_pool,
141  s->per_b4_list_head_index,
142  elt - dm->per_thread_data[thread_index].list_pool);
143 
144  vlib_set_simple_counter (&dm->total_sessions, thread_index, 0,
146  [thread_index].sessions));
147  }
148 
149  s->in2out = *in2out_key;
150  s->out2in = out2in_key;
151  *sp = s;
152  in2out_kv.key[0] = s->in2out.as_u64[0];
153  in2out_kv.key[1] = s->in2out.as_u64[1];
154  in2out_kv.key[2] = s->in2out.as_u64[2];
155  in2out_kv.value = s - dm->per_thread_data[thread_index].sessions;
156  clib_bihash_add_del_24_8 (&dm->per_thread_data[thread_index].in2out,
157  &in2out_kv, 1);
158  out2in_kv.key = s->out2in.as_u64;
159  out2in_kv.value = s - dm->per_thread_data[thread_index].sessions;
160  clib_bihash_add_del_8_8 (&dm->per_thread_data[thread_index].out2in,
161  &out2in_kv, 1);
162 
163  nat_syslog_dslite_apmadd (b4_index, &s->in2out.softwire_id, &s->in2out.addr,
164  s->in2out.port, &s->out2in.addr, s->out2in.port,
165  s->in2out.proto);
166 
167  return next;
168 }
169 
170 static inline u32
172  ip4_header_t * ip4, dslite_session_t ** sp, u32 next,
173  u8 * error, u32 thread_index)
174 {
175  dslite_session_t *s = 0;
176  icmp46_header_t *icmp = ip4_next_header (ip4);
179  u32 n = next;
180  icmp_echo_header_t *echo;
181  u32 new_addr, old_addr;
182  u16 old_id, new_id;
183  ip_csum_t sum;
184 
185  if (icmp_is_error_message (icmp))
186  {
188  *error = DSLITE_ERROR_BAD_ICMP_TYPE;
189  goto done;
190  }
191 
192  echo = (icmp_echo_header_t *) (icmp + 1);
193 
194  key.addr = ip4->src_address;
195  key.port = echo->identifier;
196  key.proto = SNAT_PROTOCOL_ICMP;
197  key.softwire_id.as_u64[0] = ip6->src_address.as_u64[0];
198  key.softwire_id.as_u64[1] = ip6->src_address.as_u64[1];
199  key.pad = 0;
200  kv.key[0] = key.as_u64[0];
201  kv.key[1] = key.as_u64[1];
202  kv.key[2] = key.as_u64[2];
203 
204  if (clib_bihash_search_24_8
205  (&dm->per_thread_data[thread_index].in2out, &kv, &value))
206  {
207  n = slow_path (dm, &key, &s, next, error, thread_index);
209  goto done;
210  }
211  else
212  {
213  s =
214  pool_elt_at_index (dm->per_thread_data[thread_index].sessions,
215  value.value);
216  }
217 
218  old_addr = ip4->src_address.as_u32;
219  ip4->src_address = s->out2in.addr;
220  new_addr = ip4->src_address.as_u32;
221  sum = ip4->checksum;
222  sum = ip_csum_update (sum, old_addr, new_addr, ip4_header_t, src_address);
223  ip4->checksum = ip_csum_fold (sum);
224 
225  old_id = echo->identifier;
226  echo->identifier = new_id = s->out2in.port;
227  sum = icmp->checksum;
228  sum = ip_csum_update (sum, old_id, new_id, icmp_echo_header_t, identifier);
229  icmp->checksum = ip_csum_fold (sum);
230 
231 done:
232  *sp = s;
233  return n;
234 }
235 
236 static inline uword
238  vlib_frame_t * frame, u8 is_slow_path)
239 {
240  u32 n_left_from, *from, *to_next;
241  dslite_in2out_next_t next_index;
242  u32 node_index;
243  vlib_node_runtime_t *error_node;
244  u32 thread_index = vm->thread_index;
245  f64 now = vlib_time_now (vm);
246  dslite_main_t *dm = &dslite_main;
247 
248  node_index =
249  is_slow_path ? dm->dslite_in2out_slowpath_node_index :
251 
252  error_node = vlib_node_get_runtime (vm, node_index);
253 
254  from = vlib_frame_vector_args (frame);
255  n_left_from = frame->n_vectors;
256  next_index = node->cached_next_index;
257 
258  while (n_left_from > 0)
259  {
260  u32 n_left_to_next;
261 
262  vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
263 
264  while (n_left_from > 0 && n_left_to_next > 0)
265  {
266  u32 bi0;
267  vlib_buffer_t *b0;
269  ip4_header_t *ip40;
270  ip6_header_t *ip60;
271  u8 error0 = DSLITE_ERROR_IN2OUT;
272  u32 proto0;
273  dslite_session_t *s0 = 0;
274  clib_bihash_kv_24_8_t kv0, value0;
276  udp_header_t *udp0;
277  tcp_header_t *tcp0;
278  ip_csum_t sum0;
279  u32 new_addr0, old_addr0;
280  u16 old_port0, new_port0;
281 
282  /* speculatively enqueue b0 to the current next frame */
283  bi0 = from[0];
284  to_next[0] = bi0;
285  from += 1;
286  to_next += 1;
287  n_left_from -= 1;
288  n_left_to_next -= 1;
289 
290  b0 = vlib_get_buffer (vm, bi0);
291  ip60 = vlib_buffer_get_current (b0);
292 
293  if (PREDICT_FALSE (ip60->protocol != IP_PROTOCOL_IP_IN_IP))
294  {
295  if (ip60->protocol == IP_PROTOCOL_ICMP6)
296  {
298  goto trace0;
299  }
300  error0 = DSLITE_ERROR_BAD_IP6_PROTOCOL;
301  next0 = DSLITE_IN2OUT_NEXT_DROP;
302  goto trace0;
303  }
304 
305  ip40 = vlib_buffer_get_current (b0) + sizeof (ip6_header_t);
306  proto0 = ip_proto_to_snat_proto (ip40->protocol);
307 
308  if (PREDICT_FALSE (proto0 == ~0))
309  {
310  error0 = DSLITE_ERROR_UNSUPPORTED_PROTOCOL;
311  next0 = DSLITE_IN2OUT_NEXT_DROP;
312  goto trace0;
313  }
314 
315  udp0 = ip4_next_header (ip40);
316  tcp0 = (tcp_header_t *) udp0;
317 
318  if (is_slow_path)
319  {
320  if (PREDICT_FALSE (proto0 == SNAT_PROTOCOL_ICMP))
321  {
322  next0 =
323  dslite_icmp_in2out (dm, ip60, ip40, &s0, next0, &error0,
324  thread_index);
325  if (PREDICT_FALSE (next0 == DSLITE_IN2OUT_NEXT_DROP))
326  goto trace0;
327 
328  goto accounting0;
329  }
330  }
331  else
332  {
333  if (PREDICT_FALSE (proto0 == SNAT_PROTOCOL_ICMP))
334  {
336  goto trace0;
337  }
338  }
339 
340  key0.addr = ip40->src_address;
341  key0.port = udp0->src_port;
342  key0.proto = proto0;
343  key0.softwire_id.as_u64[0] = ip60->src_address.as_u64[0];
344  key0.softwire_id.as_u64[1] = ip60->src_address.as_u64[1];
345  key0.pad = 0;
346  kv0.key[0] = key0.as_u64[0];
347  kv0.key[1] = key0.as_u64[1];
348  kv0.key[2] = key0.as_u64[2];
349 
350  if (clib_bihash_search_24_8
351  (&dm->per_thread_data[thread_index].in2out, &kv0, &value0))
352  {
353  if (is_slow_path)
354  {
355  next0 =
356  slow_path (dm, &key0, &s0, next0, &error0, thread_index);
357  if (PREDICT_FALSE (next0 == DSLITE_IN2OUT_NEXT_DROP))
358  goto trace0;
359  }
360  else
361  {
363  goto trace0;
364  }
365  }
366  else
367  {
368  s0 =
369  pool_elt_at_index (dm->per_thread_data[thread_index].sessions,
370  value0.value);
371  }
372 
373  old_addr0 = ip40->src_address.as_u32;
374  ip40->src_address = s0->out2in.addr;
375  new_addr0 = ip40->src_address.as_u32;
376  sum0 = ip40->checksum;
377  sum0 =
378  ip_csum_update (sum0, old_addr0, new_addr0, ip4_header_t,
379  src_address);
380  ip40->checksum = ip_csum_fold (sum0);
381  if (PREDICT_TRUE (proto0 == SNAT_PROTOCOL_TCP))
382  {
383  old_port0 = tcp0->src_port;
384  tcp0->src_port = s0->out2in.port;
385  new_port0 = tcp0->src_port;
386 
387  sum0 = tcp0->checksum;
388  sum0 =
389  ip_csum_update (sum0, old_addr0, new_addr0, ip4_header_t,
390  dst_address);
391  sum0 =
392  ip_csum_update (sum0, old_port0, new_port0, ip4_header_t,
393  length);
394  mss_clamping (&snat_main, tcp0, &sum0);
395  tcp0->checksum = ip_csum_fold (sum0);
396  }
397  else
398  {
399  old_port0 = udp0->src_port;
400  udp0->src_port = s0->out2in.port;
401  udp0->checksum = 0;
402  }
403 
404  accounting0:
405  /* Accounting */
406  s0->last_heard = now;
407  s0->total_pkts++;
408  s0->total_bytes += vlib_buffer_length_in_chain (vm, b0);
409  /* Per-B4 LRU list maintenance */
410  clib_dlist_remove (dm->per_thread_data[thread_index].list_pool,
411  s0->per_b4_index);
412  clib_dlist_addtail (dm->per_thread_data[thread_index].list_pool,
413  s0->per_b4_list_head_index, s0->per_b4_index);
414 
415  ip40->tos =
416  (clib_net_to_host_u32
417  (ip60->ip_version_traffic_class_and_flow_label) & 0x0ff00000) >>
418  20;
419  vlib_buffer_advance (b0, sizeof (ip6_header_t));
420 
421  trace0:
423  && (b0->flags & VLIB_BUFFER_IS_TRACED)))
424  {
425  dslite_trace_t *t = vlib_add_trace (vm, node, b0, sizeof (*t));
426  t->next_index = next0;
427  t->session_index = ~0;
428  if (s0)
429  t->session_index =
430  s0 - dm->per_thread_data[thread_index].sessions;
431  }
432 
433  b0->error = error_node->errors[error0];
434 
435  /* verify speculative enqueue, maybe switch current next frame */
436  vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next,
437  n_left_to_next, bi0, next0);
438  }
439  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
440  }
441 
442  return frame->n_vectors;
443 }
444 
446  vlib_node_runtime_t * node,
447  vlib_frame_t * frame)
448 {
449  return dslite_in2out_node_fn_inline (vm, node, frame, 0);
450 }
451 
452 /* *INDENT-OFF* */
454  .name = "dslite-in2out",
455  .vector_size = sizeof (u32),
456  .format_trace = format_dslite_trace,
459  .error_strings = dslite_in2out_error_strings,
460  .n_next_nodes = DSLITE_IN2OUT_N_NEXT,
461  /* edit / add dispositions here */
462  .next_nodes = {
463  [DSLITE_IN2OUT_NEXT_DROP] = "error-drop",
464  [DSLITE_IN2OUT_NEXT_IP4_LOOKUP] = "ip4-lookup",
465  [DSLITE_IN2OUT_NEXT_IP6_ICMP] = "ip6-icmp-input",
466  [DSLITE_IN2OUT_NEXT_SLOWPATH] = "dslite-in2out-slowpath",
467  },
468 };
469 /* *INDENT-ON* */
470 
472  vlib_node_runtime_t * node,
473  vlib_frame_t * frame)
474 {
475  return dslite_in2out_node_fn_inline (vm, node, frame, 1);
476 }
477 
478 /* *INDENT-OFF* */
480  .name = "dslite-in2out-slowpath",
481  .vector_size = sizeof (u32),
482  .format_trace = format_dslite_trace,
485  .error_strings = dslite_in2out_error_strings,
486  .n_next_nodes = DSLITE_IN2OUT_N_NEXT,
487  /* edit / add dispositions here */
488  .next_nodes = {
489  [DSLITE_IN2OUT_NEXT_DROP] = "error-drop",
490  [DSLITE_IN2OUT_NEXT_IP4_LOOKUP] = "ip4-lookup",
491  [DSLITE_IN2OUT_NEXT_IP6_ICMP] = "ip6-lookup",
492  [DSLITE_IN2OUT_NEXT_SLOWPATH] = "dslite-in2out-slowpath",
493  },
494 };
495 /* *INDENT-ON* */
496 
497 /*
498  * fd.io coding-style-patch-verification: ON
499  *
500  * Local Variables:
501  * eval: (c-set-style "gnu")
502  * End:
503  */
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
Definition: buffer.h:124
static void clib_dlist_init(dlist_elt_t *pool, u32 index)
Definition: dlist.h:36
ip4_address_t src_address
Definition: ip4_packet.h:170
u16 port_per_thread
Definition: dslite.h:88
u8 * format_dslite_trace(u8 *s, va_list *args)
Definition: dslite.c:241
#define PREDICT_TRUE(x)
Definition: clib.h:112
u64 as_u64[2]
Definition: ip6_packet.h:51
static_always_inline u8 icmp_is_error_message(icmp46_header_t *icmp)
Definition: nat_inlines.h:54
dslite_in2out_next_t
Definition: dslite_in2out.c:19
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static f64 vlib_time_now(vlib_main_t *vm)
Definition: main.h:279
u32 thread_index
Definition: main.h:218
uword ip_csum_t
Definition: ip_packet.h:219
#define VLIB_NODE_FN(node)
Definition: node.h:202
vlib_error_t * errors
Vector of errors for this node.
Definition: node.h:470
u32 session_index
Definition: dslite.h:107
clib_bihash_16_8_t b4_hash
Definition: dslite.h:66
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:366
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
Definition: pool.h:236
struct _tcp_header tcp_header_t
ip6_address_t src_address
Definition: ip6_packet.h:383
unsigned char u8
Definition: types.h:56
double f64
Definition: types.h:142
static uword dslite_in2out_node_fn_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u8 is_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:35
ip6_address_t addr
Definition: dslite.h:54
static void * ip4_next_header(ip4_header_t *i)
Definition: ip4_packet.h:241
unsigned int u32
Definition: types.h:88
static char * dslite_in2out_error_strings[]
Definition: dslite_in2out.c:28
void snat_free_outside_address_and_port(snat_address_t *addresses, u32 thread_index, snat_session_key_t *k)
Free outside address and port pair.
Definition: nat.c:2448
dlist_elt_t * list_pool
Definition: dslite.h:75
vl_api_fib_path_type_t type
Definition: fib_types.api:123
vlib_error_t error
Error code for buffers to be enqueued to error handler.
Definition: buffer.h:136
static void mss_clamping(snat_main_t *sm, tcp_header_t *tcp, ip_csum_t *sum)
Definition: nat_inlines.h:448
int snat_alloc_outside_address_and_port(snat_address_t *addresses, u32 fib_index, u32 thread_index, snat_session_key_t *k, u16 port_per_thread, u32 snat_thread_index)
Alloc outside address and port.
Definition: nat.c:2681
clib_bihash_8_8_t out2in
Definition: dslite.h:62
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:514
u32 dslite_in2out_slowpath_node_index
Definition: dslite.h:96
u64 key
the key
Definition: bihash_8_8.h:35
static void clib_dlist_addtail(dlist_elt_t *pool, u32 head_index, u32 new_index)
Definition: dlist.h:43
unsigned short u16
Definition: types.h:57
u16 protocol
Definition: nat.h:55
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
Definition: buffer.h:229
void nat_syslog_dslite_apmadd(u32 ssubix, ip6_address_t *sv6enc, ip4_address_t *isaddr, u16 isport, ip4_address_t *xsaddr, u16 xsport, snat_protocol_t proto)
Definition: nat_syslog.c:127
#define PREDICT_FALSE(x)
Definition: clib.h:111
vl_api_address_union_t src_address
Definition: ip_types.api:97
snat_address_t * addr_pool
Definition: dslite.h:85
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:94
#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:218
#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:338
snat_main_t snat_main
Definition: nat.c:39
u64 value
the value
Definition: bihash_8_8.h:36
#define VLIB_REGISTER_NODE(x,...)
Definition: node.h:169
u16 n_vectors
Definition: node.h:397
vlib_main_t * vm
Definition: buffer.c:323
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:89
dslite_main_t dslite_main
Definition: dslite.c:19
8 octet key, 8 octet key value pair
Definition: bihash_8_8.h:33
#define ARRAY_LEN(x)
Definition: clib.h:62
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
Definition: main.c:456
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
Definition: node.h:515
u8 value
Definition: qos.api:53
#define ASSERT(truth)
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)
u32 nsessions
Definition: dslite.h:56
ip_dscp_t tos
Definition: ip4_packet.h:141
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
Definition: buffer.h:248
static void clib_dlist_remove(dlist_elt_t *pool, u32 index)
Definition: dlist.h:99
vlib_simple_counter_main_t total_b4s
Definition: dslite.h:91
dslite_b4_t * b4s
Definition: dslite.h:69
u32 value
Definition: dlist.h:32
dslite_per_thread_data_t * per_thread_data
Definition: dslite.h:84
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
Definition: trace_funcs.h:55
u32 ip_version_traffic_class_and_flow_label
Definition: ip6_packet.h:370
static u32 ip_proto_to_snat_proto(u8 ip_proto)
The NAT inline functions.
Definition: nat_inlines.h:27
u32 next_index
Definition: dslite.h:106
vlib_simple_counter_main_t total_sessions
Definition: dslite.h:92
VLIB buffer representation.
Definition: buffer.h:102
u64 uword
Definition: types.h:112
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
Definition: node_funcs.h:244
typedef key
Definition: ipsec.api:247
#define ip_csum_update(sum, old, new, type, field)
Definition: ip_packet.h:269
NAT syslog logging.
ip6_address_t softwire_id
Definition: dslite.h:29
dslite_session_t * sessions
Definition: dslite.h:72
vlib_node_registration_t dslite_in2out_node
(constructor) VLIB_REGISTER_NODE (dslite_in2out_node)
vlib_node_registration_t dslite_in2out_slowpath_node
(constructor) VLIB_REGISTER_NODE (dslite_in2out_slowpath_node)
#define foreach_dslite_error
Definition: dslite.h:115
u16 flags
Copy of main node flags.
Definition: node.h:509
void nat_syslog_dslite_apmdel(u32 ssubix, ip6_address_t *sv6enc, ip4_address_t *isaddr, u16 isport, ip4_address_t *xsaddr, u16 xsport, snat_protocol_t proto)
Definition: nat_syslog.c:137
clib_bihash_24_8_t in2out
Definition: dslite.h:63
#define VLIB_NODE_FLAG_TRACE
Definition: node.h:302
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
Definition: buffer_funcs.h:85
u32 sessions_per_b4_list_head_index
Definition: dslite.h:55
static u16 ip_csum_fold(ip_csum_t c)
Definition: ip_packet.h:275
u32 dslite_in2out_node_index
Definition: dslite.h:95
ip4_address_t addr
Definition: dslite.h:30
u16 fib_index
Definition: nat.h:55
static u32 clib_dlist_remove_head(dlist_elt_t *pool, u32 head_index)
Definition: dlist.h:117
static uword pool_elts(void *v)
Number of active elements in a pool.
Definition: pool.h:128