a7915620b372c91f38bbfe89ed178d8e2a028635
[vpp.git] / src / vnet / fib / ip4_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/fib_table.h>
17 #include <vnet/fib/fib_entry.h>
18 #include <vnet/fib/ip4_fib.h>
19
20 /*
21  * A table of pefixes to be added to tables and the sources for them
22  */
23 typedef struct ip4_fib_table_special_prefix_t_ {
24     fib_prefix_t ift_prefix;
25     fib_source_t ift_source;
26     fib_entry_flag_t ift_flag;
27 } ip4_fib_table_special_prefix_t;
28
29 static const ip4_fib_table_special_prefix_t ip4_specials[] = {
30     {
31         /* 0.0.0.0/0*/
32         .ift_prefix = {
33             .fp_addr = {
34                 .ip4.data_u32 = 0,
35             },
36             .fp_len  = 0,
37             .fp_proto = FIB_PROTOCOL_IP4,
38         },
39         .ift_source = FIB_SOURCE_DEFAULT_ROUTE,
40         .ift_flag   = FIB_ENTRY_FLAG_DROP,
41     },
42     {
43         /* 0.0.0.0/32*/
44         .ift_prefix = {
45             .fp_addr = {
46                 .ip4.data_u32 = 0,
47             },
48             .fp_len  = 32,
49             .fp_proto = FIB_PROTOCOL_IP4,
50         },
51         .ift_source = FIB_SOURCE_DEFAULT_ROUTE,
52         .ift_flag   = FIB_ENTRY_FLAG_DROP,
53     },
54     {
55         /*
56          * 240.0.0.0/4
57          * drop class E
58          */
59         .ift_prefix = {
60             .fp_addr = {
61                 .ip4.data_u32 = 0xf0000000,
62             },
63             .fp_len   = 4,
64             .fp_proto = FIB_PROTOCOL_IP4,
65         },
66         .ift_source = FIB_SOURCE_SPECIAL,
67         .ift_flag   = FIB_ENTRY_FLAG_DROP,
68
69     },
70     {
71         /*
72          * 224.0.0.0/4
73          * drop all mcast
74          */
75         .ift_prefix = {
76             .fp_addr = {
77                 .ip4.data_u32 = 0xe0000000,
78             },
79             .fp_len   = 4,
80             .fp_proto = FIB_PROTOCOL_IP4,
81         },
82         .ift_source = FIB_SOURCE_SPECIAL,
83         .ift_flag    = FIB_ENTRY_FLAG_DROP,
84     },
85     {
86         /*
87          * 255.255.255.255/32
88          * drop, but we'll allow it to be usurped by the likes of DHCP
89          */
90         .ift_prefix = {
91             .fp_addr = {
92                 .ip4.data_u32 = 0xffffffff,
93             },
94             .fp_len   = 32,
95             .fp_proto = FIB_PROTOCOL_IP4,
96         },
97         .ift_source = FIB_SOURCE_DEFAULT_ROUTE,
98         .ift_flag   = FIB_ENTRY_FLAG_DROP,
99     }
100 };
101
102
103 static u32
104 ip4_create_fib_with_table_id (u32 table_id)
105 {
106     fib_table_t *fib_table;
107
108     pool_get_aligned(ip4_main.fibs, fib_table, CLIB_CACHE_LINE_BYTES);
109     memset(fib_table, 0, sizeof(*fib_table));
110
111     fib_table->ft_proto = FIB_PROTOCOL_IP4;
112     fib_table->ft_index =
113         fib_table->v4.index =
114             (fib_table - ip4_main.fibs);
115
116     hash_set (ip4_main.fib_index_by_table_id, table_id, fib_table->ft_index);
117
118     fib_table->ft_table_id =
119         fib_table->v4.table_id =
120             table_id;
121     fib_table->ft_flow_hash_config = 
122         fib_table->v4.flow_hash_config =
123             IP_FLOW_HASH_DEFAULT;
124     fib_table->v4.fwd_classify_table_index = ~0;
125     fib_table->v4.rev_classify_table_index = ~0;
126     
127     fib_table_lock(fib_table->ft_index, FIB_PROTOCOL_IP4);
128
129     ip4_mtrie_init(&fib_table->v4.mtrie);
130
131     /*
132      * add the special entries into the new FIB
133      */
134     int ii;
135
136     for (ii = 0; ii < ARRAY_LEN(ip4_specials); ii++)
137     {
138         fib_prefix_t prefix = ip4_specials[ii].ift_prefix;
139
140         prefix.fp_addr.ip4.data_u32 =
141             clib_host_to_net_u32(prefix.fp_addr.ip4.data_u32);
142
143         fib_table_entry_special_add(fib_table->ft_index,
144                                     &prefix,
145                                     ip4_specials[ii].ift_source,
146                                     ip4_specials[ii].ift_flag,
147                                     ADJ_INDEX_INVALID);
148     }
149
150     return (fib_table->ft_index);
151 }
152
153 void
154 ip4_fib_table_destroy (ip4_fib_t *fib)
155 {
156     fib_table_t *fib_table = (fib_table_t*)fib;
157     int ii;
158
159     /*
160      * remove all the specials we added when the table was created.
161      * In reverse order so the default route is last.
162      */
163     for (ii = ARRAY_LEN(ip4_specials) - 1; ii >= 0; ii--)
164     {
165         fib_prefix_t prefix = ip4_specials[ii].ift_prefix;
166
167         prefix.fp_addr.ip4.data_u32 =
168             clib_host_to_net_u32(prefix.fp_addr.ip4.data_u32);
169
170         fib_table_entry_special_remove(fib_table->ft_index,
171                                        &prefix,
172                                        ip4_specials[ii].ift_source);
173     }
174
175     /*
176      * validate no more routes.
177      */
178     ASSERT(0 == fib_table->ft_total_route_counts);
179     FOR_EACH_FIB_SOURCE(ii)
180     {
181         ASSERT(0 == fib_table->ft_src_route_counts[ii]);
182     }
183
184     if (~0 != fib_table->ft_table_id)
185     {
186         hash_unset (ip4_main.fib_index_by_table_id, fib_table->ft_table_id);
187     }
188     pool_put(ip4_main.fibs, fib_table);
189 }
190
191
192 u32
193 ip4_fib_table_find_or_create_and_lock (u32 table_id)
194 {
195     u32 index;
196
197     index = ip4_fib_index_from_table_id(table_id);
198     if (~0 == index)
199         return ip4_create_fib_with_table_id(table_id);
200
201     fib_table_lock(index, FIB_PROTOCOL_IP4);
202
203     return (index);
204 }
205
206 u32
207 ip4_fib_table_create_and_lock (void)
208 {
209     return (ip4_create_fib_with_table_id(~0));
210 }
211
212 u32
213 ip4_fib_table_get_index_for_sw_if_index (u32 sw_if_index)
214 {
215     if (sw_if_index >= vec_len(ip4_main.fib_index_by_sw_if_index))
216     {
217         /*
218          * This is the case for interfaces that are not yet mapped to
219          * a IP table
220          */
221         return (~0);
222     }
223     return (ip4_main.fib_index_by_sw_if_index[sw_if_index]);
224 }
225
226 flow_hash_config_t
227 ip4_fib_table_get_flow_hash_config (u32 fib_index)
228 {
229     return (ip4_fib_get(fib_index)->flow_hash_config);
230 }
231
232 /*
233  * ip4_fib_table_lookup_exact_match
234  *
235  * Exact match prefix lookup
236  */
237 fib_node_index_t
238 ip4_fib_table_lookup_exact_match (const ip4_fib_t *fib,
239                                   const ip4_address_t *addr,
240                                   u32 len)
241 {
242     uword * hash, * result;
243     u32 key;
244
245     hash = fib->fib_entry_by_dst_address[len];
246     key  = (addr->data_u32 & ip4_main.fib_masks[len]);
247
248     result = hash_get(hash, key);
249
250     if (NULL != result) {
251         return (result[0]);
252     }
253     return (FIB_NODE_INDEX_INVALID);
254 }
255
256 /*
257  * ip4_fib_table_lookup_adj
258  *
259  * Longest prefix match
260  */
261 index_t
262 ip4_fib_table_lookup_lb (ip4_fib_t *fib,
263                          const ip4_address_t *addr)
264 {
265     fib_node_index_t fei;
266
267     fei = ip4_fib_table_lookup(fib, addr, 32);
268
269     if (FIB_NODE_INDEX_INVALID != fei)
270     {
271         const dpo_id_t *dpo;
272
273         dpo = fib_entry_contribute_ip_forwarding(fei);
274
275         return (dpo->dpoi_index);
276     }
277     return (INDEX_INVALID);
278 }
279
280 /*
281  * ip4_fib_table_lookup
282  *
283  * Longest prefix match
284  */
285 fib_node_index_t
286 ip4_fib_table_lookup (const ip4_fib_t *fib,
287                       const ip4_address_t *addr,
288                       u32 len)
289 {
290     uword * hash, * result;
291     i32 mask_len;
292     u32 key;
293
294     for (mask_len = len; mask_len >= 0; mask_len--)
295     {
296         hash = fib->fib_entry_by_dst_address[mask_len];
297         key = (addr->data_u32 & ip4_main.fib_masks[mask_len]);
298
299         result = hash_get (hash, key);
300
301         if (NULL != result) {
302             return (result[0]);
303         }
304     }
305     return (FIB_NODE_INDEX_INVALID);
306 }
307
308 void
309 ip4_fib_table_entry_insert (ip4_fib_t *fib,
310                             const ip4_address_t *addr,
311                             u32 len,
312                             fib_node_index_t fib_entry_index)
313 {
314     uword * hash, * result;
315     u32 key;
316
317     key = (addr->data_u32 & ip4_main.fib_masks[len]);
318     hash = fib->fib_entry_by_dst_address[len];
319     result = hash_get (hash, key);
320
321     if (NULL == result) {
322         /*
323          * adding a new entry
324          */
325         if (NULL == hash) {
326             hash = hash_create (32 /* elts */, sizeof (uword));
327             hash_set_flags (hash, HASH_FLAG_NO_AUTO_SHRINK);
328         }
329         hash = hash_set(hash, key, fib_entry_index);
330         fib->fib_entry_by_dst_address[len] = hash;
331     }
332     else
333     {
334         ASSERT(0);
335     }
336 }
337
338 void
339 ip4_fib_table_entry_remove (ip4_fib_t *fib,
340                             const ip4_address_t *addr,
341                             u32 len)
342 {
343     uword * hash, * result;
344     u32 key;
345
346     key = (addr->data_u32 & ip4_main.fib_masks[len]);
347     hash = fib->fib_entry_by_dst_address[len];
348     result = hash_get (hash, key);
349
350     if (NULL == result)
351     {
352         /*
353          * removing a non-existant entry. i'll allow it.
354          */
355     }
356     else 
357     {
358         hash_unset(hash, key);
359     }
360
361     fib->fib_entry_by_dst_address[len] = hash;
362 }
363
364 void
365 ip4_fib_table_fwding_dpo_update (ip4_fib_t *fib,
366                                  const ip4_address_t *addr,
367                                  u32 len,
368                                  const dpo_id_t *dpo)
369 {
370     ip4_fib_mtrie_add_del_route(fib, *addr, len, dpo->dpoi_index, 0); // ADD
371 }
372
373 void
374 ip4_fib_table_fwding_dpo_remove (ip4_fib_t *fib,
375                                  const ip4_address_t *addr,
376                                  u32 len,
377                                  const dpo_id_t *dpo)
378 {
379     ip4_fib_mtrie_add_del_route(fib, *addr, len, dpo->dpoi_index, 1); // DELETE
380 }
381
382 void
383 ip4_fib_table_walk (ip4_fib_t *fib,
384                     fib_table_walk_fn_t fn,
385                     void *ctx)
386 {
387     int i;
388
389     for (i = 0; i < ARRAY_LEN (fib->fib_entry_by_dst_address); i++)
390     {
391         uword * hash = fib->fib_entry_by_dst_address[i];
392
393         if (NULL != hash)
394         {
395             hash_pair_t * p;
396
397             hash_foreach_pair (p, hash,
398             ({
399                 fn(p->value[0], ctx);
400             }));
401         }
402     }
403 }
404
405 /**
406  * Walk show context
407  */
408 typedef struct ip4_fib_show_walk_ctx_t_
409 {
410     fib_node_index_t *ifsw_indicies;
411 } ip4_fib_show_walk_ctx_t;
412
413 static int
414 ip4_fib_show_walk_cb (fib_node_index_t fib_entry_index,
415                       void *arg)
416 {
417     ip4_fib_show_walk_ctx_t *ctx = arg;
418
419     vec_add1(ctx->ifsw_indicies, fib_entry_index);
420
421     return (1);
422 }
423
424 static void
425 ip4_fib_table_show_all (ip4_fib_t *fib,
426                         vlib_main_t * vm)
427 {
428     ip4_fib_show_walk_ctx_t ctx = {
429         .ifsw_indicies = NULL,
430     };
431     fib_node_index_t *fib_entry_index;
432
433     ip4_fib_table_walk(fib, ip4_fib_show_walk_cb, &ctx);
434     vec_sort_with_function(ctx.ifsw_indicies,
435                            fib_entry_cmp_for_sort);
436
437     vec_foreach(fib_entry_index, ctx.ifsw_indicies)
438     {
439         vlib_cli_output(vm, "%U",
440                         format_fib_entry,
441                         *fib_entry_index,
442                         FIB_ENTRY_FORMAT_BRIEF);
443     }
444
445     vec_free(ctx.ifsw_indicies);
446 }
447
448 static void
449 ip4_fib_table_show_one (ip4_fib_t *fib,
450                         vlib_main_t * vm,
451                         ip4_address_t *address,
452                         u32 mask_len)
453 {    
454     vlib_cli_output(vm, "%U",
455                     format_fib_entry,
456                     ip4_fib_table_lookup(fib, address, mask_len),
457                     FIB_ENTRY_FORMAT_DETAIL);
458 }
459
460 static clib_error_t *
461 ip4_show_fib (vlib_main_t * vm,
462               unformat_input_t * input,
463               vlib_cli_command_t * cmd)
464 {
465     ip4_main_t * im4 = &ip4_main;
466     fib_table_t * fib_table;
467     int verbose, matching, mtrie;
468     ip4_address_t matching_address;
469     u32 matching_mask = 32;
470     int i, table_id = -1, fib_index = ~0;
471
472     verbose = 1;
473     matching = 0;
474     mtrie = 0;
475     while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
476     {
477         if (unformat (input, "brief") || unformat (input, "summary")
478             || unformat (input, "sum"))
479             verbose = 0;
480
481         else if (unformat (input, "mtrie"))
482             mtrie = 1;
483
484         else if (unformat (input, "%U/%d",
485                            unformat_ip4_address, &matching_address, &matching_mask))
486             matching = 1;
487
488         else if (unformat (input, "%U", unformat_ip4_address, &matching_address))
489             matching = 1;
490
491         else if (unformat (input, "table %d", &table_id))
492             ;
493         else if (unformat (input, "index %d", &fib_index))
494             ;
495         else
496             break;
497     }
498
499     pool_foreach (fib_table, im4->fibs,
500     ({
501         ip4_fib_t *fib = &fib_table->v4;
502
503         if (table_id >= 0 && table_id != (int)fib->table_id)
504             continue;
505         if (fib_index != ~0 && fib_index != (int)fib->index)
506             continue;
507
508         vlib_cli_output (vm, "%U, fib_index %d, flow hash: %U", 
509                          format_fib_table_name, fib->index, FIB_PROTOCOL_IP4,
510                          fib->index,
511                          format_ip_flow_hash_config, fib->flow_hash_config);
512
513         /* Show summary? */
514         if (! verbose)
515         {
516             vlib_cli_output (vm, "%=20s%=16s", "Prefix length", "Count");
517             for (i = 0; i < ARRAY_LEN (fib->fib_entry_by_dst_address); i++)
518             {
519                 uword * hash = fib->fib_entry_by_dst_address[i];
520                 uword n_elts = hash_elts (hash);
521                 if (n_elts > 0)
522                     vlib_cli_output (vm, "%20d%16d", i, n_elts);
523             }
524             continue;
525         }
526
527         if (!matching)
528         {
529             ip4_fib_table_show_all(fib, vm);
530         }
531         else
532         {
533             ip4_fib_table_show_one(fib, vm, &matching_address, matching_mask);
534         }
535
536         if (mtrie)
537             vlib_cli_output (vm, "%U", format_ip4_fib_mtrie, &fib->mtrie);
538     }));
539
540     return 0;
541 }
542
543 /*?
544  * This command displays the IPv4 FIB Tables (VRF Tables) and the route
545  * entries for each table.
546  *
547  * @note This command will run for a long time when the FIB tables are
548  * comprised of millions of entries. For those senarios, consider displaying
549  * a single table or summary mode.
550  *
551  * @cliexpar
552  * Example of how to display all the IPv4 FIB tables:
553  * @cliexstart{show ip fib}
554  * ipv4-VRF:0, fib_index 0, flow hash: src dst sport dport proto
555  * 0.0.0.0/0
556  *   unicast-ip4-chain
557  *   [@0]: dpo-load-balance: [index:0 buckets:1 uRPF:0 to:[0:0]]
558  *     [0] [@0]: dpo-drop ip6
559  * 0.0.0.0/32
560  *   unicast-ip4-chain
561  *   [@0]: dpo-load-balance: [index:1 buckets:1 uRPF:1 to:[0:0]]
562  *     [0] [@0]: dpo-drop ip6
563  * 6.0.1.2/32
564  *   unicast-ip4-chain
565  *   [@0]: dpo-load-balance: [index:30 buckets:1 uRPF:29 to:[0:0]]
566  *     [0] [@3]: arp-ipv4: via 6.0.0.1 af_packet0
567  * 7.0.0.1/32
568  *   unicast-ip4-chain
569  *   [@0]: dpo-load-balance: [index:31 buckets:4 uRPF:30 to:[0:0]]
570  *     [0] [@3]: arp-ipv4: via 6.0.0.2 af_packet0
571  *     [1] [@3]: arp-ipv4: via 6.0.0.2 af_packet0
572  *     [2] [@3]: arp-ipv4: via 6.0.0.2 af_packet0
573  *     [3] [@3]: arp-ipv4: via 6.0.0.1 af_packet0
574  * 224.0.0.0/8
575  *   unicast-ip4-chain
576  *   [@0]: dpo-load-balance: [index:3 buckets:1 uRPF:3 to:[0:0]]
577  *     [0] [@0]: dpo-drop ip6
578  * 240.0.0.0/8
579  *   unicast-ip4-chain
580  *   [@0]: dpo-load-balance: [index:2 buckets:1 uRPF:2 to:[0:0]]
581  *     [0] [@0]: dpo-drop ip6
582  * 255.255.255.255/32
583  *   unicast-ip4-chain
584  *   [@0]: dpo-load-balance: [index:4 buckets:1 uRPF:4 to:[0:0]]
585  *     [0] [@0]: dpo-drop ip6
586  * ipv4-VRF:7, fib_index 1, flow hash: src dst sport dport proto
587  * 0.0.0.0/0
588  *   unicast-ip4-chain
589  *   [@0]: dpo-load-balance: [index:12 buckets:1 uRPF:11 to:[0:0]]
590  *     [0] [@0]: dpo-drop ip6
591  * 0.0.0.0/32
592  *   unicast-ip4-chain
593  *   [@0]: dpo-load-balance: [index:13 buckets:1 uRPF:12 to:[0:0]]
594  *     [0] [@0]: dpo-drop ip6
595  * 172.16.1.0/24
596  *   unicast-ip4-chain
597  *   [@0]: dpo-load-balance: [index:17 buckets:1 uRPF:16 to:[0:0]]
598  *     [0] [@4]: ipv4-glean: af_packet0
599  * 172.16.1.1/32
600  *   unicast-ip4-chain
601  *   [@0]: dpo-load-balance: [index:18 buckets:1 uRPF:17 to:[1:84]]
602  *     [0] [@2]: dpo-receive: 172.16.1.1 on af_packet0
603  * 172.16.1.2/32
604  *   unicast-ip4-chain
605  *   [@0]: dpo-load-balance: [index:21 buckets:1 uRPF:20 to:[0:0]]
606  *     [0] [@5]: ipv4 via 172.16.1.2 af_packet0: IP4: 02:fe:9e:70:7a:2b -> 26:a5:f6:9c:3a:36
607  * 172.16.2.0/24
608  *   unicast-ip4-chain
609  *   [@0]: dpo-load-balance: [index:19 buckets:1 uRPF:18 to:[0:0]]
610  *     [0] [@4]: ipv4-glean: af_packet1
611  * 172.16.2.1/32
612  *   unicast-ip4-chain
613  *   [@0]: dpo-load-balance: [index:20 buckets:1 uRPF:19 to:[0:0]]
614  *     [0] [@2]: dpo-receive: 172.16.2.1 on af_packet1
615  * 224.0.0.0/8
616  *   unicast-ip4-chain
617  *   [@0]: dpo-load-balance: [index:15 buckets:1 uRPF:14 to:[0:0]]
618  *     [0] [@0]: dpo-drop ip6
619  * 240.0.0.0/8
620  *   unicast-ip4-chain
621  *   [@0]: dpo-load-balance: [index:14 buckets:1 uRPF:13 to:[0:0]]
622  *     [0] [@0]: dpo-drop ip6
623  * 255.255.255.255/32
624  *   unicast-ip4-chain
625  *   [@0]: dpo-load-balance: [index:16 buckets:1 uRPF:15 to:[0:0]]
626  *     [0] [@0]: dpo-drop ip6
627  * @cliexend
628  * Example of how to display a single IPv4 FIB table:
629  * @cliexstart{show ip fib table 7}
630  * ipv4-VRF:7, fib_index 1, flow hash: src dst sport dport proto
631  * 0.0.0.0/0
632  *   unicast-ip4-chain
633  *   [@0]: dpo-load-balance: [index:12 buckets:1 uRPF:11 to:[0:0]]
634  *     [0] [@0]: dpo-drop ip6
635  * 0.0.0.0/32
636  *   unicast-ip4-chain
637  *   [@0]: dpo-load-balance: [index:13 buckets:1 uRPF:12 to:[0:0]]
638  *     [0] [@0]: dpo-drop ip6
639  * 172.16.1.0/24
640  *   unicast-ip4-chain
641  *   [@0]: dpo-load-balance: [index:17 buckets:1 uRPF:16 to:[0:0]]
642  *     [0] [@4]: ipv4-glean: af_packet0
643  * 172.16.1.1/32
644  *   unicast-ip4-chain
645  *   [@0]: dpo-load-balance: [index:18 buckets:1 uRPF:17 to:[1:84]]
646  *     [0] [@2]: dpo-receive: 172.16.1.1 on af_packet0
647  * 172.16.1.2/32
648  *   unicast-ip4-chain
649  *   [@0]: dpo-load-balance: [index:21 buckets:1 uRPF:20 to:[0:0]]
650  *     [0] [@5]: ipv4 via 172.16.1.2 af_packet0: IP4: 02:fe:9e:70:7a:2b -> 26:a5:f6:9c:3a:36
651  * 172.16.2.0/24
652  *   unicast-ip4-chain
653  *   [@0]: dpo-load-balance: [index:19 buckets:1 uRPF:18 to:[0:0]]
654  *     [0] [@4]: ipv4-glean: af_packet1
655  * 172.16.2.1/32
656  *   unicast-ip4-chain
657  *   [@0]: dpo-load-balance: [index:20 buckets:1 uRPF:19 to:[0:0]]
658  *     [0] [@2]: dpo-receive: 172.16.2.1 on af_packet1
659  * 224.0.0.0/8
660  *   unicast-ip4-chain
661  *   [@0]: dpo-load-balance: [index:15 buckets:1 uRPF:14 to:[0:0]]
662  *     [0] [@0]: dpo-drop ip6
663  * 240.0.0.0/8
664  *   unicast-ip4-chain
665  *   [@0]: dpo-load-balance: [index:14 buckets:1 uRPF:13 to:[0:0]]
666  *     [0] [@0]: dpo-drop ip6
667  * 255.255.255.255/32
668  *   unicast-ip4-chain
669  *   [@0]: dpo-load-balance: [index:16 buckets:1 uRPF:15 to:[0:0]]
670  *     [0] [@0]: dpo-drop ip6
671  * @cliexend
672  * Example of how to display a summary of all IPv4 FIB tables:
673  * @cliexstart{show ip fib summary}
674  * ipv4-VRF:0, fib_index 0, flow hash: src dst sport dport proto
675  *     Prefix length         Count
676  *                    0               1
677  *                    8               2
678  *                   32               4
679  * ipv4-VRF:7, fib_index 1, flow hash: src dst sport dport proto
680  *     Prefix length         Count
681  *                    0               1
682  *                    8               2
683  *                   24               2
684  *                   32               4
685  * @cliexend
686  ?*/
687 /* *INDENT-OFF* */
688 VLIB_CLI_COMMAND (ip4_show_fib_command, static) = {
689     .path = "show ip fib",
690     .short_help = "show ip fib [summary] [table <table-id>] [index <fib-id>] [<ip4-addr>[/<mask>]] [mtrie]",
691     .function = ip4_show_fib,
692 };
693 /* *INDENT-ON* */