FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
node.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 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 <vlib/vlib.h>
16 #include <vnet/vnet.h>
17 #include <vppinfra/error.h>
18 #include <srv6-as/as.h>
19 
20 
21 /******************************* Packet tracing *******************************/
22 
23 typedef struct
24 {
27 
28 typedef struct
29 {
31  ip6_address_t src, dst;
33 
34 static u8 *
35 format_srv6_as_localsid_trace (u8 * s, va_list * args)
36 {
37  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
38  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
40 
41  return format (s, "SRv6-AS-localsid: localsid_index %d", t->localsid_index);
42 }
43 
44 static u8 *
45 format_srv6_as_rewrite_trace (u8 * s, va_list * args)
46 {
47  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
48  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
49  srv6_as_rewrite_trace_t *t = va_arg (*args, srv6_as_rewrite_trace_t *);
50 
51  if (PREDICT_FALSE (t->error != 0))
52  {
53  return format (s, "SRv6-AS-rewrite: cache is empty");
54  }
55 
56  return format (s, "SRv6-AS-rewrite: src %U dst %U",
58 }
59 
60 
61 /***************************** Nodes registration *****************************/
62 
65 
66 
67 /****************************** Packet counters *******************************/
68 
69 #define foreach_srv6_as_rewrite_counter \
70 _(PROCESSED, "srv6-as rewritten packets") \
71 _(NO_RW, "(Error) No header for rewriting.")
72 
73 typedef enum
74 {
75 #define _(sym,str) SRV6_AS_REWRITE_COUNTER_##sym,
77 #undef _
80 
82 #define _(sym,string) string,
84 #undef _
85 };
86 
87 
88 /********************************* Next nodes *********************************/
89 
90 typedef enum
91 {
98 
99 typedef enum
100 {
105 
106 
107 /******************************* Local SID node *******************************/
108 
109 /**
110  * @brief Function doing SRH processing for AS behavior
111  */
114  ip6_header_t * ip0,
115  srv6_as_localsid_t * ls0_mem, u32 * next0)
116 {
117  u16 encap_len;
118  ip6_ext_header_t *ext_hdr;
119  u8 hdr_type;
120 
121  /* Compute encapsulation headers length */
122  encap_len = sizeof (ip6_header_t);
123  ext_hdr = (ip6_ext_header_t *) (ip0 + 1);
124  hdr_type = ip0->protocol;
125 
126  while (ip6_ext_hdr (hdr_type))
127  {
128  encap_len += ip6_ext_header_len (ext_hdr);
129  hdr_type = ext_hdr->next_hdr;
130  ext_hdr = ip6_ext_next_header (ext_hdr);
131  }
132 
133  /* Make sure next header is valid */
134  if (PREDICT_FALSE (hdr_type != IP_PROTOCOL_IPV6 &&
135  hdr_type != IP_PROTOCOL_IP_IN_IP &&
136  hdr_type != IP_PROTOCOL_IP6_ETHERNET))
137  {
138  return;
139  }
140 
141  /* Remove IP header and extensions */
142  vlib_buffer_advance (b0, encap_len);
143 
144  if (hdr_type == IP_PROTOCOL_IP6_ETHERNET)
145  {
146  /* Set output interface */
147  vnet_buffer (b0)->sw_if_index[VLIB_TX] = ls0_mem->sw_if_index_out;
148 
149  /* Set next node to interface-output */
151  }
152  else
153  {
154  /* Set Xconnect adjacency to VNF */
155  vnet_buffer (b0)->ip.adj_index[VLIB_TX] = ls0_mem->nh_adj;
156 
157  /* Set next node to ip-rewrite */
158  *next0 = (hdr_type == IP_PROTOCOL_IPV6) ?
160  }
161 }
162 
163 /**
164  * @brief SRv6 AS Localsid graph node
165  */
166 static uword
169 {
170  ip6_sr_main_t *sm = &sr_main;
171  u32 n_left_from, next_index, *from, *to_next;
172  u32 cnt_packets = 0;
173 
175  n_left_from = frame->n_vectors;
176  next_index = node->cached_next_index;
177 
178  while (n_left_from > 0)
179  {
180  u32 n_left_to_next;
181 
182  vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
183 
184  /* TODO: Dual/quad loop */
185 
186  while (n_left_from > 0 && n_left_to_next > 0)
187  {
188  u32 bi0;
189  vlib_buffer_t *b0;
190  ip6_header_t *ip0 = 0;
191  ip6_sr_localsid_t *ls0;
193 
194  bi0 = from[0];
195  to_next[0] = bi0;
196  from += 1;
197  to_next += 1;
198  n_left_from -= 1;
199  n_left_to_next -= 1;
200 
201  b0 = vlib_get_buffer (vm, bi0);
202  ip0 = vlib_buffer_get_current (b0);
203 
204  /* Lookup the SR End behavior based on IP DA (adj) */
205  ls0 = pool_elt_at_index (sm->localsids,
206  vnet_buffer (b0)->ip.adj_index[VLIB_TX]);
207 
208  /* SRH processing */
209  end_as_processing (b0, ip0, ls0->plugin_mem, &next0);
210 
211  if (PREDICT_FALSE (b0->flags & VLIB_BUFFER_IS_TRACED))
212  {
214  vlib_add_trace (vm, node, b0, sizeof *tr);
215  tr->localsid_index = ls0 - sm->localsids;
216  }
217 
218  /* This increments the SRv6 per LocalSID counters. */
221  &(sm->sr_ls_invalid_counters) :
222  &(sm->sr_ls_valid_counters)),
223  vm->thread_index,
224  ls0 - sm->localsids, 1,
226  b0));
227 
229  n_left_to_next, bi0, next0);
230 
231  cnt_packets++;
232  }
233 
234  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
235  }
236 
237  return frame->n_vectors;
238 }
239 
240 /* *INDENT-OFF* */
242  .function = srv6_as_localsid_fn,
243  .name = "srv6-as-localsid",
244  .vector_size = sizeof (u32),
245  .format_trace = format_srv6_as_localsid_trace,
247  .n_next_nodes = SRV6_AS_LOCALSID_N_NEXT,
248  .next_nodes = {
249  [SRV6_AS_LOCALSID_NEXT_REWRITE4] = "ip4-rewrite",
250  [SRV6_AS_LOCALSID_NEXT_REWRITE6] = "ip6-rewrite",
251  [SRV6_AS_LOCALSID_NEXT_INTERFACE] = "interface-output",
252  [SRV6_AS_LOCALSID_NEXT_ERROR] = "error-drop",
253  },
254 };
255 /* *INDENT-ON* */
256 
257 
258 /******************************* Rewriting node *******************************/
259 
260 /**
261  * @brief Graph node for applying a SR policy into an IPv6 packet. Encapsulation
262  */
263 static uword
266 {
267  ip6_sr_main_t *srm = &sr_main;
269  u32 n_left_from, next_index, *from, *to_next;
270  u32 cnt_packets = 0;
271 
273  n_left_from = frame->n_vectors;
274  next_index = node->cached_next_index;
275 
276  while (n_left_from > 0)
277  {
278  u32 n_left_to_next;
279 
280  vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
281 
282  /* TODO: Dual/quad loop */
283 
284  while (n_left_from > 0 && n_left_to_next > 0)
285  {
286  u32 bi0;
287  vlib_buffer_t *b0;
288  ethernet_header_t *en0;
289  ip6_header_t *ip0 = 0;
290  ip6_sr_localsid_t *ls0;
291  srv6_as_localsid_t *ls0_mem;
293 
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  en0 = vlib_buffer_get_current (b0);
303  ls0 = pool_elt_at_index (srm->localsids,
305  (b0)->sw_if_index
306  [VLIB_RX]]);
307  ls0_mem = ls0->plugin_mem;
308 
309  if (PREDICT_FALSE (ls0_mem == NULL || ls0_mem->rewrite == NULL))
310  {
312  b0->error = node->errors[SRV6_AS_REWRITE_COUNTER_NO_RW];
313  }
314  else
315  {
317  (vec_len (ls0_mem->rewrite) + b0->current_data));
318 
319  clib_memcpy_fast (((u8 *) en0) - vec_len (ls0_mem->rewrite),
320  ls0_mem->rewrite, vec_len (ls0_mem->rewrite));
321  vlib_buffer_advance (b0, -(word) vec_len (ls0_mem->rewrite));
322 
323  ip0 = vlib_buffer_get_current (b0);
324 
325  ip0->payload_length =
326  clib_host_to_net_u16 (b0->current_length -
327  sizeof (ip6_header_t));
328  }
329 
330  if (PREDICT_FALSE (node->flags & VLIB_NODE_FLAG_TRACE) &&
331  PREDICT_FALSE (b0->flags & VLIB_BUFFER_IS_TRACED))
332  {
334  vlib_add_trace (vm, node, b0, sizeof *tr);
335  tr->error = 0;
336 
337  if (next0 == SRV6_AS_REWRITE_NEXT_ERROR)
338  {
339  tr->error = 1;
340  }
341  else
342  {
343  clib_memcpy_fast (tr->src.as_u8, ip0->src_address.as_u8,
344  sizeof tr->src.as_u8);
345  clib_memcpy_fast (tr->dst.as_u8, ip0->dst_address.as_u8,
346  sizeof tr->dst.as_u8);
347  }
348  }
349 
350  /* Increment per-SID AS rewrite counters */
353  &(sm->invalid_counters) :
354  &(sm->valid_counters)),
355  vm->thread_index, ls0_mem->index,
357  b0));
358 
360  n_left_to_next, bi0, next0);
361 
362  cnt_packets++;
363  }
364 
365  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
366  }
367 
368  /* Update counters */
370  SRV6_AS_REWRITE_COUNTER_PROCESSED,
371  cnt_packets);
372 
373  return frame->n_vectors;
374 }
375 
376 /* *INDENT-OFF* */
378  .function = srv6_as2_rewrite_fn,
379  .name = "srv6-as2-rewrite",
380  .vector_size = sizeof (u32),
381  .format_trace = format_srv6_as_rewrite_trace,
383  .n_errors = SRV6_AS_REWRITE_N_COUNTERS,
384  .error_strings = srv6_as_rewrite_counter_strings,
385  .n_next_nodes = SRV6_AS_REWRITE_N_NEXT,
386  .next_nodes = {
387  [SRV6_AS_REWRITE_NEXT_LOOKUP] = "ip6-lookup",
388  [SRV6_AS_REWRITE_NEXT_ERROR] = "error-drop",
389  },
390 };
391 /* *INDENT-ON* */
392 
393 
394 /**
395  * @brief Graph node for applying a SR policy into an IPv6 packet. Encapsulation
396  */
397 static uword
400 {
401  ip6_sr_main_t *srm = &sr_main;
403  u32 n_left_from, next_index, *from, *to_next;
404  u32 cnt_packets = 0;
405 
407  n_left_from = frame->n_vectors;
408  next_index = node->cached_next_index;
409 
410  while (n_left_from > 0)
411  {
412  u32 n_left_to_next;
413 
414  vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
415 
416  /* TODO: Dual/quad loop */
417 
418  while (n_left_from > 0 && n_left_to_next > 0)
419  {
420  u32 bi0;
421  vlib_buffer_t *b0;
422  ip4_header_t *ip0_encap = 0;
423  ip6_header_t *ip0 = 0;
424  ip6_sr_localsid_t *ls0;
425  srv6_as_localsid_t *ls0_mem;
427  u16 new_l0 = 0;
428 
429  bi0 = from[0];
430  to_next[0] = bi0;
431  from += 1;
432  to_next += 1;
433  n_left_from -= 1;
434  n_left_to_next -= 1;
435 
436  b0 = vlib_get_buffer (vm, bi0);
437  ip0_encap = vlib_buffer_get_current (b0);
438  ls0 = pool_elt_at_index (srm->localsids,
440  (b0)->sw_if_index
441  [VLIB_RX]]);
442  ls0_mem = ls0->plugin_mem;
443 
444  if (PREDICT_FALSE (ls0_mem == NULL || ls0_mem->rewrite == NULL))
445  {
447  b0->error = node->errors[SRV6_AS_REWRITE_COUNTER_NO_RW];
448  }
449  else
450  {
452  (vec_len (ls0_mem->rewrite) + b0->current_data));
453 
454  clib_memcpy_fast (((u8 *) ip0_encap) -
455  vec_len (ls0_mem->rewrite), ls0_mem->rewrite,
456  vec_len (ls0_mem->rewrite));
457  vlib_buffer_advance (b0, -(word) vec_len (ls0_mem->rewrite));
458 
459  ip0 = vlib_buffer_get_current (b0);
460 
461  /* Update inner IPv4 TTL and checksum */
462  u32 checksum0;
463  ip0_encap->ttl -= 1;
464  checksum0 = ip0_encap->checksum + clib_host_to_net_u16 (0x0100);
465  checksum0 += checksum0 >= 0xffff;
466  ip0_encap->checksum = checksum0;
467 
468  /* Update outer IPv6 length (in case it has changed) */
469  new_l0 = vec_len (ls0_mem->rewrite) - sizeof (ip6_header_t) +
470  clib_net_to_host_u16 (ip0_encap->length);
471  ip0->payload_length = clib_host_to_net_u16 (new_l0);
472  }
473 
474  if (PREDICT_FALSE (node->flags & VLIB_NODE_FLAG_TRACE) &&
475  PREDICT_FALSE (b0->flags & VLIB_BUFFER_IS_TRACED))
476  {
478  vlib_add_trace (vm, node, b0, sizeof *tr);
479  tr->error = 0;
480 
481  if (next0 == SRV6_AS_REWRITE_NEXT_ERROR)
482  {
483  tr->error = 1;
484  }
485  else
486  {
487  clib_memcpy_fast (tr->src.as_u8, ip0->src_address.as_u8,
488  sizeof tr->src.as_u8);
489  clib_memcpy_fast (tr->dst.as_u8, ip0->dst_address.as_u8,
490  sizeof tr->dst.as_u8);
491  }
492  }
493 
494  /* Increment per-SID AS rewrite counters */
497  &(sm->invalid_counters) :
498  &(sm->valid_counters)),
499  vm->thread_index, ls0_mem->index,
501  b0));
502 
504  n_left_to_next, bi0, next0);
505 
506  cnt_packets++;
507  }
508 
509  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
510  }
511 
512  /* Update counters */
514  SRV6_AS_REWRITE_COUNTER_PROCESSED,
515  cnt_packets);
516 
517  return frame->n_vectors;
518 }
519 
520 /* *INDENT-OFF* */
522  .function = srv6_as4_rewrite_fn,
523  .name = "srv6-as4-rewrite",
524  .vector_size = sizeof (u32),
525  .format_trace = format_srv6_as_rewrite_trace,
527  .n_errors = SRV6_AS_REWRITE_N_COUNTERS,
528  .error_strings = srv6_as_rewrite_counter_strings,
529  .n_next_nodes = SRV6_AS_REWRITE_N_NEXT,
530  .next_nodes = {
531  [SRV6_AS_REWRITE_NEXT_LOOKUP] = "ip6-lookup",
532  [SRV6_AS_REWRITE_NEXT_ERROR] = "error-drop",
533  },
534 };
535 /* *INDENT-ON* */
536 
537 
538 /**
539  * @brief Graph node for applying a SR policy into an IPv6 packet. Encapsulation
540  */
541 static uword
544 {
545  ip6_sr_main_t *srm = &sr_main;
547  u32 n_left_from, next_index, *from, *to_next;
548  u32 cnt_packets = 0;
549 
551  n_left_from = frame->n_vectors;
552  next_index = node->cached_next_index;
553 
554  while (n_left_from > 0)
555  {
556  u32 n_left_to_next;
557 
558  vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
559 
560  /* TODO: Dual/quad loop */
561 
562  while (n_left_from > 0 && n_left_to_next > 0)
563  {
564  u32 bi0;
565  vlib_buffer_t *b0;
566  ip6_header_t *ip0 = 0, *ip0_encap = 0;
567  ip6_sr_localsid_t *ls0;
568  srv6_as_localsid_t *ls0_mem;
570  u16 new_l0 = 0;
571 
572  bi0 = from[0];
573  to_next[0] = bi0;
574  from += 1;
575  to_next += 1;
576  n_left_from -= 1;
577  n_left_to_next -= 1;
578 
579  b0 = vlib_get_buffer (vm, bi0);
580  ip0_encap = vlib_buffer_get_current (b0);
581  ls0 = pool_elt_at_index (srm->localsids,
583  (b0)->sw_if_index
584  [VLIB_RX]]);
585  ls0_mem = ls0->plugin_mem;
586 
587  if (PREDICT_FALSE (ls0_mem == NULL || ls0_mem->rewrite == NULL))
588  {
590  b0->error = node->errors[SRV6_AS_REWRITE_COUNTER_NO_RW];
591  }
592  else
593  {
595  (vec_len (ls0_mem->rewrite) + b0->current_data));
596 
597  clib_memcpy_fast (((u8 *) ip0_encap) -
598  vec_len (ls0_mem->rewrite), ls0_mem->rewrite,
599  vec_len (ls0_mem->rewrite));
600  vlib_buffer_advance (b0, -(word) vec_len (ls0_mem->rewrite));
601 
602  ip0 = vlib_buffer_get_current (b0);
603 
604  /* Update inner IPv6 hop limit */
605  ip0_encap->hop_limit -= 1;
606 
607  /* Update outer IPv6 length (in case it has changed) */
608  new_l0 = vec_len (ls0_mem->rewrite) +
609  clib_net_to_host_u16 (ip0_encap->payload_length);
610  ip0->payload_length = clib_host_to_net_u16 (new_l0);
611  }
612 
613  if (PREDICT_FALSE (node->flags & VLIB_NODE_FLAG_TRACE) &&
614  PREDICT_FALSE (b0->flags & VLIB_BUFFER_IS_TRACED))
615  {
617  vlib_add_trace (vm, node, b0, sizeof *tr);
618  tr->error = 0;
619 
620  if (next0 == SRV6_AS_REWRITE_NEXT_ERROR)
621  {
622  tr->error = 1;
623  }
624  else
625  {
626  clib_memcpy_fast (tr->src.as_u8, ip0->src_address.as_u8,
627  sizeof tr->src.as_u8);
628  clib_memcpy_fast (tr->dst.as_u8, ip0->dst_address.as_u8,
629  sizeof tr->dst.as_u8);
630  }
631  }
632 
633  /* Increment per-SID AS rewrite counters */
636  &(sm->invalid_counters) :
637  &(sm->valid_counters)),
638  vm->thread_index, ls0_mem->index,
640  b0));
641 
643  n_left_to_next, bi0, next0);
644 
645  cnt_packets++;
646  }
647 
648  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
649  }
650 
651  /* Update counters */
653  SRV6_AS_REWRITE_COUNTER_PROCESSED,
654  cnt_packets);
655 
656  return frame->n_vectors;
657 }
658 
659 /* *INDENT-OFF* */
661  .function = srv6_as6_rewrite_fn,
662  .name = "srv6-as6-rewrite",
663  .vector_size = sizeof (u32),
664  .format_trace = format_srv6_as_rewrite_trace,
666  .n_errors = SRV6_AS_REWRITE_N_COUNTERS,
667  .error_strings = srv6_as_rewrite_counter_strings,
668  .n_next_nodes = SRV6_AS_REWRITE_N_NEXT,
669  .next_nodes = {
670  [SRV6_AS_REWRITE_NEXT_LOOKUP] = "ip6-lookup",
671  [SRV6_AS_REWRITE_NEXT_ERROR] = "error-drop",
672  },
673 };
674 /* *INDENT-ON* */
675 
676 /*
677 * fd.io coding-style-patch-verification: ON
678 *
679 * Local Variables:
680 * eval: (c-set-style "gnu")
681 * End:
682 */
srv6_as_main_t::sw_iface_localsid6
u32 * sw_iface_localsid6
Retrieve local SID from iface.
Definition: as.h:63
vlib.h
srv6_as_localsid_trace_t
Definition: node.c:23
foreach_srv6_as_rewrite_counter
#define foreach_srv6_as_rewrite_counter
Definition: node.c:69
srv6_as4_rewrite_fn
static uword srv6_as4_rewrite_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Graph node for applying a SR policy into an IPv6 packet.
Definition: node.c:398
srv6_as_rewrite_trace_t::src
ip6_address_t src
Definition: node.c:31
ip6_sr_main_t::sr_ls_valid_counters
vlib_combined_counter_main_t sr_ls_valid_counters
Definition: sr.h:303
srv6_as_localsid_next_t
srv6_as_localsid_next_t
Definition: node.c:90
frame
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
Definition: nat44_ei.c:3048
format_srv6_as_rewrite_trace
static u8 * format_srv6_as_rewrite_trace(u8 *s, va_list *args)
Definition: node.c:45
next_index
nat44_ei_hairpin_src_next_t next_index
Definition: nat44_ei_hairpinning.c:412
end_as_processing
static_always_inline void end_as_processing(vlib_buffer_t *b0, ip6_header_t *ip0, srv6_as_localsid_t *ls0_mem, u32 *next0)
Function doing SRH processing for AS behavior.
Definition: node.c:113
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
srv6_as_rewrite_trace_t::dst
ip6_address_t dst
Definition: node.c:31
srv6_as_main_t::invalid_counters
vlib_combined_counter_main_t invalid_counters
Invalid rewrite counters.
Definition: as.h:68
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:549
ip6_sr_localsid_t
SR LocalSID.
Definition: sr.h:123
ip6_header_t::protocol
u8 protocol
Definition: ip6_packet.h:304
SRV6_AS_REWRITE_NEXT_ERROR
@ SRV6_AS_REWRITE_NEXT_ERROR
Definition: node.c:101
srv6_as6_rewrite_node
vlib_node_registration_t srv6_as6_rewrite_node
(constructor) VLIB_REGISTER_NODE (srv6_as6_rewrite_node)
Definition: node.c:64
as.h
VLIB_NODE_TYPE_INTERNAL
@ VLIB_NODE_TYPE_INTERNAL
Definition: node.h:72
ip6_sr_localsid_t::plugin_mem
void * plugin_mem
Memory to be used by the plugin callback functions.
Definition: sr.h:156
ip6_ext_header_len
#define ip6_ext_header_len(p)
Definition: ip6_packet.h:545
node
vlib_main_t vlib_node_runtime_t * node
Definition: nat44_ei.c:3047
srv6_as_main_t::sw_iface_localsid4
u32 * sw_iface_localsid4
Retrieve local SID from iface.
Definition: as.h:62
u16
unsigned short u16
Definition: types.h:57
format_srv6_as_localsid_trace
static u8 * format_srv6_as_localsid_trace(u8 *s, va_list *args)
Definition: node.c:35
SRV6_AS_REWRITE_N_NEXT
@ SRV6_AS_REWRITE_N_NEXT
Definition: node.c:103
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
VLIB_RX
@ VLIB_RX
Definition: defs.h:46
IP_PROTOCOL_IP6_ETHERNET
#define IP_PROTOCOL_IP6_ETHERNET
Definition: mobile.h:37
srv6_as_rewrite_counter_strings
static char * srv6_as_rewrite_counter_strings[]
Definition: node.c:81
vlib_frame_t
Definition: node.h:372
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
clib_memcpy_fast
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
Definition: string.h:92
ip4_header_t
Definition: ip4_packet.h:87
srv6_as_rewrite_counters
srv6_as_rewrite_counters
Definition: node.c:73
srv6_as_localsid_t::rewrite
u8 * rewrite
Headers to be rewritten.
Definition: as.h:42
srv6_as_rewrite_trace_t::error
u8 error
Definition: node.c:30
vlib_buffer_t::current_data
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
Definition: buffer.h:119
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
SRV6_AS_REWRITE_N_COUNTERS
@ SRV6_AS_REWRITE_N_COUNTERS
Definition: node.c:78
ip6_sr_main_t::sr_ls_invalid_counters
vlib_combined_counter_main_t sr_ls_invalid_counters
Definition: sr.h:304
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
vlib_buffer_t::error
vlib_error_t error
Error code for buffers to be enqueued to error handler.
Definition: buffer.h:145
error.h
CLIB_UNUSED
#define CLIB_UNUSED(x)
Definition: clib.h:90
vnet_buffer
#define vnet_buffer(b)
Definition: buffer.h:441
VLIB_NODE_FLAG_TRACE
#define VLIB_NODE_FLAG_TRACE
Definition: node.h:291
PREDICT_FALSE
#define PREDICT_FALSE(x)
Definition: clib.h:124
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
srv6_as_main_t::valid_counters
vlib_combined_counter_main_t valid_counters
Valid rewrite counters.
Definition: as.h:67
static_always_inline
#define static_always_inline
Definition: clib.h:112
uword
u64 uword
Definition: types.h:112
ethernet_header_t
Definition: packet.h:52
vlib_main_t::thread_index
u32 thread_index
Definition: main.h:215
srv6_as_localsid_t
Definition: as.h:34
vlib_node_increment_counter
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
Definition: node_funcs.h:1244
ip6_header_t::dst_address
ip6_address_t dst_address
Definition: ip6_packet.h:310
srv6_as_localsid_t::sw_if_index_out
u32 sw_if_index_out
Outgoing iface to proxied dev.
Definition: as.h:37
srv6_as_rewrite_trace_t
Definition: node.c:28
vlib_node_registration_t
struct _vlib_node_registration vlib_node_registration_t
srv6_as_localsid_t::nh_adj
u32 nh_adj
Adjacency index for out.
Definition: as.h:38
vlib_buffer_t::current_length
u16 current_length
Nbytes between current data and the end of this buffer.
Definition: buffer.h:122
sr_main
ip6_sr_main_t sr_main
Definition: sr.c:31
SRV6_AS_REWRITE_NEXT_LOOKUP
@ SRV6_AS_REWRITE_NEXT_LOOKUP
Definition: node.c:102
ip6_sr_main_t::localsids
ip6_sr_localsid_t * localsids
Definition: sr.h:273
ip6_sr_main_t
Segment Routing main datastructure.
Definition: sr.h:258
srv6_as6_rewrite_fn
static uword srv6_as6_rewrite_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Graph node for applying a SR policy into an IPv6 packet.
Definition: node.c:542
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
format
description fragment has unexpected format
Definition: map.api:433
ASSERT
#define ASSERT(truth)
Definition: error_bootstrap.h:69
srv6_as_main
srv6_as_main_t srv6_as_main
Definition: as.c:39
vlib_put_next_frame
vlib_put_next_frame(vm, node, next_index, 0)
SRV6_AS_LOCALSID_NEXT_ERROR
@ SRV6_AS_LOCALSID_NEXT_ERROR
Definition: node.c:92
VLIB_BUFFER_PRE_DATA_SIZE
#define VLIB_BUFFER_PRE_DATA_SIZE
Definition: buffer.h:51
ip6_ext_hdr
static u8 ip6_ext_hdr(u8 nexthdr)
Definition: ip6_packet.h:524
u32
unsigned int u32
Definition: types.h:88
dst
vl_api_ip4_address_t dst
Definition: pnat.api:41
SRV6_AS_LOCALSID_NEXT_REWRITE6
@ SRV6_AS_LOCALSID_NEXT_REWRITE6
Definition: node.c:94
ip6_header_t
Definition: ip6_packet.h:294
srv6_as2_rewrite_node
vlib_node_registration_t srv6_as2_rewrite_node
(constructor) VLIB_REGISTER_NODE (srv6_as2_rewrite_node)
Definition: node.c:377
ip6_header_t::src_address
ip6_address_t src_address
Definition: ip6_packet.h:310
vlib_main_t
Definition: main.h:102
vlib_node_t
Definition: node.h:247
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
vl_api_address_t ip
Definition: l2.api:558
format_ip6_address
format_function_t format_ip6_address
Definition: format.h:91
srv6_as_localsid_t::index
u32 index
Definition: as.h:47
word
i64 word
Definition: types.h:111
srv6_as_localsid_trace_t::localsid_index
u32 localsid_index
Definition: node.c:25
SRV6_AS_LOCALSID_NEXT_REWRITE4
@ SRV6_AS_LOCALSID_NEXT_REWRITE4
Definition: node.c:93
vnet.h
ip6_ext_next_header
static void * ip6_ext_next_header(ip6_ext_header_t *ext_hdr)
Definition: ip6_packet.h:549
ip6_header_t::payload_length
u16 payload_length
Definition: ip6_packet.h:301
vlib_node_runtime_t
Definition: node.h:454
from
from
Definition: nat44_ei_hairpinning.c:415
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
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
VLIB_TX
@ VLIB_TX
Definition: defs.h:47
srv6_as_localsid_fn
static uword srv6_as_localsid_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
SRv6 AS Localsid graph node.
Definition: node.c:167
n_left_from
n_left_from
Definition: nat44_ei_hairpinning.c:416
srv6_as_main_t
Definition: as.h:50
SRV6_AS_LOCALSID_NEXT_INTERFACE
@ SRV6_AS_LOCALSID_NEXT_INTERFACE
Definition: node.c:95
type
vl_api_fib_path_type_t type
Definition: fib_types.api:123
srv6_as_main_t::sw_iface_localsid2
u32 * sw_iface_localsid2
Retrieve local SID from iface.
Definition: as.h:61
vlib_increment_combined_counter
vlib_increment_combined_counter(ccm, ti, sw_if_index, n_buffers, n_bytes)
srv6_as2_rewrite_fn
static uword srv6_as2_rewrite_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Graph node for applying a SR policy into an IPv6 packet.
Definition: node.c:264
srv6_as4_rewrite_node
vlib_node_registration_t srv6_as4_rewrite_node
(constructor) VLIB_REGISTER_NODE (srv6_as4_rewrite_node)
Definition: node.c:63
SRV6_AS_LOCALSID_N_NEXT
@ SRV6_AS_LOCALSID_N_NEXT
Definition: node.c:96
srv6_as_localsid_node
vlib_node_registration_t srv6_as_localsid_node
(constructor) VLIB_REGISTER_NODE (srv6_as_localsid_node)
Definition: node.c:241
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
srv6_as_rewrite_next_t
srv6_as_rewrite_next_t
Definition: node.c:99
vlib_buffer_t
VLIB buffer representation.
Definition: buffer.h:111
VLIB_REGISTER_NODE
#define VLIB_REGISTER_NODE(x,...)
Definition: node.h:169