d00f4c558b2d84398567604ba9e06fc2c4aaff2b
[vpp.git] / src / vnet / fib / ip6_fib.c
1 /*
2  * Copyright (c) 2016 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
16 #include <vnet/fib/ip6_fib.h>
17 #include <vnet/fib/fib_table.h>
18
19 static void
20 vnet_ip6_fib_init (u32 fib_index)
21 {
22     fib_prefix_t pfx = {
23         .fp_proto = FIB_PROTOCOL_IP6,
24         .fp_len = 0,
25         .fp_addr = {
26             .ip6 = {
27                 { 0, 0, },
28             },
29         }
30     };
31
32     /*
33      * Add the default route.
34      */
35     fib_table_entry_special_add(fib_index,
36                                 &pfx,
37                                 FIB_SOURCE_DEFAULT_ROUTE,
38                                 FIB_ENTRY_FLAG_DROP);
39
40     /*
41      * all link local for us
42      */
43     pfx.fp_addr.ip6.as_u64[0] = clib_host_to_net_u64 (0xFE80000000000000ULL);
44     pfx.fp_addr.ip6.as_u64[1] = 0;
45     pfx.fp_len = 10;
46     fib_table_entry_special_add(fib_index,
47                                 &pfx,
48                                 FIB_SOURCE_SPECIAL,
49                                 FIB_ENTRY_FLAG_LOCAL);
50 }
51
52 static u32
53 create_fib_with_table_id (u32 table_id)
54 {
55     fib_table_t *fib_table;
56     ip6_fib_t *v6_fib;
57
58     pool_get_aligned(ip6_main.fibs, fib_table, CLIB_CACHE_LINE_BYTES);
59     pool_get_aligned(ip6_main.v6_fibs, v6_fib, CLIB_CACHE_LINE_BYTES);
60
61     memset(fib_table, 0, sizeof(*fib_table));
62     memset(v6_fib, 0, sizeof(*v6_fib));
63
64     ASSERT((fib_table - ip6_main.fibs) ==
65            (v6_fib - ip6_main.v6_fibs));
66     
67     fib_table->ft_proto = FIB_PROTOCOL_IP6;
68     fib_table->ft_index =
69             v6_fib->index =
70                 (fib_table - ip6_main.fibs);
71
72     hash_set(ip6_main.fib_index_by_table_id, table_id, fib_table->ft_index);
73
74     fib_table->ft_table_id =
75         v6_fib->table_id =
76             table_id;
77     fib_table->ft_flow_hash_config = 
78         v6_fib->flow_hash_config =
79             IP_FLOW_HASH_DEFAULT;
80
81     vnet_ip6_fib_init(fib_table->ft_index);
82     fib_table_lock(fib_table->ft_index, FIB_PROTOCOL_IP6);
83
84     return (fib_table->ft_index);
85 }
86
87 u32
88 ip6_fib_table_find_or_create_and_lock (u32 table_id)
89 {
90     uword * p;
91
92     p = hash_get (ip6_main.fib_index_by_table_id, table_id);
93     if (NULL == p)
94         return create_fib_with_table_id(table_id);
95     
96     fib_table_lock(p[0], FIB_PROTOCOL_IP6);
97
98     return (p[0]);
99 }
100
101 u32
102 ip6_fib_table_create_and_lock (void)
103 {
104     return (create_fib_with_table_id(~0));
105 }
106
107 void
108 ip6_fib_table_destroy (u32 fib_index)
109 {
110     fib_prefix_t pfx = {
111         .fp_proto = FIB_PROTOCOL_IP6,
112         .fp_len = 0,
113         .fp_addr = {
114             .ip6 = {
115                 { 0, 0, },
116             },
117         }
118     };
119
120     /*
121      * the default route.
122      */
123     fib_table_entry_special_remove(fib_index,
124                                    &pfx,
125                                    FIB_SOURCE_DEFAULT_ROUTE);
126
127
128     /*
129      * ff02::1:ff00:0/104
130      */
131     ip6_set_solicited_node_multicast_address(&pfx.fp_addr.ip6, 0);
132     pfx.fp_len = 104;
133     fib_table_entry_special_remove(fib_index,
134                                    &pfx,
135                                    FIB_SOURCE_SPECIAL);
136
137     /*
138      * all-routers multicast address
139      */
140     ip6_set_reserved_multicast_address (&pfx.fp_addr.ip6,
141                                         IP6_MULTICAST_SCOPE_link_local,
142                                         IP6_MULTICAST_GROUP_ID_all_routers);
143     pfx.fp_len = 128;
144     fib_table_entry_special_remove(fib_index,
145                                    &pfx,
146                                    FIB_SOURCE_SPECIAL);
147
148     /*
149      * all-nodes multicast address
150      */
151     ip6_set_reserved_multicast_address (&pfx.fp_addr.ip6,
152                                         IP6_MULTICAST_SCOPE_link_local,
153                                         IP6_MULTICAST_GROUP_ID_all_hosts);
154     pfx.fp_len = 128;
155     fib_table_entry_special_remove(fib_index,
156                                    &pfx,
157                                    FIB_SOURCE_SPECIAL);
158
159     /*
160      * all-mldv2 multicast address
161      */
162     ip6_set_reserved_multicast_address (&pfx.fp_addr.ip6,
163                                         IP6_MULTICAST_SCOPE_link_local,
164                                         IP6_MULTICAST_GROUP_ID_mldv2_routers);
165     pfx.fp_len = 128;
166     fib_table_entry_special_remove(fib_index,
167                                    &pfx,
168                                    FIB_SOURCE_SPECIAL);
169
170     /*
171      * all link local 
172      */
173     pfx.fp_addr.ip6.as_u64[0] = clib_host_to_net_u64 (0xFE80000000000000ULL);
174     pfx.fp_addr.ip6.as_u64[1] = 0;
175     pfx.fp_len = 10;
176     fib_table_entry_special_remove(fib_index,
177                                    &pfx,
178                                    FIB_SOURCE_SPECIAL);
179
180     fib_table_t *fib_table = fib_table_get(fib_index, FIB_PROTOCOL_IP6);
181     fib_source_t source;
182     
183      /*
184      * validate no more routes.
185      */
186     ASSERT(0 == fib_table->ft_total_route_counts);
187     FOR_EACH_FIB_SOURCE(source)
188     {
189         ASSERT(0 == fib_table->ft_src_route_counts[source]);
190     }
191
192     if (~0 != fib_table->ft_table_id)
193     {
194         hash_unset (ip6_main.fib_index_by_table_id, fib_table->ft_table_id);
195     }
196     pool_put_index(ip6_main.v6_fibs, fib_table->ft_index);
197     pool_put(ip6_main.fibs, fib_table);
198 }
199
200 fib_node_index_t
201 ip6_fib_table_lookup (u32 fib_index,
202                       const ip6_address_t *addr,
203                       u32 len)
204 {
205     const ip6_fib_table_instance_t *table;
206     BVT(clib_bihash_kv) kv, value;
207     int i, n_p, rv;
208     u64 fib;
209
210     table = &ip6_main.ip6_table[IP6_FIB_TABLE_NON_FWDING];
211     n_p = vec_len (table->prefix_lengths_in_search_order);
212
213     kv.key[0] = addr->as_u64[0];
214     kv.key[1] = addr->as_u64[1];
215     fib = ((u64)((fib_index))<<32);
216
217     /*
218      * start search from a mask length same length or shorter.
219      * we don't want matches longer than the mask passed
220      */
221     i = 0;
222     while (i < n_p && table->prefix_lengths_in_search_order[i] > len)
223     {
224         i++;
225     }
226
227     for (; i < n_p; i++)
228     {
229         int dst_address_length = table->prefix_lengths_in_search_order[i];
230         ip6_address_t * mask = &ip6_main.fib_masks[dst_address_length];
231       
232         ASSERT(dst_address_length >= 0 && dst_address_length <= 128);
233         //As lengths are decreasing, masks are increasingly specific.
234         kv.key[0] &= mask->as_u64[0];
235         kv.key[1] &= mask->as_u64[1];
236         kv.key[2] = fib | dst_address_length;
237       
238         rv = BV(clib_bihash_search_inline_2)(&table->ip6_hash, &kv, &value);
239         if (rv == 0)
240             return value.value;
241     }
242
243     return (FIB_NODE_INDEX_INVALID);
244 }
245
246 fib_node_index_t
247 ip6_fib_table_lookup_exact_match (u32 fib_index,
248                                   const ip6_address_t *addr,
249                                   u32 len)
250 {
251     const ip6_fib_table_instance_t *table;
252     BVT(clib_bihash_kv) kv, value;
253     ip6_address_t *mask;
254     u64 fib;
255     int rv;
256
257     table = &ip6_main.ip6_table[IP6_FIB_TABLE_NON_FWDING];
258     mask = &ip6_main.fib_masks[len];
259     fib = ((u64)((fib_index))<<32);
260
261     kv.key[0] = addr->as_u64[0] & mask->as_u64[0];
262     kv.key[1] = addr->as_u64[1] & mask->as_u64[1];
263     kv.key[2] = fib | len;
264       
265     rv = BV(clib_bihash_search_inline_2)(&table->ip6_hash, &kv, &value);
266     if (rv == 0)
267         return value.value;
268
269     return (FIB_NODE_INDEX_INVALID);
270 }
271
272 static void
273 compute_prefix_lengths_in_search_order (ip6_fib_table_instance_t *table)
274 {
275     int i;
276     vec_reset_length (table->prefix_lengths_in_search_order);
277     /* Note: bitmap reversed so this is in fact a longest prefix match */
278     clib_bitmap_foreach (i, table->non_empty_dst_address_length_bitmap,
279     ({
280         int dst_address_length = 128 - i;
281         vec_add1(table->prefix_lengths_in_search_order, dst_address_length);
282     }));
283 }
284
285 void
286 ip6_fib_table_entry_remove (u32 fib_index,
287                             const ip6_address_t *addr,
288                             u32 len)
289 {
290     ip6_fib_table_instance_t *table;
291     BVT(clib_bihash_kv) kv;
292     ip6_address_t *mask;
293     u64 fib;
294
295     table = &ip6_main.ip6_table[IP6_FIB_TABLE_NON_FWDING];
296     mask = &ip6_main.fib_masks[len];
297     fib = ((u64)((fib_index))<<32);
298
299     kv.key[0] = addr->as_u64[0] & mask->as_u64[0];
300     kv.key[1] = addr->as_u64[1] & mask->as_u64[1];
301     kv.key[2] = fib | len;
302
303     BV(clib_bihash_add_del)(&table->ip6_hash, &kv, 0);
304
305     /* refcount accounting */
306     ASSERT (table->dst_address_length_refcounts[len] > 0);
307     if (--table->dst_address_length_refcounts[len] == 0)
308     {
309         table->non_empty_dst_address_length_bitmap =
310             clib_bitmap_set (table->non_empty_dst_address_length_bitmap, 
311                              128 - len, 0);
312         compute_prefix_lengths_in_search_order (table);
313     }
314 }
315
316 void
317 ip6_fib_table_entry_insert (u32 fib_index,
318                             const ip6_address_t *addr,
319                             u32 len,
320                             fib_node_index_t fib_entry_index)
321 {
322     ip6_fib_table_instance_t *table;
323     BVT(clib_bihash_kv) kv;
324     ip6_address_t *mask;
325     u64 fib;
326
327     table = &ip6_main.ip6_table[IP6_FIB_TABLE_NON_FWDING];
328     mask = &ip6_main.fib_masks[len];
329     fib = ((u64)((fib_index))<<32);
330
331     kv.key[0] = addr->as_u64[0] & mask->as_u64[0];
332     kv.key[1] = addr->as_u64[1] & mask->as_u64[1];
333     kv.key[2] = fib | len;
334     kv.value = fib_entry_index;
335
336     BV(clib_bihash_add_del)(&table->ip6_hash, &kv, 1);
337
338     table->dst_address_length_refcounts[len]++;
339
340     table->non_empty_dst_address_length_bitmap =
341         clib_bitmap_set (table->non_empty_dst_address_length_bitmap, 
342                          128 - len, 1);
343     compute_prefix_lengths_in_search_order (table);
344 }
345
346 u32 
347 ip6_fib_table_fwding_lookup (ip6_main_t * im,
348                              u32 fib_index,
349                              const ip6_address_t * dst)
350 {
351     const ip6_fib_table_instance_t *table;
352     int i, len;
353     int rv;
354     BVT(clib_bihash_kv) kv, value;
355     u64 fib;
356
357     table = &ip6_main.ip6_table[IP6_FIB_TABLE_FWDING];
358     len = vec_len (table->prefix_lengths_in_search_order);
359
360     kv.key[0] = dst->as_u64[0];
361     kv.key[1] = dst->as_u64[1];
362     fib = ((u64)((fib_index))<<32);
363
364     for (i = 0; i < len; i++)
365     {
366         int dst_address_length = table->prefix_lengths_in_search_order[i];
367         ip6_address_t * mask = &ip6_main.fib_masks[dst_address_length];
368       
369         ASSERT(dst_address_length >= 0 && dst_address_length <= 128);
370         //As lengths are decreasing, masks are increasingly specific.
371         kv.key[0] &= mask->as_u64[0];
372         kv.key[1] &= mask->as_u64[1];
373         kv.key[2] = fib | dst_address_length;
374       
375         rv = BV(clib_bihash_search_inline_2)(&table->ip6_hash, &kv, &value);
376         if (rv == 0)
377             return value.value;
378     }
379
380     /* default route is always present */
381     ASSERT(0);
382     return 0;
383 }
384
385 u32 ip6_fib_table_fwding_lookup_with_if_index (ip6_main_t * im,
386                                                u32 sw_if_index,
387                                                const ip6_address_t * dst)
388 {
389     u32 fib_index = vec_elt (im->fib_index_by_sw_if_index, sw_if_index);
390     return ip6_fib_table_fwding_lookup(im, fib_index, dst);
391 }
392
393 flow_hash_config_t
394 ip6_fib_table_get_flow_hash_config (u32 fib_index)
395 {
396     return (ip6_fib_get(fib_index)->flow_hash_config);
397 }
398
399 u32
400 ip6_fib_table_get_index_for_sw_if_index (u32 sw_if_index)
401 {
402     if (sw_if_index >= vec_len(ip6_main.fib_index_by_sw_if_index))
403     {
404         /*
405          * This is the case for interfaces that are not yet mapped to
406          * a IP table
407          */
408         return (~0);
409     }
410     return (ip6_main.fib_index_by_sw_if_index[sw_if_index]);
411 }
412
413 void
414 ip6_fib_table_fwding_dpo_update (u32 fib_index,
415                                  const ip6_address_t *addr,
416                                  u32 len,
417                                  const dpo_id_t *dpo)
418 {
419     ip6_fib_table_instance_t *table;
420     BVT(clib_bihash_kv) kv;
421     ip6_address_t *mask;
422     u64 fib;
423
424     table = &ip6_main.ip6_table[IP6_FIB_TABLE_FWDING];
425     mask = &ip6_main.fib_masks[len];
426     fib = ((u64)((fib_index))<<32);
427
428     kv.key[0] = addr->as_u64[0] & mask->as_u64[0];
429     kv.key[1] = addr->as_u64[1] & mask->as_u64[1];
430     kv.key[2] = fib | len;
431     kv.value = dpo->dpoi_index;
432
433     BV(clib_bihash_add_del)(&table->ip6_hash, &kv, 1);
434
435     table->dst_address_length_refcounts[len]++;
436
437     table->non_empty_dst_address_length_bitmap =
438         clib_bitmap_set (table->non_empty_dst_address_length_bitmap, 
439                          128 - len, 1);
440     compute_prefix_lengths_in_search_order (table);
441 }
442
443 void
444 ip6_fib_table_fwding_dpo_remove (u32 fib_index,
445                                  const ip6_address_t *addr,
446                                  u32 len,
447                                  const dpo_id_t *dpo)
448 {
449     ip6_fib_table_instance_t *table;
450     BVT(clib_bihash_kv) kv;
451     ip6_address_t *mask;
452     u64 fib;
453
454     table = &ip6_main.ip6_table[IP6_FIB_TABLE_FWDING];
455     mask = &ip6_main.fib_masks[len];
456     fib = ((u64)((fib_index))<<32);
457
458     kv.key[0] = addr->as_u64[0] & mask->as_u64[0];
459     kv.key[1] = addr->as_u64[1] & mask->as_u64[1];
460     kv.key[2] = fib | len;
461     kv.value = dpo->dpoi_index;
462
463     BV(clib_bihash_add_del)(&table->ip6_hash, &kv, 0);
464
465     /* refcount accounting */
466     ASSERT (table->dst_address_length_refcounts[len] > 0);
467     if (--table->dst_address_length_refcounts[len] == 0)
468     {
469         table->non_empty_dst_address_length_bitmap =
470             clib_bitmap_set (table->non_empty_dst_address_length_bitmap,
471                              128 - len, 0);
472         compute_prefix_lengths_in_search_order (table);
473     }
474 }
475
476 /**
477  * @brief Context when walking the IPv6 table. Since all VRFs are in the
478  * same hash table, we need to filter only those we need as we walk
479  */
480 typedef struct ip6_fib_walk_ctx_t_
481 {
482     u32 i6w_fib_index;
483     fib_table_walk_fn_t i6w_fn;
484     void *i6w_ctx;
485 } ip6_fib_walk_ctx_t;
486
487 static int
488 ip6_fib_walk_cb (clib_bihash_kv_24_8_t * kvp,
489                  void *arg)
490 {
491     ip6_fib_walk_ctx_t *ctx = arg;
492
493     if ((kvp->key[2] >> 32) == ctx->i6w_fib_index)
494     {
495         ctx->i6w_fn(kvp->value, ctx->i6w_ctx);
496     }
497
498     return (1);
499 }
500
501 void
502 ip6_fib_table_walk (u32 fib_index,
503                     fib_table_walk_fn_t fn,
504                     void *arg)
505 {
506     ip6_fib_walk_ctx_t ctx = {
507         .i6w_fib_index = fib_index,
508         .i6w_fn = fn,
509         .i6w_ctx = arg,
510     };
511     ip6_main_t *im = &ip6_main;
512
513     BV(clib_bihash_foreach_key_value_pair)(&im->ip6_table[IP6_FIB_TABLE_NON_FWDING].ip6_hash,
514                                            ip6_fib_walk_cb,
515                                            &ctx);
516
517 }
518
519 typedef struct ip6_fib_show_ctx_t_ {
520     fib_node_index_t *entries;
521 } ip6_fib_show_ctx_t;
522
523 static int
524 ip6_fib_table_show_walk (fib_node_index_t fib_entry_index,
525                          void *arg)
526 {
527     ip6_fib_show_ctx_t *ctx = arg;
528
529     vec_add1(ctx->entries, fib_entry_index);
530
531     return (1);
532 }
533
534 static void
535 ip6_fib_table_show_all (ip6_fib_t *fib,
536                         vlib_main_t * vm)
537 {
538     fib_node_index_t *fib_entry_index;
539     ip6_fib_show_ctx_t ctx = {
540         .entries = NULL,
541     };
542
543     ip6_fib_table_walk(fib->index, ip6_fib_table_show_walk, &ctx);
544     vec_sort_with_function(ctx.entries, fib_entry_cmp_for_sort);
545
546     vec_foreach(fib_entry_index, ctx.entries)
547     {
548         vlib_cli_output(vm, "%U",
549                         format_fib_entry,
550                         *fib_entry_index,
551                         FIB_ENTRY_FORMAT_BRIEF);
552     }
553
554     vec_free(ctx.entries);
555 }
556
557 static void
558 ip6_fib_table_show_one (ip6_fib_t *fib,
559                         vlib_main_t * vm,
560                         ip6_address_t *address,
561                         u32 mask_len,
562                         int detail)
563 {
564     vlib_cli_output(vm, "%U",
565                     format_fib_entry,
566                     ip6_fib_table_lookup(fib->index, address, mask_len),
567                     (detail ?
568                      FIB_ENTRY_FORMAT_DETAIL2:
569                      FIB_ENTRY_FORMAT_DETAIL));
570 }
571
572 typedef struct {
573   u32 fib_index;
574   u64 count_by_prefix_length[129];
575 } count_routes_in_fib_at_prefix_length_arg_t;
576
577 static void
578 count_routes_in_fib_at_prefix_length (BVT(clib_bihash_kv) * kvp,
579                                       void *arg)
580 {
581   count_routes_in_fib_at_prefix_length_arg_t * ap = arg;
582   int mask_width;
583
584   if ((kvp->key[2]>>32) != ap->fib_index)
585     return;
586
587   mask_width = kvp->key[2] & 0xFF;
588
589   ap->count_by_prefix_length[mask_width]++;
590 }
591
592 static clib_error_t *
593 ip6_show_fib (vlib_main_t * vm,
594               unformat_input_t * input,
595               vlib_cli_command_t * cmd)
596 {
597     count_routes_in_fib_at_prefix_length_arg_t _ca, *ca = &_ca;
598     ip6_main_t * im6 = &ip6_main;
599     fib_table_t *fib_table;
600     ip6_fib_t * fib;
601     int verbose, matching;
602     ip6_address_t matching_address;
603     u32 mask_len  = 128;
604     int table_id = -1, fib_index = ~0;
605     int detail = 0;
606
607     verbose = 1;
608     matching = 0;
609
610     while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
611     {
612         if (unformat (input, "brief")   ||
613             unformat (input, "summary") ||
614             unformat (input, "sum"))
615             verbose = 0;
616  
617         else if (unformat (input, "detail")   ||
618                  unformat (input, "det"))
619             detail = 1;
620
621         else if (unformat (input, "%U/%d",
622                            unformat_ip6_address, &matching_address, &mask_len))
623             matching = 1;
624
625         else if (unformat (input, "%U", unformat_ip6_address, &matching_address))
626             matching = 1;
627
628         else if (unformat (input, "table %d", &table_id))
629             ;
630         else if (unformat (input, "index %d", &fib_index))
631             ;
632         else
633             break;
634     }
635
636     pool_foreach (fib_table, im6->fibs,
637     ({
638         fib = pool_elt_at_index(im6->v6_fibs, fib_table->ft_index);
639         if (table_id >= 0 && table_id != (int)fib->table_id)
640             continue;
641         if (fib_index != ~0 && fib_index != (int)fib->index)
642             continue;
643
644         vlib_cli_output (vm, "%s, fib_index %d, flow hash: %U", 
645                          fib_table->ft_desc, fib->index,
646                          format_ip_flow_hash_config, fib->flow_hash_config);
647
648         /* Show summary? */
649         if (! verbose)
650         {
651             BVT(clib_bihash) * h = &im6->ip6_table[IP6_FIB_TABLE_NON_FWDING].ip6_hash;
652             int len;
653
654             vlib_cli_output (vm, "%=20s%=16s", "Prefix length", "Count");
655
656             memset (ca, 0, sizeof(*ca));
657             ca->fib_index = fib->index;
658
659             BV(clib_bihash_foreach_key_value_pair)
660                 (h, count_routes_in_fib_at_prefix_length, ca);
661
662             for (len = 128; len >= 0; len--)
663             {
664                 if (ca->count_by_prefix_length[len])
665                     vlib_cli_output (vm, "%=20d%=16lld", 
666                                      len, ca->count_by_prefix_length[len]);
667             }
668             continue;
669         }
670
671         if (!matching)
672         {
673             ip6_fib_table_show_all(fib, vm);
674         }
675         else
676         {
677             ip6_fib_table_show_one(fib, vm, &matching_address, mask_len, detail);
678         }
679     }));
680
681     return 0;
682 }
683
684 /*?
685  * This command displays the IPv6 FIB Tables (VRF Tables) and the route
686  * entries for each table.
687  *
688  * @note This command will run for a long time when the FIB tables are
689  * comprised of millions of entries. For those senarios, consider displaying
690  * in summary mode.
691  *
692  * @cliexpar
693  * @parblock
694  * Example of how to display all the IPv6 FIB tables:
695  * @cliexstart{show ip6 fib}
696  * ipv6-VRF:0, fib_index 0, flow hash: src dst sport dport proto
697  * @::/0
698  *   unicast-ip6-chain
699  *   [@0]: dpo-load-balance: [index:5 buckets:1 uRPF:5 to:[0:0]]
700  *     [0] [@0]: dpo-drop ip6
701  * fe80::/10
702  *   unicast-ip6-chain
703  *   [@0]: dpo-load-balance: [index:10 buckets:1 uRPF:10 to:[0:0]]
704  *     [0] [@2]: dpo-receive
705  * ff02::1/128
706  *   unicast-ip6-chain
707  *   [@0]: dpo-load-balance: [index:8 buckets:1 uRPF:8 to:[0:0]]
708  *     [0] [@2]: dpo-receive
709  * ff02::2/128
710  *   unicast-ip6-chain
711  *   [@0]: dpo-load-balance: [index:7 buckets:1 uRPF:7 to:[0:0]]
712  *     [0] [@2]: dpo-receive
713  * ff02::16/128
714  *   unicast-ip6-chain
715  *   [@0]: dpo-load-balance: [index:9 buckets:1 uRPF:9 to:[0:0]]
716  *     [0] [@2]: dpo-receive
717  * ff02::1:ff00:0/104
718  *   unicast-ip6-chain
719  *   [@0]: dpo-load-balance: [index:6 buckets:1 uRPF:6 to:[0:0]]
720  *     [0] [@2]: dpo-receive
721  * ipv6-VRF:8, fib_index 1, flow hash: src dst sport dport proto
722  * @::/0
723  *   unicast-ip6-chain
724  *   [@0]: dpo-load-balance: [index:21 buckets:1 uRPF:20 to:[0:0]]
725  *     [0] [@0]: dpo-drop ip6
726  * @::a:1:1:0:4/126
727  *   unicast-ip6-chain
728  *   [@0]: dpo-load-balance: [index:27 buckets:1 uRPF:26 to:[0:0]]
729  *     [0] [@4]: ipv6-glean: af_packet0
730  * @::a:1:1:0:7/128
731  *   unicast-ip6-chain
732  *   [@0]: dpo-load-balance: [index:28 buckets:1 uRPF:27 to:[0:0]]
733  *     [0] [@2]: dpo-receive: @::a:1:1:0:7 on af_packet0
734  * fe80::/10
735  *   unicast-ip6-chain
736  *   [@0]: dpo-load-balance: [index:26 buckets:1 uRPF:25 to:[0:0]]
737  *     [0] [@2]: dpo-receive
738  * fe80::fe:3eff:fe3e:9222/128
739  *   unicast-ip6-chain
740  *   [@0]: dpo-load-balance: [index:29 buckets:1 uRPF:28 to:[0:0]]
741  *     [0] [@2]: dpo-receive: fe80::fe:3eff:fe3e:9222 on af_packet0
742  * ff02::1/128
743  *   unicast-ip6-chain
744  *   [@0]: dpo-load-balance: [index:24 buckets:1 uRPF:23 to:[0:0]]
745  *     [0] [@2]: dpo-receive
746  * ff02::2/128
747  *   unicast-ip6-chain
748  *   [@0]: dpo-load-balance: [index:23 buckets:1 uRPF:22 to:[0:0]]
749  *     [0] [@2]: dpo-receive
750  * ff02::16/128
751  *   unicast-ip6-chain
752  *   [@0]: dpo-load-balance: [index:25 buckets:1 uRPF:24 to:[0:0]]
753  *     [0] [@2]: dpo-receive
754  * ff02::1:ff00:0/104
755  *   unicast-ip6-chain
756  *   [@0]: dpo-load-balance: [index:22 buckets:1 uRPF:21 to:[0:0]]
757  *     [0] [@2]: dpo-receive
758  * @cliexend
759  *
760  * Example of how to display a summary of all IPv6 FIB tables:
761  * @cliexstart{show ip6 fib summary}
762  * ipv6-VRF:0, fib_index 0, flow hash: src dst sport dport proto
763  *     Prefix length         Count
764  *          128                3
765  *          104                1
766  *          10                 1
767  *           0                 1
768  * ipv6-VRF:8, fib_index 1, flow hash: src dst sport dport proto
769  *     Prefix length         Count
770  *          128                5
771  *          126                1
772  *          104                1
773  *          10                 1
774  *           0                 1
775  * @cliexend
776  * @endparblock
777  ?*/
778 /* *INDENT-OFF* */
779 VLIB_CLI_COMMAND (ip6_show_fib_command, static) = {
780     .path = "show ip6 fib",
781     .short_help = "show ip6 fib [summary] [table <table-id>] [index <fib-id>] [<ip6-addr>[/<width>]] [detail]",
782     .function = ip6_show_fib,
783 };
784 /* *INDENT-ON* */