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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
15 #include <vlib/vlib.h>
16 #include <vnet/vnet.h>
17 #include <vnet/pg/pg.h>
18 #include <vppinfra/error.h>
20 #include <vnet/ip/ip.h>
22 #include <vppinfra/hash.h>
23 #include <vppinfra/error.h>
24 #include <vppinfra/elog.h>
26 #include <vnet/ip/ip6_hop_by_hop.h>
28 /* Timestamp precision multipliers for seconds, milliseconds, microseconds
29 * and nanoseconds respectively.
31 static f64 trace_tsp_mul[4] = {1, 1e3, 1e6, 1e9};
33 char *ppc_state[] = {"None", "Encap", "Decap"};
35 ip6_hop_by_hop_main_t ip6_hop_by_hop_main;
38 * ip6 hop-by-hop option handling. We push pkts with h-b-h options to
39 * ip6_hop_by_hop_node_fn from ip6-lookup at a cost of ~2 clocks/pkt in
42 * We parse through the h-b-h option TLVs, specifically looking for
43 * HBH_OPTION_TYPE_IOAM_DATA_LIST. [Someone needs to get bananas from
44 * IANA, aka to actually allocate the option TLV codes.]
46 * If we find the indicated option type, and we have remaining list
47 * elements in the trace list, allocate and populate the trace list
50 * At the ingress edge: punch in the h-b-h rewrite, then visit the
51 * standard h-b-h option handler. We have to be careful in the standard
52 * h-b-h handler, to avoid looping until we run out of rewrite space.
53 * Ask me how I know that.
56 * decide on egress point "pop and count" scheme
57 * time stamp handling: usec since the top of the hour?
58 * configure the node id
59 * trace list application data support
60 * cons up analysis / steering plug-in(s)
61 * add configuration binary APIs, vpp_api_test_support, yang models and
63 * perf tune: dual loop, replace memcpy w/ N x 8-byte load/stores
68 * primary h-b-h handler trace support
69 * We work pretty hard on the problem for obvious reasons
74 u32 timestamp_msbs; /* Store the top set of bits of timestamp */
76 } ip6_hop_by_hop_trace_t;
84 fetch_trace_data_size(u8 trace_type)
86 u8 trace_data_size = 0;
88 if (trace_type == TRACE_TYPE_IF_TS_APP)
89 trace_data_size = sizeof(ioam_trace_if_ts_app_t);
90 else if(trace_type == TRACE_TYPE_IF)
91 trace_data_size = sizeof(ioam_trace_if_t);
92 else if(trace_type == TRACE_TYPE_TS)
93 trace_data_size = sizeof(ioam_trace_ts_t);
94 else if(trace_type == TRACE_TYPE_APP)
95 trace_data_size = sizeof(ioam_trace_app_t);
96 else if(trace_type == TRACE_TYPE_TS_APP)
97 trace_data_size = sizeof(ioam_trace_ts_app_t);
99 return trace_data_size;
102 static u8 * format_ioam_data_list_element (u8 * s, va_list * args)
104 u32 *elt = va_arg (*args, u32 *);
105 u8 *trace_type_p = va_arg (*args, u8 *);
106 u8 trace_type = *trace_type_p;
109 if (trace_type & BIT_TTL_NODEID)
111 u32 ttl_node_id_host_byte_order = clib_net_to_host_u32 (*elt);
112 s = format (s, "ttl 0x%x node id 0x%x ",
113 ttl_node_id_host_byte_order>>24,
114 ttl_node_id_host_byte_order & 0x00FFFFFF);
119 if (trace_type & BIT_ING_INTERFACE && trace_type & BIT_ING_INTERFACE)
121 u32 ingress_host_byte_order = clib_net_to_host_u32(*elt);
122 s = format (s, "ingress 0x%x egress 0x%x ",
123 ingress_host_byte_order >> 16,
124 ingress_host_byte_order &0xFFFF);
128 if (trace_type & BIT_TIMESTAMP)
130 u32 ts_in_host_byte_order = clib_net_to_host_u32 (*elt);
131 s = format (s, "ts 0x%x \n", ts_in_host_byte_order);
135 if (trace_type & BIT_APPDATA)
137 u32 appdata_in_host_byte_order = clib_net_to_host_u32 (*elt);
138 s = format (s, "app 0x%x ", appdata_in_host_byte_order);
145 static u8 * format_ip6_hop_by_hop_trace (u8 * s, va_list * args)
147 CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
148 CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
149 ip6_hop_by_hop_trace_t * t = va_arg (*args, ip6_hop_by_hop_trace_t *);
150 ip6_hop_by_hop_header_t *hbh0;
151 ip6_hop_by_hop_option_t *opt0, *limit0;
152 ioam_trace_option_t * trace0;
153 u8 trace_data_size_in_words = 0;
158 hbh0 = (ip6_hop_by_hop_header_t *)t->option_data;
160 s = format (s, "IP6_HOP_BY_HOP: next index %d len %d traced %d\n",
161 t->next_index, (hbh0->length+1)<<3, t->trace_len);
163 opt0 = (ip6_hop_by_hop_option_t *) (hbh0+1);
164 limit0 = (ip6_hop_by_hop_option_t *) ((u8 *)hbh0) + t->trace_len;
166 while (opt0 < limit0)
168 type0 = opt0->type & HBH_OPTION_TYPE_MASK;
172 case HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST:
173 trace0 = (ioam_trace_option_t *)opt0;
174 s = format (s, " Trace Type 0x%x , %d elts left ts msb(s) 0x%x\n",
175 trace0->ioam_trace_type, trace0->data_list_elts_left,
177 trace_data_size_in_words =
178 fetch_trace_data_size(trace0->ioam_trace_type)/4;
179 elt0 = &trace0->elts[0];
181 ((u8 *)(&trace0->elts[0]) + trace0->hdr.length - 2
182 /* -2 accounts for ioam_trace_type,elts_left */))
184 s = format (s, " [%d] %U\n",elt_index,
185 format_ioam_data_list_element,
186 elt0, &trace0->ioam_trace_type);
188 elt0 += trace_data_size_in_words;
191 opt0 = (ip6_hop_by_hop_option_t *)
192 (((u8 *)opt0) + opt0->length
193 + sizeof (ip6_hop_by_hop_option_t));
196 case HBH_OPTION_TYPE_IOAM_PROOF_OF_WORK:
197 s = format (s, " POW opt present\n");
198 opt0 = (ip6_hop_by_hop_option_t *)
199 (((u8 *)opt0) + sizeof (ioam_pow_option_t));
202 case 0: /* Pad, just stop */
203 opt0 = (ip6_hop_by_hop_option_t *) ((u8 *)opt0) + 1;
207 s = format (s, "Unknown %d", type0);
208 opt0 = (ip6_hop_by_hop_option_t *)
209 (((u8 *)opt0) + opt0->length
210 + sizeof (ip6_hop_by_hop_option_t));
217 vlib_node_registration_t ip6_hop_by_hop_node;
219 #define foreach_ip6_hop_by_hop_error \
220 _(PROCESSED, "Pkts with ip6 hop-by-hop options")
223 #define _(sym,str) IP6_HOP_BY_HOP_ERROR_##sym,
224 foreach_ip6_hop_by_hop_error
226 IP6_HOP_BY_HOP_N_ERROR,
227 } ip6_hop_by_hop_error_t;
229 static char * ip6_hop_by_hop_error_strings[] = {
230 #define _(sym,string) string,
231 foreach_ip6_hop_by_hop_error
236 ip6_hop_by_hop_node_fn (vlib_main_t * vm,
237 vlib_node_runtime_t * node,
238 vlib_frame_t * frame)
240 ip6_main_t * im = &ip6_main;
241 ip_lookup_main_t * lm = &im->lookup_main;
242 ip6_hop_by_hop_main_t * hm = &ip6_hop_by_hop_main;
243 u32 n_left_from, * from, * to_next;
244 ip_lookup_next_t next_index;
250 from = vlib_frame_vector_args (frame);
251 n_left_from = frame->n_vectors;
252 next_index = node->cached_next_index;
254 while (n_left_from > 0)
258 vlib_get_next_frame (vm, node, next_index,
259 to_next, n_left_to_next);
261 #if 0 /* $$$ DUAL-LOOP ME */
262 while (n_left_from >= 4 && n_left_to_next >= 2)
264 u32 next0 = IP6_HOP_BY_HOP_NEXT_INTERFACE_OUTPUT;
265 u32 next1 = IP6_HOP_BY_HOP_NEXT_INTERFACE_OUTPUT;
266 u32 sw_if_index0, sw_if_index1;
268 ethernet_header_t *en0, *en1;
270 vlib_buffer_t * b0, * b1;
272 /* Prefetch next iteration. */
274 vlib_buffer_t * p2, * p3;
276 p2 = vlib_get_buffer (vm, from[2]);
277 p3 = vlib_get_buffer (vm, from[3]);
279 vlib_prefetch_buffer_header (p2, LOAD);
280 vlib_prefetch_buffer_header (p3, LOAD);
282 CLIB_PREFETCH (p2->data, CLIB_CACHE_LINE_BYTES, STORE);
283 CLIB_PREFETCH (p3->data, CLIB_CACHE_LINE_BYTES, STORE);
286 /* speculatively enqueue b0 and b1 to the current next frame */
287 to_next[0] = bi0 = from[0];
288 to_next[1] = bi1 = from[1];
294 b0 = vlib_get_buffer (vm, bi0);
295 b1 = vlib_get_buffer (vm, bi1);
297 /* $$$$$ Dual loop: process 2 x packets here $$$$$ */
298 ASSERT (b0->current_data == 0);
299 ASSERT (b1->current_data == 0);
301 ip0 = vlib_buffer_get_current (b0);
302 ip1 = vlib_buffer_get_current (b0);
304 sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_RX];
305 sw_if_index1 = vnet_buffer(b1)->sw_if_index[VLIB_RX];
307 /* $$$$$ End of processing 2 x packets $$$$$ */
309 if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE)))
311 if (b0->flags & VLIB_BUFFER_IS_TRACED)
313 ip6_hop_by_hop_trace_t *t =
314 vlib_add_trace (vm, node, b0, sizeof (*t));
315 t->sw_if_index = sw_if_index0;
316 t->next_index = next0;
318 if (b1->flags & VLIB_BUFFER_IS_TRACED)
320 ip6_hop_by_hop_trace_t *t =
321 vlib_add_trace (vm, node, b1, sizeof (*t));
322 t->sw_if_index = sw_if_index1;
323 t->next_index = next1;
327 /* verify speculative enqueues, maybe switch current next frame */
328 vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
329 to_next, n_left_to_next,
330 bi0, bi1, next0, next1);
334 while (n_left_from > 0 && n_left_to_next > 0)
341 ip_adjacency_t * adj0;
342 ip6_hop_by_hop_header_t *hbh0;
343 ip6_hop_by_hop_option_t *opt0, *limit0;
344 ioam_trace_option_t * trace0;
348 /* speculatively enqueue b0 to the current next frame */
356 b0 = vlib_get_buffer (vm, bi0);
358 ip0 = vlib_buffer_get_current (b0);
359 adj_index0 = vnet_buffer (b0)->ip.adj_index[VLIB_TX];
360 adj0 = ip_get_adjacency (lm, adj_index0);
361 hbh0 = (ip6_hop_by_hop_header_t *)(ip0+1);
362 opt0 = (ip6_hop_by_hop_option_t *)(hbh0+1);
363 limit0 = (ip6_hop_by_hop_option_t *)
364 ((u8 *)hbh0 + ((hbh0->length+1)<<3));
366 /* Scan the set of h-b-h options, process ones that we understand */
367 while (opt0 < limit0)
369 type0 = opt0->type & HBH_OPTION_TYPE_MASK;
372 case HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST:
373 trace0 = (ioam_trace_option_t *)opt0;
374 if (PREDICT_TRUE (trace0->data_list_elts_left))
376 trace0->data_list_elts_left--;
377 /* fetch_trace_data_size returns in bytes. Convert it to 4-bytes
378 * to skip to this node's location.
380 elt_index = trace0->data_list_elts_left *
381 fetch_trace_data_size(trace0->ioam_trace_type)/4;
382 elt0 = &trace0->elts[elt_index];
383 if (trace0->ioam_trace_type & BIT_TTL_NODEID)
386 clib_host_to_net_u32 ((ip0->hop_limit<<24)
391 if (trace0->ioam_trace_type & BIT_ING_INTERFACE)
394 (vnet_buffer(b0)->sw_if_index[VLIB_RX]&0xFFFF) << 16 | (adj0->rewrite_header.sw_if_index & 0xFFFF);
395 *elt0 = clib_host_to_net_u32(*elt0);
399 if (trace0->ioam_trace_type & BIT_TIMESTAMP)
401 /* Send least significant 32 bits */
402 f64 time_f64 = (f64)(((f64)hm->unix_time_0) +
403 (vlib_time_now(hm->vlib_main) - hm->vlib_time_0));
406 time_f64 * trace_tsp_mul[hm->trace_tsp];
407 *elt0 = clib_host_to_net_u32(time_u64.as_u32[0]);
411 if (trace0->ioam_trace_type & BIT_APPDATA)
413 /* $$$ set elt0->app_data */
414 *elt0 = clib_host_to_net_u32(hm->app_data);
419 opt0 = (ip6_hop_by_hop_option_t *)
420 (((u8 *)opt0) + opt0->length
421 + sizeof (ip6_hop_by_hop_option_t));
424 case HBH_OPTION_TYPE_IOAM_PROOF_OF_WORK:
425 opt0 = (ip6_hop_by_hop_option_t *)
426 (((u8 *)opt0) + sizeof (ioam_pow_option_t));
430 opt0 = (ip6_hop_by_hop_option_t *) ((u8 *)opt0) + 1;
438 * Since we push pkts here from the h-b-h header imposition code
439 * we have to be careful what we wish for...
441 next0 = adj0->lookup_next_index != IP_LOOKUP_NEXT_ADD_HOP_BY_HOP ?
442 adj0->lookup_next_index : adj0->saved_lookup_next_index;
444 if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE)
445 && (b0->flags & VLIB_BUFFER_IS_TRACED)))
447 ip6_hop_by_hop_trace_t *t =
448 vlib_add_trace (vm, node, b0, sizeof (*t));
449 u32 trace_len = (hbh0->length+1)<<3;
450 t->next_index = next0;
451 /* Capture the h-b-h option verbatim */
452 trace_len = trace_len < ARRAY_LEN(t->option_data) ?
453 trace_len : ARRAY_LEN(t->option_data);
454 t->trace_len = trace_len;
455 t->timestamp_msbs = time_u64.as_u32[1];
456 memcpy (t->option_data, hbh0, trace_len);
461 /* verify speculative enqueue, maybe switch current next frame */
462 vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
463 to_next, n_left_to_next,
467 vlib_put_next_frame (vm, node, next_index, n_left_to_next);
470 vlib_node_increment_counter (vm, ip6_hop_by_hop_node.index,
471 IP6_HOP_BY_HOP_ERROR_PROCESSED, processed);
472 return frame->n_vectors;
475 VLIB_REGISTER_NODE (ip6_hop_by_hop_node) = {
476 .function = ip6_hop_by_hop_node_fn,
477 .name = "ip6-hop-by-hop",
478 .vector_size = sizeof (u32),
479 .format_trace = format_ip6_hop_by_hop_trace,
480 .type = VLIB_NODE_TYPE_INTERNAL,
482 .n_errors = ARRAY_LEN(ip6_hop_by_hop_error_strings),
483 .error_strings = ip6_hop_by_hop_error_strings,
485 /* See ip/lookup.h */
486 .n_next_nodes = IP_LOOKUP_N_NEXT,
488 [IP_LOOKUP_NEXT_MISS] = "ip6-miss",
489 [IP_LOOKUP_NEXT_DROP] = "ip6-drop",
490 [IP_LOOKUP_NEXT_PUNT] = "ip6-punt",
491 [IP_LOOKUP_NEXT_LOCAL] = "ip6-local",
492 [IP_LOOKUP_NEXT_ARP] = "ip6-discover-neighbor",
493 [IP_LOOKUP_NEXT_REWRITE] = "ip6-rewrite",
494 [IP_LOOKUP_NEXT_CLASSIFY] = "ip6-classify",
495 [IP_LOOKUP_NEXT_MAP] = "ip6-map",
496 [IP_LOOKUP_NEXT_MAP_T] = "ip6-map-t",
497 [IP_LOOKUP_NEXT_SIXRD] = "ip6-sixrd",
498 /* Next 3 arcs probably never used */
499 [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip6-hop-by-hop",
500 [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip6-add-hop-by-hop",
501 [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip6-pop-hop-by-hop",
505 /* The main h-b-h tracer will be invoked, no need to do much here */
508 } ip6_add_hop_by_hop_trace_t;
510 /* packet trace format function */
511 static u8 * format_ip6_add_hop_by_hop_trace (u8 * s, va_list * args)
513 CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
514 CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
515 ip6_add_hop_by_hop_trace_t * t = va_arg (*args,
516 ip6_add_hop_by_hop_trace_t *);
518 s = format (s, "IP6_ADD_HOP_BY_HOP: next index %d",
523 vlib_node_registration_t ip6_add_hop_by_hop_node;
525 #define foreach_ip6_add_hop_by_hop_error \
526 _(PROCESSED, "Pkts w/ added ip6 hop-by-hop options")
529 #define _(sym,str) IP6_ADD_HOP_BY_HOP_ERROR_##sym,
530 foreach_ip6_add_hop_by_hop_error
532 IP6_ADD_HOP_BY_HOP_N_ERROR,
533 } ip6_add_hop_by_hop_error_t;
535 static char * ip6_add_hop_by_hop_error_strings[] = {
536 #define _(sym,string) string,
537 foreach_ip6_add_hop_by_hop_error
542 ip6_add_hop_by_hop_node_fn (vlib_main_t * vm,
543 vlib_node_runtime_t * node,
544 vlib_frame_t * frame)
546 ip6_hop_by_hop_main_t * hm = &ip6_hop_by_hop_main;
547 u32 n_left_from, * from, * to_next;
548 ip_lookup_next_t next_index;
550 u8 * rewrite = hm->rewrite;
551 u32 rewrite_length = vec_len (rewrite);
553 from = vlib_frame_vector_args (frame);
554 n_left_from = frame->n_vectors;
555 next_index = node->cached_next_index;
557 while (n_left_from > 0)
561 vlib_get_next_frame (vm, node, next_index,
562 to_next, n_left_to_next);
565 while (n_left_from >= 4 && n_left_to_next >= 2)
567 u32 next0 = IP6_ADD_HOP_BY_HOP_NEXT_INTERFACE_OUTPUT;
568 u32 next1 = IP6_ADD_HOP_BY_HOP_NEXT_INTERFACE_OUTPUT;
569 u32 sw_if_index0, sw_if_index1;
571 ethernet_header_t *en0, *en1;
573 vlib_buffer_t * b0, * b1;
575 /* Prefetch next iteration. */
577 vlib_buffer_t * p2, * p3;
579 p2 = vlib_get_buffer (vm, from[2]);
580 p3 = vlib_get_buffer (vm, from[3]);
582 vlib_prefetch_buffer_header (p2, LOAD);
583 vlib_prefetch_buffer_header (p3, LOAD);
585 CLIB_PREFETCH (p2->data, CLIB_CACHE_LINE_BYTES, STORE);
586 CLIB_PREFETCH (p3->data, CLIB_CACHE_LINE_BYTES, STORE);
589 /* speculatively enqueue b0 and b1 to the current next frame */
590 to_next[0] = bi0 = from[0];
591 to_next[1] = bi1 = from[1];
597 b0 = vlib_get_buffer (vm, bi0);
598 b1 = vlib_get_buffer (vm, bi1);
600 /* $$$$$ Dual loop: process 2 x packets here $$$$$ */
601 ASSERT (b0->current_data == 0);
602 ASSERT (b1->current_data == 0);
604 ip0 = vlib_buffer_get_current (b0);
605 ip1 = vlib_buffer_get_current (b0);
607 sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_RX];
608 sw_if_index1 = vnet_buffer(b1)->sw_if_index[VLIB_RX];
610 /* $$$$$ End of processing 2 x packets $$$$$ */
612 if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE)))
614 if (b0->flags & VLIB_BUFFER_IS_TRACED)
616 ip6_add_hop_by_hop_trace_t *t =
617 vlib_add_trace (vm, node, b0, sizeof (*t));
618 t->sw_if_index = sw_if_index0;
619 t->next_index = next0;
621 if (b1->flags & VLIB_BUFFER_IS_TRACED)
623 ip6_add_hop_by_hop_trace_t *t =
624 vlib_add_trace (vm, node, b1, sizeof (*t));
625 t->sw_if_index = sw_if_index1;
626 t->next_index = next1;
630 /* verify speculative enqueues, maybe switch current next frame */
631 vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
632 to_next, n_left_to_next,
633 bi0, bi1, next0, next1);
637 while (n_left_from > 0 && n_left_to_next > 0)
643 ip6_hop_by_hop_header_t * hbh0;
644 u64 * copy_src0, * copy_dst0;
647 /* speculatively enqueue b0 to the current next frame */
655 b0 = vlib_get_buffer (vm, bi0);
657 ip0 = vlib_buffer_get_current (b0);
659 /* Copy the ip header left by the required amount */
660 copy_dst0 = (u64 *)(((u8 *)ip0) - rewrite_length);
661 copy_src0 = (u64 *) ip0;
663 copy_dst0 [0] = copy_src0 [0];
664 copy_dst0 [1] = copy_src0 [1];
665 copy_dst0 [2] = copy_src0 [2];
666 copy_dst0 [3] = copy_src0 [3];
667 copy_dst0 [4] = copy_src0 [4];
668 vlib_buffer_advance (b0, - (word)rewrite_length);
669 ip0 = vlib_buffer_get_current (b0);
671 hbh0 = (ip6_hop_by_hop_header_t *)(ip0 + 1);
672 /* $$$ tune, rewrite_length is a multiple of 8 */
673 memcpy (hbh0, rewrite, rewrite_length);
674 /* Patch the protocol chain, insert the h-b-h (type 0) header */
675 hbh0->protocol = ip0->protocol;
677 new_l0 = clib_net_to_host_u16 (ip0->payload_length) + rewrite_length;
678 ip0->payload_length = clib_host_to_net_u16 (new_l0);
680 /* Populate the (first) h-b-h list elt */
681 next0 = IP_LOOKUP_NEXT_HOP_BY_HOP;
683 if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE)
684 && (b0->flags & VLIB_BUFFER_IS_TRACED)))
686 ip6_add_hop_by_hop_trace_t *t =
687 vlib_add_trace (vm, node, b0, sizeof (*t));
688 t->next_index = next0;
693 /* verify speculative enqueue, maybe switch current next frame */
694 vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
695 to_next, n_left_to_next,
699 vlib_put_next_frame (vm, node, next_index, n_left_to_next);
702 vlib_node_increment_counter (vm, ip6_add_hop_by_hop_node.index,
703 IP6_ADD_HOP_BY_HOP_ERROR_PROCESSED, processed);
704 return frame->n_vectors;
707 VLIB_REGISTER_NODE (ip6_add_hop_by_hop_node) = {
708 .function = ip6_add_hop_by_hop_node_fn,
709 .name = "ip6-add-hop-by-hop",
710 .vector_size = sizeof (u32),
711 .format_trace = format_ip6_add_hop_by_hop_trace,
712 .type = VLIB_NODE_TYPE_INTERNAL,
714 .n_errors = ARRAY_LEN(ip6_add_hop_by_hop_error_strings),
715 .error_strings = ip6_add_hop_by_hop_error_strings,
717 /* See ip/lookup.h */
718 .n_next_nodes = IP_LOOKUP_N_NEXT,
720 [IP_LOOKUP_NEXT_MISS] = "ip6-miss",
721 [IP_LOOKUP_NEXT_DROP] = "ip6-drop",
722 [IP_LOOKUP_NEXT_PUNT] = "ip6-punt",
723 [IP_LOOKUP_NEXT_LOCAL] = "ip6-local",
724 [IP_LOOKUP_NEXT_ARP] = "ip6-discover-neighbor",
725 [IP_LOOKUP_NEXT_REWRITE] = "ip6-rewrite",
726 [IP_LOOKUP_NEXT_CLASSIFY] = "ip6-classify",
727 [IP_LOOKUP_NEXT_MAP] = "ip6-map",
728 [IP_LOOKUP_NEXT_MAP_T] = "ip6-map-t",
729 [IP_LOOKUP_NEXT_SIXRD] = "ip6-sixrd",
730 /* Next 3 arcs probably never used */
731 [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip6-hop-by-hop",
732 [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip6-add-hop-by-hop",
733 [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip6-pop-hop-by-hop",
738 /* The main h-b-h tracer was already invoked, no need to do much here */
741 } ip6_pop_hop_by_hop_trace_t;
743 /* packet trace format function */
744 static u8 * format_ip6_pop_hop_by_hop_trace (u8 * s, va_list * args)
746 CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
747 CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
748 ip6_pop_hop_by_hop_trace_t * t = va_arg (*args, ip6_pop_hop_by_hop_trace_t *);
750 s = format (s, "IP6_POP_HOP_BY_HOP: next index %d",
755 vlib_node_registration_t ip6_pop_hop_by_hop_node;
757 #define foreach_ip6_pop_hop_by_hop_error \
758 _(PROCESSED, "Pkts w/ removed ip6 hop-by-hop options") \
759 _(NO_HOHO, "Pkts w/ no ip6 hop-by-hop options")
762 #define _(sym,str) IP6_POP_HOP_BY_HOP_ERROR_##sym,
763 foreach_ip6_pop_hop_by_hop_error
765 IP6_POP_HOP_BY_HOP_N_ERROR,
766 } ip6_pop_hop_by_hop_error_t;
768 static char * ip6_pop_hop_by_hop_error_strings[] = {
769 #define _(sym,string) string,
770 foreach_ip6_pop_hop_by_hop_error
775 ip6_pop_hop_by_hop_node_fn (vlib_main_t * vm,
776 vlib_node_runtime_t * node,
777 vlib_frame_t * frame)
779 ip6_hop_by_hop_main_t * hm = &ip6_hop_by_hop_main;
780 ip6_main_t * im = &ip6_main;
781 ip_lookup_main_t * lm = &im->lookup_main;
782 u32 n_left_from, * from, * to_next;
783 ip_lookup_next_t next_index;
786 u32 (*ioam_end_of_path_cb) (vlib_main_t *, vlib_node_runtime_t *,
787 vlib_buffer_t *, ip6_header_t *,
790 ioam_end_of_path_cb = hm->ioam_end_of_path_cb;
792 from = vlib_frame_vector_args (frame);
793 n_left_from = frame->n_vectors;
794 next_index = node->cached_next_index;
796 while (n_left_from > 0)
800 vlib_get_next_frame (vm, node, next_index,
801 to_next, n_left_to_next);
804 while (n_left_from >= 4 && n_left_to_next >= 2)
806 u32 next0 = IP6_POP_HOP_BY_HOP_NEXT_INTERFACE_OUTPUT;
807 u32 next1 = IP6_POP_HOP_BY_HOP_NEXT_INTERFACE_OUTPUT;
808 u32 sw_if_index0, sw_if_index1;
810 ethernet_header_t *en0, *en1;
812 vlib_buffer_t * b0, * b1;
814 /* Prefetch next iteration. */
816 vlib_buffer_t * p2, * p3;
818 p2 = vlib_get_buffer (vm, from[2]);
819 p3 = vlib_get_buffer (vm, from[3]);
821 vlib_prefetch_buffer_header (p2, LOAD);
822 vlib_prefetch_buffer_header (p3, LOAD);
824 CLIB_PREFETCH (p2->data, CLIB_CACHE_LINE_BYTES, STORE);
825 CLIB_PREFETCH (p3->data, CLIB_CACHE_LINE_BYTES, STORE);
828 /* speculatively enqueue b0 and b1 to the current next frame */
829 to_next[0] = bi0 = from[0];
830 to_next[1] = bi1 = from[1];
836 b0 = vlib_get_buffer (vm, bi0);
837 b1 = vlib_get_buffer (vm, bi1);
839 /* $$$$$ Dual loop: process 2 x packets here $$$$$ */
840 ASSERT (b0->current_data == 0);
841 ASSERT (b1->current_data == 0);
843 ip0 = vlib_buffer_get_current (b0);
844 ip1 = vlib_buffer_get_current (b0);
846 sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_RX];
847 sw_if_index1 = vnet_buffer(b1)->sw_if_index[VLIB_RX];
849 /* $$$$$ End of processing 2 x packets $$$$$ */
851 if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE)))
853 if (b0->flags & VLIB_BUFFER_IS_TRACED)
855 ip6_pop_hop_by_hop_trace_t *t =
856 vlib_add_trace (vm, node, b0, sizeof (*t));
857 t->sw_if_index = sw_if_index0;
858 t->next_index = next0;
860 if (b1->flags & VLIB_BUFFER_IS_TRACED)
862 ip6_pop_hop_by_hop_trace_t *t =
863 vlib_add_trace (vm, node, b1, sizeof (*t));
864 t->sw_if_index = sw_if_index1;
865 t->next_index = next1;
869 /* verify speculative enqueues, maybe switch current next frame */
870 vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
871 to_next, n_left_to_next,
872 bi0, bi1, next0, next1);
876 while (n_left_from > 0 && n_left_to_next > 0)
883 ip_adjacency_t * adj0;
884 ip6_hop_by_hop_header_t *hbh0;
885 u64 * copy_dst0, * copy_src0;
888 /* speculatively enqueue b0 to the current next frame */
896 b0 = vlib_get_buffer (vm, bi0);
898 ip0 = vlib_buffer_get_current (b0);
899 adj_index0 = vnet_buffer (b0)->ip.adj_index[VLIB_TX];
900 adj0 = ip_get_adjacency (lm, adj_index0);
902 /* Perfectly normal to end up here w/ out h-b-h header */
903 if (PREDICT_TRUE (ip0->protocol == 0))
905 hbh0 = (ip6_hop_by_hop_header_t *)(ip0+1);
907 /* Collect data from trace via callback */
908 next0 = ioam_end_of_path_cb ?
909 ioam_end_of_path_cb (vm, node, b0, ip0, adj0)
910 : adj0->saved_lookup_next_index;
913 /* Pop the trace data */
914 vlib_buffer_advance (b0, (hbh0->length+1)<<3);
915 new_l0 = clib_net_to_host_u16 (ip0->payload_length) -
916 ((hbh0->length+1)<<3);
917 ip0->payload_length = clib_host_to_net_u16 (new_l0);
918 ip0->protocol = hbh0->protocol;
919 copy_src0 = (u64 *)ip0;
920 copy_dst0 = copy_src0 + (hbh0->length+1);
921 copy_dst0 [4] = copy_src0[4];
922 copy_dst0 [3] = copy_src0[3];
923 copy_dst0 [2] = copy_src0[2];
924 copy_dst0 [1] = copy_src0[1];
925 copy_dst0 [0] = copy_src0[0];
930 next0 = adj0->saved_lookup_next_index;
934 if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE)
935 && (b0->flags & VLIB_BUFFER_IS_TRACED)))
937 ip6_pop_hop_by_hop_trace_t *t =
938 vlib_add_trace (vm, node, b0, sizeof (*t));
939 t->next_index = next0;
942 /* verify speculative enqueue, maybe switch current next frame */
943 vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
944 to_next, n_left_to_next,
948 vlib_put_next_frame (vm, node, next_index, n_left_to_next);
951 vlib_node_increment_counter (vm, ip6_pop_hop_by_hop_node.index,
952 IP6_POP_HOP_BY_HOP_ERROR_PROCESSED, processed);
953 vlib_node_increment_counter (vm, ip6_pop_hop_by_hop_node.index,
954 IP6_POP_HOP_BY_HOP_ERROR_NO_HOHO, no_header);
955 return frame->n_vectors;
958 VLIB_REGISTER_NODE (ip6_pop_hop_by_hop_node) = {
959 .function = ip6_pop_hop_by_hop_node_fn,
960 .name = "ip6-pop-hop-by-hop",
961 .vector_size = sizeof (u32),
962 .format_trace = format_ip6_pop_hop_by_hop_trace,
963 .type = VLIB_NODE_TYPE_INTERNAL,
965 .n_errors = ARRAY_LEN(ip6_pop_hop_by_hop_error_strings),
966 .error_strings = ip6_pop_hop_by_hop_error_strings,
968 /* See ip/lookup.h */
969 .n_next_nodes = IP_LOOKUP_N_NEXT,
971 [IP_LOOKUP_NEXT_MISS] = "ip6-miss",
972 [IP_LOOKUP_NEXT_DROP] = "ip6-drop",
973 [IP_LOOKUP_NEXT_PUNT] = "ip6-punt",
974 [IP_LOOKUP_NEXT_LOCAL] = "ip6-local",
975 [IP_LOOKUP_NEXT_ARP] = "ip6-discover-neighbor",
976 [IP_LOOKUP_NEXT_REWRITE] = "ip6-rewrite",
977 [IP_LOOKUP_NEXT_CLASSIFY] = "ip6-classify",
978 [IP_LOOKUP_NEXT_MAP] = "ip6-map",
979 [IP_LOOKUP_NEXT_MAP_T] = "ip6-map-t",
980 [IP_LOOKUP_NEXT_SIXRD] = "ip6-sixrd",
981 /* Next 3 arcs probably never used */
982 [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip6-hop-by-hop",
983 [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip6-add-hop-by-hop",
984 [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip6-pop-hop-by-hop",
989 static clib_error_t *
990 ip6_hop_by_hop_init (vlib_main_t * vm)
992 ip6_hop_by_hop_main_t * hm = &ip6_hop_by_hop_main;
995 hm->vnet_main = vnet_get_main();
996 hm->unix_time_0 = (u32) time (0); /* Store starting time */
997 hm->vlib_time_0 = vlib_time_now (vm);
998 hm->ioam_flag = IOAM_HBYH_MOD;
999 hm->trace_tsp = TSP_MICROSECONDS; /* Micro seconds */
1004 VLIB_INIT_FUNCTION (ip6_hop_by_hop_init);
1006 int ip6_ioam_set_rewrite (u8 **rwp, u32 trace_type, u32 trace_option_elts,
1007 int has_pow_option, int has_ppc_option)
1011 ip6_hop_by_hop_header_t *hbh;
1012 ioam_trace_option_t * trace_option;
1013 ioam_pow_option_t * pow_option;
1015 u8 trace_data_size = 0;
1019 if (trace_option_elts == 0 && has_pow_option == 0)
1022 /* Work out how much space we need */
1023 size = sizeof (ip6_hop_by_hop_header_t);
1025 if (trace_option_elts)
1027 size += sizeof (ip6_hop_by_hop_option_t);
1029 trace_data_size = fetch_trace_data_size(trace_type);
1030 if (trace_data_size == 0)
1031 return VNET_API_ERROR_INVALID_VALUE;
1033 if (trace_option_elts * trace_data_size > 254)
1034 return VNET_API_ERROR_INVALID_VALUE;
1036 size += trace_option_elts * trace_data_size;
1040 size += sizeof (ip6_hop_by_hop_option_t);
1041 size += sizeof (ioam_pow_option_t);
1044 /* Round to a multiple of 8 octets */
1045 rnd_size = (size + 7) & ~7;
1047 /* allocate it, zero-fill / pad by construction */
1048 vec_validate (rewrite, rnd_size-1);
1050 hbh = (ip6_hop_by_hop_header_t *) rewrite;
1051 /* Length of header in 8 octet units, not incl first 8 octets */
1052 hbh->length = (rnd_size>>3) - 1;
1053 current = (u8 *)(hbh+1);
1055 if (trace_option_elts)
1057 trace_option = (ioam_trace_option_t *)current;
1058 trace_option->hdr.type = HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST
1059 | HBH_OPTION_TYPE_DATA_CHANGE_ENROUTE;
1060 trace_option->hdr.length =
1061 2 /*ioam_trace_type,data_list_elts_left */ +
1062 trace_option_elts * trace_data_size;
1063 trace_option->ioam_trace_type = trace_type & TRACE_TYPE_MASK;
1064 trace_option->data_list_elts_left = trace_option_elts;
1065 current += sizeof (ioam_trace_option_t) +
1066 trace_option_elts * trace_data_size;
1070 pow_option = (ioam_pow_option_t *)current;
1071 pow_option->hdr.type = HBH_OPTION_TYPE_IOAM_PROOF_OF_WORK
1072 | HBH_OPTION_TYPE_DATA_CHANGE_ENROUTE;
1073 pow_option->hdr.length = sizeof (ioam_pow_option_t) -
1074 sizeof (ip6_hop_by_hop_option_t);
1075 current += sizeof (ioam_pow_option_t);
1083 clear_ioam_rewrite_fn(void)
1085 ip6_hop_by_hop_main_t *hm = &ip6_hop_by_hop_main;
1087 vec_free(hm->rewrite);
1092 hm->trace_option_elts = 0;
1093 hm->has_pow_option = 0;
1094 hm->has_ppc_option = 0;
1095 hm->trace_tsp = TSP_MICROSECONDS;
1100 clib_error_t * clear_ioam_rewrite_command_fn (vlib_main_t * vm,
1101 unformat_input_t * input,
1102 vlib_cli_command_t * cmd)
1104 return(clear_ioam_rewrite_fn());
1107 VLIB_CLI_COMMAND (ip6_clear_ioam_trace_cmd, static) = {
1108 .path = "clear ioam rewrite",
1109 .short_help = "clear ioam rewrite",
1110 .function = clear_ioam_rewrite_command_fn,
1114 ip6_ioam_trace_profile_set(u32 trace_option_elts, u32 trace_type, u32 node_id,
1115 u32 app_data, int has_pow_option, u32 trace_tsp,
1119 ip6_hop_by_hop_main_t *hm = &ip6_hop_by_hop_main;
1120 rv = ip6_ioam_set_rewrite (&hm->rewrite, trace_type, trace_option_elts,
1121 has_pow_option, has_ppc_option);
1126 hm->node_id = node_id;
1127 hm->app_data = app_data;
1128 hm->trace_type = trace_type;
1129 hm->trace_option_elts = trace_option_elts;
1130 hm->has_pow_option = has_pow_option;
1131 hm->has_ppc_option = has_ppc_option;
1132 hm->trace_tsp = trace_tsp;
1136 return clib_error_return_code(0, rv, 0, "ip6_ioam_set_rewrite returned %d", rv);
1143 static clib_error_t *
1144 ip6_set_ioam_rewrite_command_fn (vlib_main_t * vm,
1145 unformat_input_t * input,
1146 vlib_cli_command_t * cmd)
1148 u32 trace_option_elts = 0;
1149 u32 trace_type = 0, node_id = 0;
1150 u32 app_data = 0, trace_tsp = TSP_MICROSECONDS;
1151 int has_pow_option = 0;
1152 int has_ppc_option = 0;
1153 clib_error_t * rv = 0;
1155 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
1157 if (unformat (input, "trace-type 0x%x trace-elts %d "
1158 "trace-tsp %d node-id 0x%x app-data 0x%x",
1159 &trace_type, &trace_option_elts, &trace_tsp,
1160 &node_id, &app_data))
1162 else if (unformat (input, "pow"))
1164 else if (unformat (input, "ppc encap"))
1165 has_ppc_option = PPC_ENCAP;
1166 else if (unformat (input, "ppc decap"))
1167 has_ppc_option = PPC_DECAP;
1168 else if (unformat (input, "ppc none"))
1169 has_ppc_option = PPC_NONE;
1175 rv = ip6_ioam_trace_profile_set(trace_option_elts, trace_type, node_id,
1176 app_data, has_pow_option, trace_tsp, has_ppc_option);
1182 VLIB_CLI_COMMAND (ip6_set_ioam_rewrite_cmd, static) = {
1183 .path = "set ioam rewrite",
1184 .short_help = "set ioam rewrite trace-type <0x1f|0x3|0x9|0x11|0x19> trace-elts <nn> trace-tsp <0|1|2|3> node-id <node id in hex> app-data <app_data in hex> [pow] [ppc <encap|decap>]",
1185 .function = ip6_set_ioam_rewrite_command_fn,
1188 static clib_error_t *
1189 ip6_show_ioam_summary_cmd_fn (vlib_main_t * vm,
1190 unformat_input_t * input,
1191 vlib_cli_command_t * cmd)
1193 ip6_hop_by_hop_main_t *hm = &ip6_hop_by_hop_main;
1197 if (!is_zero_ip6_address(&hm->adj))
1199 s = format(s, " REWRITE FLOW CONFIGS - \n");
1200 s = format(s, " Destination Address : %U\n",
1201 format_ip6_address, &hm->adj, sizeof(ip6_address_t));
1202 s = format(s, " Flow operation : %d (%s)\n", hm->ioam_flag,
1203 (hm->ioam_flag == IOAM_HBYH_ADD) ? "Add" :
1204 ((hm->ioam_flag == IOAM_HBYH_MOD) ? "Mod" : "Pop"));
1208 s = format(s, " REWRITE FLOW CONFIGS - Not configured\n");
1211 if (hm->trace_option_elts)
1213 s = format(s, " HOP BY HOP OPTIONS - TRACE CONFIG - \n");
1214 s = format(s, " Trace Type : 0x%x (%d)\n",
1215 hm->trace_type, hm->trace_type);
1216 s = format(s, " Trace timestamp precision : %d (%s)\n", hm->trace_tsp,
1217 (hm->trace_tsp == TSP_SECONDS) ? "Seconds" :
1218 ((hm->trace_tsp == TSP_MILLISECONDS) ? "Milliseconds" :
1219 (((hm->trace_tsp == TSP_MICROSECONDS) ? "Microseconds" : "Nanoseconds"))));
1220 s = format(s, " Num of trace nodes : %d\n",
1221 hm->trace_option_elts);
1222 s = format(s, " Node-id : 0x%x (%d)\n",
1223 hm->node_id, hm->node_id);
1224 s = format(s, " App Data : 0x%x (%d)\n",
1225 hm->app_data, hm->app_data);
1229 s = format(s, " HOP BY HOP OPTIONS - TRACE CONFIG - Not configured\n");
1232 s = format(s, " POW OPTION - %d (%s)\n",
1233 hm->has_pow_option, (hm->has_pow_option?"Enabled":"Disabled"));
1234 if (hm->has_pow_option)
1235 s = format(s, "Try 'show ioam sc-profile' for more information\n");
1237 s = format(s, " EDGE TO EDGE - PPC OPTION - %d (%s)\n",
1238 hm->has_ppc_option, ppc_state[hm->has_ppc_option]);
1239 if (hm->has_ppc_option)
1240 s = format(s, "Try 'show ioam ppc' for more information\n");
1242 vlib_cli_output(vm, "%v", s);
1247 VLIB_CLI_COMMAND (ip6_show_ioam_run_cmd, static) = {
1248 .path = "show ioam summary",
1249 .short_help = "Summary of IOAM configuration",
1250 .function = ip6_show_ioam_summary_cmd_fn,
1253 int ip6_ioam_set_destination (ip6_address_t *addr, u32 mask_width, u32 vrf_id,
1254 int is_add, int is_pop, int is_none)
1256 ip6_main_t * im = &ip6_main;
1257 ip6_hop_by_hop_main_t * hm = &ip6_hop_by_hop_main;
1258 ip_lookup_main_t * lm = &im->lookup_main;
1259 ip_adjacency_t * adj;
1264 BVT(clib_bihash_kv) kv, value;
1266 if ((is_add + is_pop + is_none) != 1)
1267 return VNET_API_ERROR_INVALID_VALUE_2;
1269 /* Go find the adjacency we're supposed to tickle */
1270 p = hash_get (im->fib_index_by_table_id, vrf_id);
1273 return VNET_API_ERROR_NO_SUCH_FIB;
1277 len = vec_len (im->prefix_lengths_in_search_order);
1279 for (i = 0; i < len; i++)
1281 int dst_address_length = im->prefix_lengths_in_search_order[i];
1282 ip6_address_t * mask = &im->fib_masks[dst_address_length];
1284 if (dst_address_length != mask_width)
1287 kv.key[0] = addr->as_u64[0] & mask->as_u64[0];
1288 kv.key[1] = addr->as_u64[1] & mask->as_u64[1];
1289 kv.key[2] = ((u64)((fib_index))<<32) | dst_address_length;
1291 rv = BV(clib_bihash_search_inline_2)(&im->ip6_lookup_table, &kv, &value);
1296 return VNET_API_ERROR_NO_SUCH_ENTRY;
1300 /* Got it, modify as directed... */
1301 adj_index = value.value;
1302 adj = ip_get_adjacency (lm, adj_index);
1304 /* Restore original lookup-next action */
1305 if (adj->saved_lookup_next_index)
1307 adj->lookup_next_index = adj->saved_lookup_next_index;
1308 adj->saved_lookup_next_index = 0;
1311 /* Save current action */
1312 if (is_add || is_pop)
1313 adj->saved_lookup_next_index = adj->lookup_next_index;
1316 adj->lookup_next_index = IP_LOOKUP_NEXT_ADD_HOP_BY_HOP;
1319 adj->lookup_next_index = IP_LOOKUP_NEXT_POP_HOP_BY_HOP;
1322 hm->ioam_flag = (is_add ? IOAM_HBYH_ADD :
1323 (is_pop ? IOAM_HBYH_POP : IOAM_HBYH_MOD));
1327 static clib_error_t *
1328 ip6_set_ioam_destination_command_fn (vlib_main_t * vm,
1329 unformat_input_t * input,
1330 vlib_cli_command_t * cmd)
1333 u32 mask_width = ~0;
1340 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
1342 if (unformat (input, "%U/%d",
1343 unformat_ip6_address, &addr, &mask_width))
1345 else if (unformat (input, "vrf-id %d", &vrf_id))
1347 else if (unformat (input, "add"))
1349 else if (unformat (input, "pop"))
1351 else if (unformat (input, "none"))
1357 if ((is_add + is_pop + is_none) != 1)
1358 return clib_error_return (0, "One of (add, pop, none) required");
1359 if (mask_width == ~0)
1360 return clib_error_return (0, "<address>/<mask-width> required");
1362 rv = ip6_ioam_set_destination (&addr, mask_width, vrf_id,
1363 is_add, is_pop, is_none);
1370 return clib_error_return (0, "ip6_ioam_set_destination returned %d", rv);
1376 VLIB_CLI_COMMAND (ip6_set_ioam_destination_cmd, static) = {
1377 .path = "set ioam destination",
1378 .short_help = "set ioam destination <ip6-address>/<width> add | pop | none",
1379 .function = ip6_set_ioam_destination_command_fn,
1382 void vnet_register_ioam_end_of_path_callback (void *cb)
1384 ip6_hop_by_hop_main_t * hm = &ip6_hop_by_hop_main;
1386 hm->ioam_end_of_path_cb = cb;