blob: e71b7db7e5f13ef82b0d138aab1e178c2f21c93b [file] [log] [blame]
Neale Ranns32e1c012016-11-22 17:07:28 +00001/*
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/mfib/ip4_mfib.h>
17
18#include <vnet/mfib/mfib_table.h>
19#include <vnet/mfib/mfib_entry.h>
20
Neale Ranns03c254e2020-03-17 14:25:10 +000021static const mfib_prefix_t all_zeros =
22{
23 .fp_proto = FIB_PROTOCOL_IP4,
24};
25static const mfib_prefix_t ip4_specials[] =
26{
27 /* ALL prefixes are in network order */
Neale Ranns32e1c012016-11-22 17:07:28 +000028 {
Neale Ranns03c254e2020-03-17 14:25:10 +000029 /* (*,224.0.0.1)/32 - all hosts */
Neale Ranns32e1c012016-11-22 17:07:28 +000030 .fp_grp_addr = {
Neale Ranns03c254e2020-03-17 14:25:10 +000031 .ip4.data_u32 = 0x010000e0,
Neale Ranns32e1c012016-11-22 17:07:28 +000032 },
Neale Ranns03c254e2020-03-17 14:25:10 +000033 .fp_len = 32,
34 .fp_proto = FIB_PROTOCOL_IP4,
35 },
36 {
37 /* (*,224.0.0.2)/32 - all routers */
38 .fp_grp_addr = {
39 .ip4.data_u32 = 0x020000e0,
40 },
41 .fp_len = 32,
Neale Ranns32e1c012016-11-22 17:07:28 +000042 .fp_proto = FIB_PROTOCOL_IP4,
43 },
44};
45
46static u32
Neale Ranns15002542017-09-10 04:39:11 -070047ip4_create_mfib_with_table_id (u32 table_id,
48 mfib_source_t src)
Neale Ranns32e1c012016-11-22 17:07:28 +000049{
50 mfib_table_t *mfib_table;
51
52 pool_get_aligned(ip4_main.mfibs, mfib_table, CLIB_CACHE_LINE_BYTES);
Dave Barachb7b92992018-10-17 10:38:51 -040053 clib_memset(mfib_table, 0, sizeof(*mfib_table));
Neale Ranns32e1c012016-11-22 17:07:28 +000054
55 mfib_table->mft_proto = FIB_PROTOCOL_IP4;
56 mfib_table->mft_index =
57 mfib_table->v4.index =
58 (mfib_table - ip4_main.mfibs);
59
60 hash_set (ip4_main.mfib_index_by_table_id,
61 table_id,
62 mfib_table->mft_index);
63
64 mfib_table->mft_table_id =
65 mfib_table->v4.table_id =
66 table_id;
67
Neale Ranns15002542017-09-10 04:39:11 -070068 mfib_table_lock(mfib_table->mft_index, FIB_PROTOCOL_IP4, src);
Neale Ranns32e1c012016-11-22 17:07:28 +000069
70 /*
Neale Ranns03c254e2020-03-17 14:25:10 +000071 * add the default route into the new FIB
Neale Ranns32e1c012016-11-22 17:07:28 +000072 */
Neale Ranns03c254e2020-03-17 14:25:10 +000073 mfib_table_entry_update(mfib_table->mft_index,
74 &all_zeros,
75 MFIB_SOURCE_DEFAULT_ROUTE,
76 MFIB_RPF_ID_NONE,
77 MFIB_ENTRY_FLAG_DROP);
78
79 const fib_route_path_t path = {
80 .frp_proto = DPO_PROTO_IP4,
81 .frp_addr = zero_addr,
82 .frp_sw_if_index = ~0,
83 .frp_fib_index = ~0,
84 .frp_weight = 1,
85 .frp_flags = FIB_ROUTE_PATH_LOCAL,
86 .frp_mitf_flags = MFIB_ITF_FLAG_FORWARD,
87 };
Neale Ranns32e1c012016-11-22 17:07:28 +000088 int ii;
89
90 for (ii = 0; ii < ARRAY_LEN(ip4_specials); ii++)
91 {
Neale Ranns03c254e2020-03-17 14:25:10 +000092 mfib_table_entry_path_update(mfib_table->mft_index,
93 &ip4_specials[ii],
94 MFIB_SOURCE_SPECIAL,
Paul Atkins8e2b1b12021-10-12 14:32:11 +010095 MFIB_ENTRY_FLAG_NONE,
Neale Ranns03c254e2020-03-17 14:25:10 +000096 &path);
Neale Ranns32e1c012016-11-22 17:07:28 +000097 }
98
99 return (mfib_table->mft_index);
100}
101
102void
103ip4_mfib_table_destroy (ip4_mfib_t *mfib)
104{
105 mfib_table_t *mfib_table = (mfib_table_t*)mfib;
106 int ii;
107
108 /*
109 * remove all the specials we added when the table was created.
110 */
Neale Ranns03c254e2020-03-17 14:25:10 +0000111 mfib_table_entry_delete(mfib_table->mft_index,
112 &all_zeros,
113 MFIB_SOURCE_DEFAULT_ROUTE);
114
Neale Ranns32e1c012016-11-22 17:07:28 +0000115 for (ii = 0; ii < ARRAY_LEN(ip4_specials); ii++)
116 {
Neale Ranns03c254e2020-03-17 14:25:10 +0000117 mfib_table_entry_delete(mfib_table->mft_index,
118 &ip4_specials[ii],
119 MFIB_SOURCE_SPECIAL);
Neale Ranns32e1c012016-11-22 17:07:28 +0000120 }
121
122 /*
123 * validate no more routes.
124 */
125 ASSERT(0 == mfib_table->mft_total_route_counts);
126 ASSERT(~0 != mfib_table->mft_table_id);
127
128 hash_unset (ip4_main.mfib_index_by_table_id, mfib_table->mft_table_id);
129 pool_put(ip4_main.mfibs, mfib_table);
130}
131
Neale Ranns03c254e2020-03-17 14:25:10 +0000132void
133ip4_mfib_interface_enable_disable (u32 sw_if_index, int is_enable)
134{
135 const fib_route_path_t path = {
136 .frp_proto = DPO_PROTO_IP4,
137 .frp_addr = zero_addr,
138 .frp_sw_if_index = sw_if_index,
139 .frp_fib_index = ~0,
140 .frp_weight = 1,
141 .frp_mitf_flags = MFIB_ITF_FLAG_ACCEPT,
142 };
143 u32 mfib_index;
144 int ii;
145
Neale Ranns03c254e2020-03-17 14:25:10 +0000146 mfib_index = ip4_mfib_table_get_index_for_sw_if_index(sw_if_index);
147
148 for (ii = 0; ii < ARRAY_LEN(ip4_specials); ii++)
149 {
150 if (is_enable)
151 {
152 mfib_table_entry_path_update(mfib_index,
153 &ip4_specials[ii],
154 MFIB_SOURCE_SPECIAL,
Paul Atkins8e2b1b12021-10-12 14:32:11 +0100155 MFIB_ENTRY_FLAG_NONE,
Neale Ranns03c254e2020-03-17 14:25:10 +0000156 &path);
157 }
158 else
159 {
160 mfib_table_entry_path_remove(mfib_index,
161 &ip4_specials[ii],
162 MFIB_SOURCE_SPECIAL,
163 &path);
164 }
165 }
166}
167
Neale Ranns32e1c012016-11-22 17:07:28 +0000168u32
Neale Ranns15002542017-09-10 04:39:11 -0700169ip4_mfib_table_find_or_create_and_lock (u32 table_id,
170 mfib_source_t src)
Neale Ranns32e1c012016-11-22 17:07:28 +0000171{
172 u32 index;
173
174 index = ip4_mfib_index_from_table_id(table_id);
175 if (~0 == index)
Neale Ranns15002542017-09-10 04:39:11 -0700176 return ip4_create_mfib_with_table_id(table_id, src);
177 mfib_table_lock(index, FIB_PROTOCOL_IP4, src);
Neale Ranns32e1c012016-11-22 17:07:28 +0000178
179 return (index);
180}
181
182u32
183ip4_mfib_table_get_index_for_sw_if_index (u32 sw_if_index)
184{
185 if (sw_if_index >= vec_len(ip4_main.mfib_index_by_sw_if_index))
186 {
187 /*
188 * This is the case for interfaces that are not yet mapped to
189 * a IP table
190 */
191 return (~0);
192 }
193 return (ip4_main.mfib_index_by_sw_if_index[sw_if_index]);
194}
195
196#define IPV4_MFIB_GRP_LEN(_len)\
197 (_len > 32 ? 32 : _len)
198
199#define IP4_MFIB_MK_KEY(_grp, _src, _len, _key) \
200{ \
201 _key = ((u64)(_grp->data_u32 & \
202 ip4_main.fib_masks[IPV4_MFIB_GRP_LEN(_len)])) << 32; \
203 _key |= _src->data_u32; \
204}
205#define IP4_MFIB_MK_GRP_KEY(_grp, _len, _key) \
206{ \
207 _key = ((u64)(_grp->data_u32 & \
208 ip4_main.fib_masks[IPV4_MFIB_GRP_LEN(_len)])) << 32; \
209}
210
211/*
212 * ip4_fib_table_lookup_exact_match
213 *
214 * Exact match prefix lookup
215 */
216fib_node_index_t
217ip4_mfib_table_lookup_exact_match (const ip4_mfib_t *mfib,
218 const ip4_address_t *grp,
219 const ip4_address_t *src,
220 u32 len)
221{
222 uword * hash, * result;
223 u64 key;
224
225 hash = mfib->fib_entry_by_dst_address[len];
226 IP4_MFIB_MK_KEY(grp, src, len, key);
227
228 result = hash_get(hash, key);
229
230 if (NULL != result) {
231 return (result[0]);
232 }
233 return (FIB_NODE_INDEX_INVALID);
234}
235
236/*
237 * ip4_fib_table_lookup
238 *
239 * Longest prefix match
240 */
241fib_node_index_t
242ip4_mfib_table_lookup (const ip4_mfib_t *mfib,
243 const ip4_address_t *src,
244 const ip4_address_t *grp,
245 u32 len)
246{
247 uword * hash, * result;
248 i32 mask_len;
249 u64 key;
250
251 mask_len = len;
252
253 if (PREDICT_TRUE(64 == mask_len))
254 {
255 hash = mfib->fib_entry_by_dst_address[mask_len];
256 IP4_MFIB_MK_KEY(grp, src, mask_len, key);
257
258 result = hash_get (hash, key);
259
260 if (NULL != result) {
261 return (result[0]);
262 }
263 }
264
Neale Rannsae809832018-11-23 09:00:27 -0800265 for (mask_len = (len == 64 ? 32 : len); mask_len >= 0; mask_len--)
Neale Ranns32e1c012016-11-22 17:07:28 +0000266 {
267 hash = mfib->fib_entry_by_dst_address[mask_len];
268 IP4_MFIB_MK_GRP_KEY(grp, mask_len, key);
269
270 result = hash_get (hash, key);
271
272 if (NULL != result) {
273 return (result[0]);
274 }
275 }
276 return (FIB_NODE_INDEX_INVALID);
277}
278
Neale Ranns9e829a82018-12-17 05:50:32 -0800279fib_node_index_t
280ip4_mfib_table_get_less_specific (const ip4_mfib_t *mfib,
281 const ip4_address_t *src,
282 const ip4_address_t *grp,
283 u32 len)
284{
285 u32 mask_len;
286
287 /*
288 * in the absence of a tree structure for the table that allows for an O(1)
289 * parent get, a cheeky way to find the cover is to LPM for the prefix with
290 * mask-1.
291 * there should always be a cover, though it may be the default route. the
292 * default route's cover is the default route.
293 */
294 if (len == 64)
295 {
296 /* go from (S,G) to (*,G*) */
297 mask_len = 32;
298 }
299 else if (len != 0)
300 {
301 mask_len = len - 1;
302 }
303 else
304 {
305 mask_len = len;
306 }
307
308 return (ip4_mfib_table_lookup(mfib, src, grp, mask_len));
309}
310
Neale Ranns32e1c012016-11-22 17:07:28 +0000311void
312ip4_mfib_table_entry_insert (ip4_mfib_t *mfib,
313 const ip4_address_t *grp,
314 const ip4_address_t *src,
315 u32 len,
316 fib_node_index_t fib_entry_index)
317{
318 uword * hash, * result;
319 u64 key;
320
321 IP4_MFIB_MK_KEY(grp, src, len, key);
322 hash = mfib->fib_entry_by_dst_address[len];
323 result = hash_get (hash, key);
324
325 if (NULL == result) {
326 /*
327 * adding a new entry
328 */
329 if (NULL == hash) {
330 hash = hash_create (32 /* elts */, sizeof (uword));
331 hash_set_flags (hash, HASH_FLAG_NO_AUTO_SHRINK);
332 }
333 hash = hash_set(hash, key, fib_entry_index);
334 mfib->fib_entry_by_dst_address[len] = hash;
335 }
336 else
337 {
338 ASSERT(0);
339 }
340}
341
342void
343ip4_mfib_table_entry_remove (ip4_mfib_t *mfib,
344 const ip4_address_t *grp,
345 const ip4_address_t *src,
346 u32 len)
347{
348 uword * hash, * result;
349 u64 key;
350
351 IP4_MFIB_MK_KEY(grp, src, len, key);
352 hash = mfib->fib_entry_by_dst_address[len];
353 result = hash_get (hash, key);
354
355 if (NULL == result)
356 {
357 /*
Jim Thompsonf324dec2019-04-08 03:22:21 -0500358 * removing a non-existent entry. i'll allow it.
Neale Ranns32e1c012016-11-22 17:07:28 +0000359 */
360 }
361 else
362 {
363 hash_unset(hash, key);
364 }
365
366 mfib->fib_entry_by_dst_address[len] = hash;
367}
368
Neale Ranns5a8123b2017-01-26 01:18:23 -0800369void
370ip4_mfib_table_walk (ip4_mfib_t *mfib,
371 mfib_table_walk_fn_t fn,
372 void *ctx)
373{
374 int i;
375
376 for (i = 0; i < ARRAY_LEN (mfib->fib_entry_by_dst_address); i++)
377 {
378 uword * hash = mfib->fib_entry_by_dst_address[i];
379
380 if (NULL != hash)
381 {
382 hash_pair_t * p;
383
384 hash_foreach_pair (p, hash,
385 ({
386 fn(p->value[0], ctx);
387 }));
388 }
389 }
390}
391
Neale Rannsc87aafa2017-11-29 00:59:31 -0800392u8 *
393format_ip4_mfib_table_memory (u8 * s, va_list * args)
394{
395 mfib_table_t *mfib_table;
396 u64 total_memory;
397
398 total_memory = 0;
399
Damjan Marionb2c31b62020-12-13 21:47:40 +0100400 pool_foreach (mfib_table, ip4_main.mfibs)
401 {
Neale Rannsc87aafa2017-11-29 00:59:31 -0800402 ip4_mfib_t *mfib = &mfib_table->v4;
403 uword mfib_size;
404 int i;
405
406 mfib_size = 0;
407
408 for (i = 0; i < ARRAY_LEN (mfib->fib_entry_by_dst_address); i++)
409 {
410 uword * hash = mfib->fib_entry_by_dst_address[i];
411
412 if (NULL != hash)
413 {
414 mfib_size += hash_bytes(hash);
415 }
416 }
417
418 total_memory += mfib_size;
Damjan Marionb2c31b62020-12-13 21:47:40 +0100419 }
Neale Rannsc87aafa2017-11-29 00:59:31 -0800420
Neale Ranns05cac302019-05-28 11:09:40 +0000421 s = format(s, "%=30s %=6d %=12ld\n",
Neale Rannsc87aafa2017-11-29 00:59:31 -0800422 "IPv4 multicast",
423 pool_elts(ip4_main.mfibs), total_memory);
424
425 return (s);
426}
427
Neale Ranns32e1c012016-11-22 17:07:28 +0000428static void
429ip4_mfib_table_show_all (ip4_mfib_t *mfib,
430 vlib_main_t * vm)
431{
432 fib_node_index_t *mfib_entry_indicies;
433 fib_node_index_t *mfib_entry_index;
434 int i;
435
436 mfib_entry_indicies = NULL;
437
438 for (i = 0; i < ARRAY_LEN (mfib->fib_entry_by_dst_address); i++)
439 {
440 uword * hash = mfib->fib_entry_by_dst_address[i];
441
442 if (NULL != hash)
443 {
444 hash_pair_t * p;
445
446 hash_foreach_pair (p, hash,
447 ({
448 vec_add1(mfib_entry_indicies, p->value[0]);
449 }));
450 }
451 }
452
453 vec_sort_with_function(mfib_entry_indicies, mfib_entry_cmp_for_sort);
454
455 vec_foreach(mfib_entry_index, mfib_entry_indicies)
456 {
457 vlib_cli_output(vm, "%U",
458 format_mfib_entry,
459 *mfib_entry_index,
460 MFIB_ENTRY_FORMAT_BRIEF);
461 }
462
463 vec_free(mfib_entry_indicies);
464}
465
466static void
467ip4_mfib_table_show_one (ip4_mfib_t *mfib,
468 vlib_main_t * vm,
469 ip4_address_t *src,
470 ip4_address_t *grp,
471 u32 mask_len)
472{
473 vlib_cli_output(vm, "%U",
474 format_mfib_entry,
475 ip4_mfib_table_lookup(mfib, src, grp, mask_len),
476 MFIB_ENTRY_FORMAT_DETAIL);
477}
478
479static clib_error_t *
480ip4_show_mfib (vlib_main_t * vm,
481 unformat_input_t * input,
482 vlib_cli_command_t * cmd)
483{
484 ip4_main_t * im4 = &ip4_main;
485 mfib_table_t *mfib_table;
Neale Rannsc87aafa2017-11-29 00:59:31 -0800486 int verbose, matching, memory;
Neale Ranns32e1c012016-11-22 17:07:28 +0000487 ip4_address_t grp, src = {{0}};
488 u32 mask = 32;
Neale Rannsc87aafa2017-11-29 00:59:31 -0800489 u64 total_hash_memory;
Neale Ranns32e1c012016-11-22 17:07:28 +0000490 int i, table_id = -1, fib_index = ~0;
491
492 verbose = 1;
Neale Rannsc87aafa2017-11-29 00:59:31 -0800493 memory = matching = 0;
494 total_hash_memory = 0;
Neale Ranns32e1c012016-11-22 17:07:28 +0000495
496 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
497 {
498 if (unformat (input, "brief") || unformat (input, "summary")
499 || unformat (input, "sum"))
500 verbose = 0;
Neale Rannsc87aafa2017-11-29 00:59:31 -0800501 else if (unformat (input, "mem") || unformat (input, "memory"))
502 memory = 1;
Neale Ranns32e1c012016-11-22 17:07:28 +0000503 else if (unformat (input, "%U %U",
504 unformat_ip4_address, &src,
505 unformat_ip4_address, &grp))
506 {
507 matching = 1;
508 mask = 64;
509 }
Neale Rannsc7409dc2017-05-19 02:54:32 -0700510 else if (unformat (input, "%U/%d", unformat_ip4_address, &grp, &mask))
511 {
Dave Barachb7b92992018-10-17 10:38:51 -0400512 clib_memset(&src, 0, sizeof(src));
Neale Rannsc7409dc2017-05-19 02:54:32 -0700513 matching = 1;
514 }
Neale Ranns32e1c012016-11-22 17:07:28 +0000515 else if (unformat (input, "%U", unformat_ip4_address, &grp))
516 {
Dave Barachb7b92992018-10-17 10:38:51 -0400517 clib_memset(&src, 0, sizeof(src));
Neale Ranns32e1c012016-11-22 17:07:28 +0000518 matching = 1;
519 mask = 32;
520 }
Neale Ranns32e1c012016-11-22 17:07:28 +0000521 else if (unformat (input, "table %d", &table_id))
522 ;
523 else if (unformat (input, "index %d", &fib_index))
524 ;
525 else
526 break;
527 }
528
Damjan Marionb2c31b62020-12-13 21:47:40 +0100529 pool_foreach (mfib_table, im4->mfibs)
530 {
Neale Ranns32e1c012016-11-22 17:07:28 +0000531 ip4_mfib_t *mfib = &mfib_table->v4;
532
533 if (table_id >= 0 && table_id != (int)mfib->table_id)
534 continue;
535 if (fib_index != ~0 && fib_index != (int)mfib->index)
536 continue;
537
Neale Rannsc87aafa2017-11-29 00:59:31 -0800538 if (memory)
539 {
540 uword hash_size;
541
542 hash_size = 0;
543
544 for (i = 0; i < ARRAY_LEN (mfib->fib_entry_by_dst_address); i++)
545 {
546 uword * hash = mfib->fib_entry_by_dst_address[i];
547 if (NULL != hash)
548 {
549 hash_size += hash_bytes(hash);
550 }
551 }
552 if (verbose)
553 vlib_cli_output (vm, "%U hash:%d",
554 format_mfib_table_name, mfib->index,
555 FIB_PROTOCOL_IP4,
556 hash_size);
557 total_hash_memory += hash_size;
558 continue;
559 }
560
Neale Ranns9db6ada2019-11-08 12:42:31 +0000561 vlib_cli_output (vm, "%U, fib_index:%d flags:%U",
Neale Ranns32e1c012016-11-22 17:07:28 +0000562 format_mfib_table_name, mfib->index, FIB_PROTOCOL_IP4,
Neale Ranns9db6ada2019-11-08 12:42:31 +0000563 mfib->index,
564 format_mfib_table_flags, mfib_table->mft_flags);
Neale Ranns32e1c012016-11-22 17:07:28 +0000565
566 /* Show summary? */
567 if (! verbose)
568 {
569 vlib_cli_output (vm, "%=20s%=16s", "Prefix length", "Count");
570 for (i = 0; i < ARRAY_LEN (mfib->fib_entry_by_dst_address); i++)
571 {
572 uword * hash = mfib->fib_entry_by_dst_address[i];
573 uword n_elts = hash_elts (hash);
574 if (n_elts > 0)
575 vlib_cli_output (vm, "%20d%16d", i, n_elts);
576 }
577 continue;
578 }
579
580 if (!matching)
581 {
582 ip4_mfib_table_show_all(mfib, vm);
583 }
584 else
585 {
586 ip4_mfib_table_show_one(mfib, vm, &src, &grp, mask);
587 }
Damjan Marionb2c31b62020-12-13 21:47:40 +0100588 }
Neale Rannsc87aafa2017-11-29 00:59:31 -0800589 if (memory)
590 vlib_cli_output (vm, "totals: hash:%ld", total_hash_memory);
Neale Ranns32e1c012016-11-22 17:07:28 +0000591
592 return 0;
593}
594
Nathan Skrzypczakda331052021-09-29 15:28:26 +0200595/* clang-format off */
Neale Ranns32e1c012016-11-22 17:07:28 +0000596/*?
597 * This command displays the IPv4 MulticasrFIB Tables (VRF Tables) and
598 * the route entries for each table.
599 *
600 * @note This command will run for a long time when the FIB tables are
Nathan Skrzypczakda331052021-09-29 15:28:26 +0200601 * comprised of millions of entries. For those scenarios, consider displaying
Neale Ranns32e1c012016-11-22 17:07:28 +0000602 * a single table or summary mode.
603 *
604 * @cliexpar
605 * Example of how to display all the IPv4 Multicast FIB tables:
606 * @cliexstart{show ip fib}
607 * ipv4-VRF:0, fib_index 0
608 * (*, 0.0.0.0/0): flags:D,
609 * Interfaces:
610 * multicast-ip4-chain
611 * [@1]: dpo-drop ip4
612 * (*, 232.1.1.1/32):
613 * Interfaces:
614 * test-eth1: Forward,
615 * test-eth2: Forward,
616 * test-eth0: Accept,
617 * multicast-ip4-chain
618 * [@2]: dpo-replicate: [index:1 buckets:2 to:[0:0]]
619 * [0] [@1]: ipv4-mcast: test-eth1: IP4: d0:d1:d2:d3:d4:01 -> 01:00:05:00:00:00
620 * [1] [@1]: ipv4-mcast: test-eth2: IP4: d0:d1:d2:d3:d4:02 -> 01:00:05:00:00:00
621 *
622 * @cliexend
623 * Example of how to display a summary of all IPv4 FIB tables:
624 * @cliexstart{show ip fib summary}
625 * ipv4-VRF:0, fib_index 0, flow hash: src dst sport dport proto
626 * Prefix length Count
627 * 0 1
628 * 8 2
629 * 32 4
630 * ipv4-VRF:7, fib_index 1, flow hash: src dst sport dport proto
631 * Prefix length Count
632 * 0 1
633 * 8 2
634 * 24 2
635 * 32 4
636 * @cliexend
637 ?*/
Nathan Skrzypczakda331052021-09-29 15:28:26 +0200638/* clang-format on */
Neale Rannsc756c1c2017-02-08 09:11:57 -0800639VLIB_CLI_COMMAND (ip4_show_mfib_command, static) = {
Neale Ranns32e1c012016-11-22 17:07:28 +0000640 .path = "show ip mfib",
Neale Rannsc756c1c2017-02-08 09:11:57 -0800641 .short_help = "show ip mfib [summary] [table <table-id>] [index <fib-id>] [<grp-addr>[/<mask>]] [<grp-addr>] [<src-addr> <grp-addr>]",
Neale Ranns32e1c012016-11-22 17:07:28 +0000642 .function = ip4_show_mfib,
643};