Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 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 | /* |
Neale Ranns | 86fb04d | 2016-12-01 17:03:25 +0000 | [diff] [blame] | 56 | * 240.0.0.0/4 |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 57 | * drop class E |
| 58 | */ |
| 59 | .ift_prefix = { |
| 60 | .fp_addr = { |
| 61 | .ip4.data_u32 = 0xf0000000, |
| 62 | }, |
Neale Ranns | 86fb04d | 2016-12-01 17:03:25 +0000 | [diff] [blame] | 63 | .fp_len = 4, |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 64 | .fp_proto = FIB_PROTOCOL_IP4, |
| 65 | }, |
| 66 | .ift_source = FIB_SOURCE_SPECIAL, |
| 67 | .ift_flag = FIB_ENTRY_FLAG_DROP, |
| 68 | |
| 69 | }, |
| 70 | { |
| 71 | /* |
Neale Ranns | 86fb04d | 2016-12-01 17:03:25 +0000 | [diff] [blame] | 72 | * 224.0.0.0/4 |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 73 | * drop all mcast |
| 74 | */ |
| 75 | .ift_prefix = { |
| 76 | .fp_addr = { |
| 77 | .ip4.data_u32 = 0xe0000000, |
| 78 | }, |
Neale Ranns | 86fb04d | 2016-12-01 17:03:25 +0000 | [diff] [blame] | 79 | .fp_len = 4, |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 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 |
Neale Ranns | 1500254 | 2017-09-10 04:39:11 -0700 | [diff] [blame] | 104 | ip4_create_fib_with_table_id (u32 table_id, |
| 105 | fib_source_t src) |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 106 | { |
| 107 | fib_table_t *fib_table; |
Neale Ranns | a3af337 | 2017-03-28 03:49:52 -0700 | [diff] [blame] | 108 | ip4_fib_t *v4_fib; |
Neale Ranns | 1ec3652 | 2017-11-29 05:20:37 -0800 | [diff] [blame] | 109 | void *old_heap; |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 110 | |
| 111 | pool_get_aligned(ip4_main.fibs, fib_table, CLIB_CACHE_LINE_BYTES); |
| 112 | memset(fib_table, 0, sizeof(*fib_table)); |
| 113 | |
Neale Ranns | 1ec3652 | 2017-11-29 05:20:37 -0800 | [diff] [blame] | 114 | old_heap = clib_mem_set_heap (ip4_main.mtrie_mheap); |
Neale Ranns | a3af337 | 2017-03-28 03:49:52 -0700 | [diff] [blame] | 115 | pool_get_aligned(ip4_main.v4_fibs, v4_fib, CLIB_CACHE_LINE_BYTES); |
Neale Ranns | 1ec3652 | 2017-11-29 05:20:37 -0800 | [diff] [blame] | 116 | clib_mem_set_heap (old_heap); |
Neale Ranns | a3af337 | 2017-03-28 03:49:52 -0700 | [diff] [blame] | 117 | |
| 118 | ASSERT((fib_table - ip4_main.fibs) == |
| 119 | (v4_fib - ip4_main.v4_fibs)); |
| 120 | |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 121 | fib_table->ft_proto = FIB_PROTOCOL_IP4; |
| 122 | fib_table->ft_index = |
Neale Ranns | a3af337 | 2017-03-28 03:49:52 -0700 | [diff] [blame] | 123 | v4_fib->index = |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 124 | (fib_table - ip4_main.fibs); |
| 125 | |
| 126 | hash_set (ip4_main.fib_index_by_table_id, table_id, fib_table->ft_index); |
| 127 | |
| 128 | fib_table->ft_table_id = |
Neale Ranns | a3af337 | 2017-03-28 03:49:52 -0700 | [diff] [blame] | 129 | v4_fib->table_id = |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 130 | table_id; |
Neale Ranns | 227038a | 2017-04-21 01:07:59 -0700 | [diff] [blame] | 131 | fib_table->ft_flow_hash_config = IP_FLOW_HASH_DEFAULT; |
Neale Ranns | a3af337 | 2017-03-28 03:49:52 -0700 | [diff] [blame] | 132 | v4_fib->fwd_classify_table_index = ~0; |
| 133 | v4_fib->rev_classify_table_index = ~0; |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 134 | |
Neale Ranns | 1500254 | 2017-09-10 04:39:11 -0700 | [diff] [blame] | 135 | fib_table_lock(fib_table->ft_index, FIB_PROTOCOL_IP4, src); |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 136 | |
Neale Ranns | a3af337 | 2017-03-28 03:49:52 -0700 | [diff] [blame] | 137 | ip4_mtrie_init(&v4_fib->mtrie); |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 138 | |
| 139 | /* |
| 140 | * add the special entries into the new FIB |
| 141 | */ |
| 142 | int ii; |
| 143 | |
| 144 | for (ii = 0; ii < ARRAY_LEN(ip4_specials); ii++) |
| 145 | { |
| 146 | fib_prefix_t prefix = ip4_specials[ii].ift_prefix; |
| 147 | |
| 148 | prefix.fp_addr.ip4.data_u32 = |
| 149 | clib_host_to_net_u32(prefix.fp_addr.ip4.data_u32); |
| 150 | |
| 151 | fib_table_entry_special_add(fib_table->ft_index, |
| 152 | &prefix, |
| 153 | ip4_specials[ii].ift_source, |
Neale Ranns | a055830 | 2017-04-13 00:44:52 -0700 | [diff] [blame] | 154 | ip4_specials[ii].ift_flag); |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 155 | } |
| 156 | |
| 157 | return (fib_table->ft_index); |
| 158 | } |
| 159 | |
| 160 | void |
Neale Ranns | a3af337 | 2017-03-28 03:49:52 -0700 | [diff] [blame] | 161 | ip4_fib_table_destroy (u32 fib_index) |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 162 | { |
Neale Ranns | a3af337 | 2017-03-28 03:49:52 -0700 | [diff] [blame] | 163 | fib_table_t *fib_table = pool_elt_at_index(ip4_main.fibs, fib_index); |
| 164 | ip4_fib_t *v4_fib = pool_elt_at_index(ip4_main.v4_fibs, fib_index); |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 165 | int ii; |
| 166 | |
| 167 | /* |
| 168 | * remove all the specials we added when the table was created. |
Neale Ranns | 04a75e3 | 2017-03-23 06:46:01 -0700 | [diff] [blame] | 169 | * In reverse order so the default route is last. |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 170 | */ |
Neale Ranns | 04a75e3 | 2017-03-23 06:46:01 -0700 | [diff] [blame] | 171 | for (ii = ARRAY_LEN(ip4_specials) - 1; ii >= 0; ii--) |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 172 | { |
| 173 | fib_prefix_t prefix = ip4_specials[ii].ift_prefix; |
| 174 | |
| 175 | prefix.fp_addr.ip4.data_u32 = |
| 176 | clib_host_to_net_u32(prefix.fp_addr.ip4.data_u32); |
| 177 | |
| 178 | fib_table_entry_special_remove(fib_table->ft_index, |
| 179 | &prefix, |
| 180 | ip4_specials[ii].ift_source); |
| 181 | } |
| 182 | |
| 183 | /* |
| 184 | * validate no more routes. |
| 185 | */ |
| 186 | ASSERT(0 == fib_table->ft_total_route_counts); |
| 187 | FOR_EACH_FIB_SOURCE(ii) |
| 188 | { |
| 189 | ASSERT(0 == fib_table->ft_src_route_counts[ii]); |
| 190 | } |
| 191 | |
| 192 | if (~0 != fib_table->ft_table_id) |
| 193 | { |
| 194 | hash_unset (ip4_main.fib_index_by_table_id, fib_table->ft_table_id); |
| 195 | } |
Neale Ranns | a3af337 | 2017-03-28 03:49:52 -0700 | [diff] [blame] | 196 | |
| 197 | ip4_mtrie_free(&v4_fib->mtrie); |
| 198 | |
| 199 | pool_put(ip4_main.v4_fibs, v4_fib); |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 200 | pool_put(ip4_main.fibs, fib_table); |
| 201 | } |
| 202 | |
| 203 | |
| 204 | u32 |
Neale Ranns | 1500254 | 2017-09-10 04:39:11 -0700 | [diff] [blame] | 205 | ip4_fib_table_find_or_create_and_lock (u32 table_id, |
| 206 | fib_source_t src) |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 207 | { |
| 208 | u32 index; |
| 209 | |
| 210 | index = ip4_fib_index_from_table_id(table_id); |
| 211 | if (~0 == index) |
Neale Ranns | 1500254 | 2017-09-10 04:39:11 -0700 | [diff] [blame] | 212 | return ip4_create_fib_with_table_id(table_id, src); |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 213 | |
Neale Ranns | 1500254 | 2017-09-10 04:39:11 -0700 | [diff] [blame] | 214 | fib_table_lock(index, FIB_PROTOCOL_IP4, src); |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 215 | |
| 216 | return (index); |
| 217 | } |
| 218 | |
| 219 | u32 |
Neale Ranns | 1500254 | 2017-09-10 04:39:11 -0700 | [diff] [blame] | 220 | ip4_fib_table_create_and_lock (fib_source_t src) |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 221 | { |
Neale Ranns | 1500254 | 2017-09-10 04:39:11 -0700 | [diff] [blame] | 222 | return (ip4_create_fib_with_table_id(~0, src)); |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 223 | } |
| 224 | |
| 225 | u32 |
| 226 | ip4_fib_table_get_index_for_sw_if_index (u32 sw_if_index) |
| 227 | { |
| 228 | if (sw_if_index >= vec_len(ip4_main.fib_index_by_sw_if_index)) |
| 229 | { |
| 230 | /* |
| 231 | * This is the case for interfaces that are not yet mapped to |
| 232 | * a IP table |
| 233 | */ |
| 234 | return (~0); |
| 235 | } |
| 236 | return (ip4_main.fib_index_by_sw_if_index[sw_if_index]); |
| 237 | } |
| 238 | |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 239 | /* |
| 240 | * ip4_fib_table_lookup_exact_match |
| 241 | * |
| 242 | * Exact match prefix lookup |
| 243 | */ |
| 244 | fib_node_index_t |
| 245 | ip4_fib_table_lookup_exact_match (const ip4_fib_t *fib, |
| 246 | const ip4_address_t *addr, |
| 247 | u32 len) |
| 248 | { |
| 249 | uword * hash, * result; |
| 250 | u32 key; |
| 251 | |
| 252 | hash = fib->fib_entry_by_dst_address[len]; |
| 253 | key = (addr->data_u32 & ip4_main.fib_masks[len]); |
| 254 | |
| 255 | result = hash_get(hash, key); |
| 256 | |
| 257 | if (NULL != result) { |
| 258 | return (result[0]); |
| 259 | } |
| 260 | return (FIB_NODE_INDEX_INVALID); |
| 261 | } |
| 262 | |
| 263 | /* |
| 264 | * ip4_fib_table_lookup_adj |
| 265 | * |
| 266 | * Longest prefix match |
| 267 | */ |
| 268 | index_t |
| 269 | ip4_fib_table_lookup_lb (ip4_fib_t *fib, |
| 270 | const ip4_address_t *addr) |
| 271 | { |
| 272 | fib_node_index_t fei; |
| 273 | |
| 274 | fei = ip4_fib_table_lookup(fib, addr, 32); |
| 275 | |
| 276 | if (FIB_NODE_INDEX_INVALID != fei) |
| 277 | { |
| 278 | const dpo_id_t *dpo; |
| 279 | |
| 280 | dpo = fib_entry_contribute_ip_forwarding(fei); |
| 281 | |
| 282 | return (dpo->dpoi_index); |
| 283 | } |
| 284 | return (INDEX_INVALID); |
| 285 | } |
| 286 | |
| 287 | /* |
| 288 | * ip4_fib_table_lookup |
| 289 | * |
| 290 | * Longest prefix match |
| 291 | */ |
| 292 | fib_node_index_t |
| 293 | ip4_fib_table_lookup (const ip4_fib_t *fib, |
| 294 | const ip4_address_t *addr, |
| 295 | u32 len) |
| 296 | { |
| 297 | uword * hash, * result; |
| 298 | i32 mask_len; |
| 299 | u32 key; |
| 300 | |
| 301 | for (mask_len = len; mask_len >= 0; mask_len--) |
| 302 | { |
| 303 | hash = fib->fib_entry_by_dst_address[mask_len]; |
| 304 | key = (addr->data_u32 & ip4_main.fib_masks[mask_len]); |
| 305 | |
| 306 | result = hash_get (hash, key); |
| 307 | |
| 308 | if (NULL != result) { |
| 309 | return (result[0]); |
| 310 | } |
| 311 | } |
| 312 | return (FIB_NODE_INDEX_INVALID); |
| 313 | } |
| 314 | |
| 315 | void |
| 316 | ip4_fib_table_entry_insert (ip4_fib_t *fib, |
| 317 | const ip4_address_t *addr, |
| 318 | u32 len, |
| 319 | fib_node_index_t fib_entry_index) |
| 320 | { |
| 321 | uword * hash, * result; |
| 322 | u32 key; |
| 323 | |
| 324 | key = (addr->data_u32 & ip4_main.fib_masks[len]); |
| 325 | hash = fib->fib_entry_by_dst_address[len]; |
| 326 | result = hash_get (hash, key); |
| 327 | |
| 328 | if (NULL == result) { |
| 329 | /* |
| 330 | * adding a new entry |
| 331 | */ |
Neale Ranns | 1ec3652 | 2017-11-29 05:20:37 -0800 | [diff] [blame] | 332 | uword *old_heap; |
| 333 | old_heap = clib_mem_set_heap (ip4_main.mtrie_mheap); |
| 334 | |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 335 | if (NULL == hash) { |
| 336 | hash = hash_create (32 /* elts */, sizeof (uword)); |
| 337 | hash_set_flags (hash, HASH_FLAG_NO_AUTO_SHRINK); |
Neale Ranns | 1ec3652 | 2017-11-29 05:20:37 -0800 | [diff] [blame] | 338 | |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 339 | } |
| 340 | hash = hash_set(hash, key, fib_entry_index); |
| 341 | fib->fib_entry_by_dst_address[len] = hash; |
Neale Ranns | 1ec3652 | 2017-11-29 05:20:37 -0800 | [diff] [blame] | 342 | clib_mem_set_heap (old_heap); |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 343 | } |
| 344 | else |
| 345 | { |
| 346 | ASSERT(0); |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | void |
| 351 | ip4_fib_table_entry_remove (ip4_fib_t *fib, |
| 352 | const ip4_address_t *addr, |
| 353 | u32 len) |
| 354 | { |
| 355 | uword * hash, * result; |
| 356 | u32 key; |
| 357 | |
| 358 | key = (addr->data_u32 & ip4_main.fib_masks[len]); |
| 359 | hash = fib->fib_entry_by_dst_address[len]; |
| 360 | result = hash_get (hash, key); |
| 361 | |
| 362 | if (NULL == result) |
| 363 | { |
| 364 | /* |
| 365 | * removing a non-existant entry. i'll allow it. |
| 366 | */ |
| 367 | } |
| 368 | else |
| 369 | { |
Neale Ranns | 1ec3652 | 2017-11-29 05:20:37 -0800 | [diff] [blame] | 370 | uword *old_heap; |
| 371 | |
| 372 | old_heap = clib_mem_set_heap (ip4_main.mtrie_mheap); |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 373 | hash_unset(hash, key); |
Neale Ranns | 1ec3652 | 2017-11-29 05:20:37 -0800 | [diff] [blame] | 374 | clib_mem_set_heap (old_heap); |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 375 | } |
| 376 | |
| 377 | fib->fib_entry_by_dst_address[len] = hash; |
| 378 | } |
| 379 | |
| 380 | void |
| 381 | ip4_fib_table_fwding_dpo_update (ip4_fib_t *fib, |
| 382 | const ip4_address_t *addr, |
| 383 | u32 len, |
| 384 | const dpo_id_t *dpo) |
| 385 | { |
Neale Ranns | a3af337 | 2017-03-28 03:49:52 -0700 | [diff] [blame] | 386 | ip4_fib_mtrie_route_add(&fib->mtrie, addr, len, dpo->dpoi_index); |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 387 | } |
| 388 | |
| 389 | void |
| 390 | ip4_fib_table_fwding_dpo_remove (ip4_fib_t *fib, |
| 391 | const ip4_address_t *addr, |
| 392 | u32 len, |
Neale Ranns | a3af337 | 2017-03-28 03:49:52 -0700 | [diff] [blame] | 393 | const dpo_id_t *dpo, |
| 394 | u32 cover_index) |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 395 | { |
Neale Ranns | a3af337 | 2017-03-28 03:49:52 -0700 | [diff] [blame] | 396 | fib_prefix_t cover_prefix = { |
| 397 | .fp_len = 0, |
| 398 | }; |
| 399 | const dpo_id_t *cover_dpo; |
| 400 | |
| 401 | /* |
| 402 | * We need to pass the MTRIE the LB index and address length of the |
| 403 | * covering prefix, so it can fill the plys with the correct replacement |
| 404 | * for the entry being removed |
| 405 | */ |
| 406 | fib_entry_get_prefix(cover_index, &cover_prefix); |
| 407 | cover_dpo = fib_entry_contribute_ip_forwarding(cover_index); |
| 408 | |
| 409 | ip4_fib_mtrie_route_del(&fib->mtrie, |
| 410 | addr, len, dpo->dpoi_index, |
| 411 | cover_prefix.fp_len, |
| 412 | cover_dpo->dpoi_index); |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 413 | } |
| 414 | |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 415 | void |
| 416 | ip4_fib_table_walk (ip4_fib_t *fib, |
| 417 | fib_table_walk_fn_t fn, |
| 418 | void *ctx) |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 419 | { |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 420 | int i; |
| 421 | |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 422 | for (i = 0; i < ARRAY_LEN (fib->fib_entry_by_dst_address); i++) |
| 423 | { |
| 424 | uword * hash = fib->fib_entry_by_dst_address[i]; |
| 425 | |
| 426 | if (NULL != hash) |
| 427 | { |
| 428 | hash_pair_t * p; |
| 429 | |
| 430 | hash_foreach_pair (p, hash, |
| 431 | ({ |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 432 | fn(p->value[0], ctx); |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 433 | })); |
| 434 | } |
| 435 | } |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 436 | } |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 437 | |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 438 | /** |
| 439 | * Walk show context |
| 440 | */ |
| 441 | typedef struct ip4_fib_show_walk_ctx_t_ |
| 442 | { |
| 443 | fib_node_index_t *ifsw_indicies; |
| 444 | } ip4_fib_show_walk_ctx_t; |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 445 | |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 446 | static int |
| 447 | ip4_fib_show_walk_cb (fib_node_index_t fib_entry_index, |
| 448 | void *arg) |
| 449 | { |
| 450 | ip4_fib_show_walk_ctx_t *ctx = arg; |
| 451 | |
| 452 | vec_add1(ctx->ifsw_indicies, fib_entry_index); |
| 453 | |
| 454 | return (1); |
| 455 | } |
| 456 | |
| 457 | static void |
| 458 | ip4_fib_table_show_all (ip4_fib_t *fib, |
| 459 | vlib_main_t * vm) |
| 460 | { |
| 461 | ip4_fib_show_walk_ctx_t ctx = { |
| 462 | .ifsw_indicies = NULL, |
| 463 | }; |
| 464 | fib_node_index_t *fib_entry_index; |
| 465 | |
| 466 | ip4_fib_table_walk(fib, ip4_fib_show_walk_cb, &ctx); |
| 467 | vec_sort_with_function(ctx.ifsw_indicies, |
| 468 | fib_entry_cmp_for_sort); |
| 469 | |
| 470 | vec_foreach(fib_entry_index, ctx.ifsw_indicies) |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 471 | { |
| 472 | vlib_cli_output(vm, "%U", |
| 473 | format_fib_entry, |
| 474 | *fib_entry_index, |
| 475 | FIB_ENTRY_FORMAT_BRIEF); |
| 476 | } |
| 477 | |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 478 | vec_free(ctx.ifsw_indicies); |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 479 | } |
| 480 | |
| 481 | static void |
| 482 | ip4_fib_table_show_one (ip4_fib_t *fib, |
| 483 | vlib_main_t * vm, |
| 484 | ip4_address_t *address, |
Neale Ranns | 88fc83e | 2017-04-05 08:11:14 -0700 | [diff] [blame] | 485 | u32 mask_len, |
| 486 | int detail) |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 487 | { |
| 488 | vlib_cli_output(vm, "%U", |
| 489 | format_fib_entry, |
| 490 | ip4_fib_table_lookup(fib, address, mask_len), |
Neale Ranns | 88fc83e | 2017-04-05 08:11:14 -0700 | [diff] [blame] | 491 | (detail ? |
| 492 | FIB_ENTRY_FORMAT_DETAIL2 : |
| 493 | FIB_ENTRY_FORMAT_DETAIL)); |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 494 | } |
| 495 | |
Neale Ranns | c87aafa | 2017-11-29 00:59:31 -0800 | [diff] [blame] | 496 | u8 * |
| 497 | format_ip4_fib_table_memory (u8 * s, va_list * args) |
| 498 | { |
Neale Ranns | c87aafa | 2017-11-29 00:59:31 -0800 | [diff] [blame] | 499 | s = format(s, "%=30s %=6d %=8ld\n", |
| 500 | "IPv4 unicast", |
Neale Ranns | 1ec3652 | 2017-11-29 05:20:37 -0800 | [diff] [blame] | 501 | pool_elts(ip4_main.fibs), |
| 502 | mheap_bytes(ip4_main.mtrie_mheap)); |
Neale Ranns | c87aafa | 2017-11-29 00:59:31 -0800 | [diff] [blame] | 503 | |
| 504 | return (s); |
| 505 | } |
| 506 | |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 507 | static clib_error_t * |
| 508 | ip4_show_fib (vlib_main_t * vm, |
| 509 | unformat_input_t * input, |
| 510 | vlib_cli_command_t * cmd) |
| 511 | { |
| 512 | ip4_main_t * im4 = &ip4_main; |
| 513 | fib_table_t * fib_table; |
Neale Ranns | c87aafa | 2017-11-29 00:59:31 -0800 | [diff] [blame] | 514 | u64 total_mtrie_memory, total_hash_memory; |
| 515 | int verbose, matching, mtrie, memory; |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 516 | ip4_address_t matching_address; |
| 517 | u32 matching_mask = 32; |
| 518 | int i, table_id = -1, fib_index = ~0; |
Neale Ranns | 88fc83e | 2017-04-05 08:11:14 -0700 | [diff] [blame] | 519 | int detail = 0; |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 520 | |
| 521 | verbose = 1; |
Neale Ranns | c87aafa | 2017-11-29 00:59:31 -0800 | [diff] [blame] | 522 | matching = mtrie = memory = 0; |
| 523 | total_hash_memory = total_mtrie_memory = 0; |
| 524 | |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 525 | while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) |
| 526 | { |
| 527 | if (unformat (input, "brief") || unformat (input, "summary") |
| 528 | || unformat (input, "sum")) |
| 529 | verbose = 0; |
| 530 | |
Neale Ranns | 88fc83e | 2017-04-05 08:11:14 -0700 | [diff] [blame] | 531 | else if (unformat (input, "detail") || unformat (input, "det")) |
| 532 | detail = 1; |
| 533 | |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 534 | else if (unformat (input, "mtrie")) |
| 535 | mtrie = 1; |
| 536 | |
Neale Ranns | c87aafa | 2017-11-29 00:59:31 -0800 | [diff] [blame] | 537 | else if (unformat (input, "mem") || |
| 538 | unformat (input, "memory")) |
| 539 | memory = 1; |
| 540 | |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 541 | else if (unformat (input, "%U/%d", |
| 542 | unformat_ip4_address, &matching_address, &matching_mask)) |
| 543 | matching = 1; |
| 544 | |
| 545 | else if (unformat (input, "%U", unformat_ip4_address, &matching_address)) |
| 546 | matching = 1; |
| 547 | |
| 548 | else if (unformat (input, "table %d", &table_id)) |
| 549 | ; |
| 550 | else if (unformat (input, "index %d", &fib_index)) |
| 551 | ; |
| 552 | else |
| 553 | break; |
| 554 | } |
| 555 | |
| 556 | pool_foreach (fib_table, im4->fibs, |
| 557 | ({ |
Neale Ranns | a3af337 | 2017-03-28 03:49:52 -0700 | [diff] [blame] | 558 | ip4_fib_t *fib = pool_elt_at_index(im4->v4_fibs, fib_table->ft_index); |
Neale Ranns | 1500254 | 2017-09-10 04:39:11 -0700 | [diff] [blame] | 559 | fib_source_t source; |
| 560 | u8 *s = NULL; |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 561 | |
| 562 | if (table_id >= 0 && table_id != (int)fib->table_id) |
| 563 | continue; |
| 564 | if (fib_index != ~0 && fib_index != (int)fib->index) |
| 565 | continue; |
| 566 | |
Neale Ranns | c87aafa | 2017-11-29 00:59:31 -0800 | [diff] [blame] | 567 | if (memory) |
| 568 | { |
| 569 | uword mtrie_size, hash_size; |
| 570 | |
| 571 | mtrie_size = ip4_fib_mtrie_memory_usage(&fib->mtrie); |
| 572 | hash_size = 0; |
| 573 | |
| 574 | for (i = 0; i < ARRAY_LEN (fib->fib_entry_by_dst_address); i++) |
| 575 | { |
| 576 | uword * hash = fib->fib_entry_by_dst_address[i]; |
| 577 | if (NULL != hash) |
| 578 | { |
| 579 | hash_size += hash_bytes(hash); |
| 580 | } |
| 581 | } |
| 582 | if (verbose) |
| 583 | vlib_cli_output (vm, "%U mtrie:%d hash:%d", |
| 584 | format_fib_table_name, fib->index, |
| 585 | FIB_PROTOCOL_IP4, |
| 586 | mtrie_size, |
| 587 | hash_size); |
| 588 | total_mtrie_memory += mtrie_size; |
| 589 | total_hash_memory += hash_size; |
| 590 | continue; |
| 591 | } |
| 592 | |
Neale Ranns | 1500254 | 2017-09-10 04:39:11 -0700 | [diff] [blame] | 593 | s = format(s, "%U, fib_index:%d, flow hash:[%U] locks:[", |
| 594 | format_fib_table_name, fib->index, |
| 595 | FIB_PROTOCOL_IP4, |
| 596 | fib->index, |
| 597 | format_ip_flow_hash_config, |
| 598 | fib_table->ft_flow_hash_config); |
| 599 | FOR_EACH_FIB_SOURCE(source) |
| 600 | { |
| 601 | if (0 != fib_table->ft_locks[source]) |
| 602 | { |
| 603 | s = format(s, "%U:%d, ", |
| 604 | format_fib_source, source, |
| 605 | fib_table->ft_locks[source]); |
| 606 | } |
| 607 | } |
| 608 | s = format (s, "]"); |
Neale Ranns | 2297af0 | 2017-09-12 09:45:04 -0700 | [diff] [blame] | 609 | vlib_cli_output (vm, "%v", s); |
Neale Ranns | 1500254 | 2017-09-10 04:39:11 -0700 | [diff] [blame] | 610 | vec_free(s); |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 611 | |
| 612 | /* Show summary? */ |
Neale Ranns | 3919425 | 2017-11-27 01:03:25 -0800 | [diff] [blame] | 613 | if (mtrie) |
| 614 | { |
| 615 | vlib_cli_output (vm, "%U", format_ip4_fib_mtrie, &fib->mtrie, verbose); |
| 616 | continue; |
| 617 | } |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 618 | if (! verbose) |
| 619 | { |
| 620 | vlib_cli_output (vm, "%=20s%=16s", "Prefix length", "Count"); |
| 621 | for (i = 0; i < ARRAY_LEN (fib->fib_entry_by_dst_address); i++) |
| 622 | { |
| 623 | uword * hash = fib->fib_entry_by_dst_address[i]; |
| 624 | uword n_elts = hash_elts (hash); |
| 625 | if (n_elts > 0) |
| 626 | vlib_cli_output (vm, "%20d%16d", i, n_elts); |
| 627 | } |
| 628 | continue; |
| 629 | } |
| 630 | |
| 631 | if (!matching) |
| 632 | { |
| 633 | ip4_fib_table_show_all(fib, vm); |
| 634 | } |
| 635 | else |
| 636 | { |
Neale Ranns | 88fc83e | 2017-04-05 08:11:14 -0700 | [diff] [blame] | 637 | ip4_fib_table_show_one(fib, vm, &matching_address, |
| 638 | matching_mask, detail); |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 639 | } |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 640 | })); |
| 641 | |
Neale Ranns | c87aafa | 2017-11-29 00:59:31 -0800 | [diff] [blame] | 642 | if (memory) |
| 643 | vlib_cli_output (vm, "totals: mtrie:%ld hash:%ld all:%ld", |
| 644 | total_mtrie_memory, |
| 645 | total_hash_memory, |
| 646 | total_mtrie_memory + total_hash_memory); |
| 647 | |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 648 | return 0; |
| 649 | } |
| 650 | |
| 651 | /*? |
Billy McFall | 0683c9c | 2016-10-13 08:27:31 -0400 | [diff] [blame] | 652 | * This command displays the IPv4 FIB Tables (VRF Tables) and the route |
| 653 | * entries for each table. |
| 654 | * |
| 655 | * @note This command will run for a long time when the FIB tables are |
| 656 | * comprised of millions of entries. For those senarios, consider displaying |
| 657 | * a single table or summary mode. |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 658 | * |
| 659 | * @cliexpar |
Billy McFall | 0683c9c | 2016-10-13 08:27:31 -0400 | [diff] [blame] | 660 | * Example of how to display all the IPv4 FIB tables: |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 661 | * @cliexstart{show ip fib} |
Billy McFall | ebb9a6a | 2016-10-17 11:35:32 -0400 | [diff] [blame] | 662 | * ipv4-VRF:0, fib_index 0, flow hash: src dst sport dport proto |
| 663 | * 0.0.0.0/0 |
| 664 | * unicast-ip4-chain |
| 665 | * [@0]: dpo-load-balance: [index:0 buckets:1 uRPF:0 to:[0:0]] |
| 666 | * [0] [@0]: dpo-drop ip6 |
| 667 | * 0.0.0.0/32 |
| 668 | * unicast-ip4-chain |
| 669 | * [@0]: dpo-load-balance: [index:1 buckets:1 uRPF:1 to:[0:0]] |
| 670 | * [0] [@0]: dpo-drop ip6 |
| 671 | * 6.0.1.2/32 |
| 672 | * unicast-ip4-chain |
| 673 | * [@0]: dpo-load-balance: [index:30 buckets:1 uRPF:29 to:[0:0]] |
| 674 | * [0] [@3]: arp-ipv4: via 6.0.0.1 af_packet0 |
| 675 | * 7.0.0.1/32 |
| 676 | * unicast-ip4-chain |
| 677 | * [@0]: dpo-load-balance: [index:31 buckets:4 uRPF:30 to:[0:0]] |
| 678 | * [0] [@3]: arp-ipv4: via 6.0.0.2 af_packet0 |
| 679 | * [1] [@3]: arp-ipv4: via 6.0.0.2 af_packet0 |
| 680 | * [2] [@3]: arp-ipv4: via 6.0.0.2 af_packet0 |
| 681 | * [3] [@3]: arp-ipv4: via 6.0.0.1 af_packet0 |
| 682 | * 224.0.0.0/8 |
| 683 | * unicast-ip4-chain |
| 684 | * [@0]: dpo-load-balance: [index:3 buckets:1 uRPF:3 to:[0:0]] |
| 685 | * [0] [@0]: dpo-drop ip6 |
| 686 | * 240.0.0.0/8 |
| 687 | * unicast-ip4-chain |
| 688 | * [@0]: dpo-load-balance: [index:2 buckets:1 uRPF:2 to:[0:0]] |
| 689 | * [0] [@0]: dpo-drop ip6 |
| 690 | * 255.255.255.255/32 |
| 691 | * unicast-ip4-chain |
| 692 | * [@0]: dpo-load-balance: [index:4 buckets:1 uRPF:4 to:[0:0]] |
| 693 | * [0] [@0]: dpo-drop ip6 |
| 694 | * ipv4-VRF:7, fib_index 1, flow hash: src dst sport dport proto |
| 695 | * 0.0.0.0/0 |
| 696 | * unicast-ip4-chain |
| 697 | * [@0]: dpo-load-balance: [index:12 buckets:1 uRPF:11 to:[0:0]] |
| 698 | * [0] [@0]: dpo-drop ip6 |
| 699 | * 0.0.0.0/32 |
| 700 | * unicast-ip4-chain |
| 701 | * [@0]: dpo-load-balance: [index:13 buckets:1 uRPF:12 to:[0:0]] |
| 702 | * [0] [@0]: dpo-drop ip6 |
| 703 | * 172.16.1.0/24 |
| 704 | * unicast-ip4-chain |
| 705 | * [@0]: dpo-load-balance: [index:17 buckets:1 uRPF:16 to:[0:0]] |
| 706 | * [0] [@4]: ipv4-glean: af_packet0 |
| 707 | * 172.16.1.1/32 |
| 708 | * unicast-ip4-chain |
| 709 | * [@0]: dpo-load-balance: [index:18 buckets:1 uRPF:17 to:[1:84]] |
| 710 | * [0] [@2]: dpo-receive: 172.16.1.1 on af_packet0 |
| 711 | * 172.16.1.2/32 |
| 712 | * unicast-ip4-chain |
| 713 | * [@0]: dpo-load-balance: [index:21 buckets:1 uRPF:20 to:[0:0]] |
| 714 | * [0] [@5]: ipv4 via 172.16.1.2 af_packet0: IP4: 02:fe:9e:70:7a:2b -> 26:a5:f6:9c:3a:36 |
| 715 | * 172.16.2.0/24 |
| 716 | * unicast-ip4-chain |
| 717 | * [@0]: dpo-load-balance: [index:19 buckets:1 uRPF:18 to:[0:0]] |
| 718 | * [0] [@4]: ipv4-glean: af_packet1 |
| 719 | * 172.16.2.1/32 |
| 720 | * unicast-ip4-chain |
| 721 | * [@0]: dpo-load-balance: [index:20 buckets:1 uRPF:19 to:[0:0]] |
| 722 | * [0] [@2]: dpo-receive: 172.16.2.1 on af_packet1 |
| 723 | * 224.0.0.0/8 |
| 724 | * unicast-ip4-chain |
| 725 | * [@0]: dpo-load-balance: [index:15 buckets:1 uRPF:14 to:[0:0]] |
| 726 | * [0] [@0]: dpo-drop ip6 |
| 727 | * 240.0.0.0/8 |
| 728 | * unicast-ip4-chain |
| 729 | * [@0]: dpo-load-balance: [index:14 buckets:1 uRPF:13 to:[0:0]] |
| 730 | * [0] [@0]: dpo-drop ip6 |
| 731 | * 255.255.255.255/32 |
| 732 | * unicast-ip4-chain |
| 733 | * [@0]: dpo-load-balance: [index:16 buckets:1 uRPF:15 to:[0:0]] |
| 734 | * [0] [@0]: dpo-drop ip6 |
Billy McFall | 0683c9c | 2016-10-13 08:27:31 -0400 | [diff] [blame] | 735 | * @cliexend |
| 736 | * Example of how to display a single IPv4 FIB table: |
| 737 | * @cliexstart{show ip fib table 7} |
Billy McFall | ebb9a6a | 2016-10-17 11:35:32 -0400 | [diff] [blame] | 738 | * ipv4-VRF:7, fib_index 1, flow hash: src dst sport dport proto |
| 739 | * 0.0.0.0/0 |
| 740 | * unicast-ip4-chain |
| 741 | * [@0]: dpo-load-balance: [index:12 buckets:1 uRPF:11 to:[0:0]] |
| 742 | * [0] [@0]: dpo-drop ip6 |
| 743 | * 0.0.0.0/32 |
| 744 | * unicast-ip4-chain |
| 745 | * [@0]: dpo-load-balance: [index:13 buckets:1 uRPF:12 to:[0:0]] |
| 746 | * [0] [@0]: dpo-drop ip6 |
| 747 | * 172.16.1.0/24 |
| 748 | * unicast-ip4-chain |
| 749 | * [@0]: dpo-load-balance: [index:17 buckets:1 uRPF:16 to:[0:0]] |
| 750 | * [0] [@4]: ipv4-glean: af_packet0 |
| 751 | * 172.16.1.1/32 |
| 752 | * unicast-ip4-chain |
| 753 | * [@0]: dpo-load-balance: [index:18 buckets:1 uRPF:17 to:[1:84]] |
| 754 | * [0] [@2]: dpo-receive: 172.16.1.1 on af_packet0 |
| 755 | * 172.16.1.2/32 |
| 756 | * unicast-ip4-chain |
| 757 | * [@0]: dpo-load-balance: [index:21 buckets:1 uRPF:20 to:[0:0]] |
| 758 | * [0] [@5]: ipv4 via 172.16.1.2 af_packet0: IP4: 02:fe:9e:70:7a:2b -> 26:a5:f6:9c:3a:36 |
| 759 | * 172.16.2.0/24 |
| 760 | * unicast-ip4-chain |
| 761 | * [@0]: dpo-load-balance: [index:19 buckets:1 uRPF:18 to:[0:0]] |
| 762 | * [0] [@4]: ipv4-glean: af_packet1 |
| 763 | * 172.16.2.1/32 |
| 764 | * unicast-ip4-chain |
| 765 | * [@0]: dpo-load-balance: [index:20 buckets:1 uRPF:19 to:[0:0]] |
| 766 | * [0] [@2]: dpo-receive: 172.16.2.1 on af_packet1 |
| 767 | * 224.0.0.0/8 |
| 768 | * unicast-ip4-chain |
| 769 | * [@0]: dpo-load-balance: [index:15 buckets:1 uRPF:14 to:[0:0]] |
| 770 | * [0] [@0]: dpo-drop ip6 |
| 771 | * 240.0.0.0/8 |
| 772 | * unicast-ip4-chain |
| 773 | * [@0]: dpo-load-balance: [index:14 buckets:1 uRPF:13 to:[0:0]] |
| 774 | * [0] [@0]: dpo-drop ip6 |
| 775 | * 255.255.255.255/32 |
| 776 | * unicast-ip4-chain |
| 777 | * [@0]: dpo-load-balance: [index:16 buckets:1 uRPF:15 to:[0:0]] |
| 778 | * [0] [@0]: dpo-drop ip6 |
Billy McFall | 0683c9c | 2016-10-13 08:27:31 -0400 | [diff] [blame] | 779 | * @cliexend |
| 780 | * Example of how to display a summary of all IPv4 FIB tables: |
| 781 | * @cliexstart{show ip fib summary} |
Billy McFall | ebb9a6a | 2016-10-17 11:35:32 -0400 | [diff] [blame] | 782 | * ipv4-VRF:0, fib_index 0, flow hash: src dst sport dport proto |
Billy McFall | 0683c9c | 2016-10-13 08:27:31 -0400 | [diff] [blame] | 783 | * Prefix length Count |
Billy McFall | ebb9a6a | 2016-10-17 11:35:32 -0400 | [diff] [blame] | 784 | * 0 1 |
| 785 | * 8 2 |
| 786 | * 32 4 |
| 787 | * ipv4-VRF:7, fib_index 1, flow hash: src dst sport dport proto |
Billy McFall | 0683c9c | 2016-10-13 08:27:31 -0400 | [diff] [blame] | 788 | * Prefix length Count |
Billy McFall | ebb9a6a | 2016-10-17 11:35:32 -0400 | [diff] [blame] | 789 | * 0 1 |
| 790 | * 8 2 |
| 791 | * 24 2 |
| 792 | * 32 4 |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 793 | * @cliexend |
| 794 | ?*/ |
Billy McFall | 0683c9c | 2016-10-13 08:27:31 -0400 | [diff] [blame] | 795 | /* *INDENT-OFF* */ |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 796 | VLIB_CLI_COMMAND (ip4_show_fib_command, static) = { |
| 797 | .path = "show ip fib", |
Neale Ranns | 88fc83e | 2017-04-05 08:11:14 -0700 | [diff] [blame] | 798 | .short_help = "show ip fib [summary] [table <table-id>] [index <fib-id>] [<ip4-addr>[/<mask>]] [mtrie] [detail]", |
Neale Ranns | 0bfe5d8 | 2016-08-25 15:29:12 +0100 | [diff] [blame] | 799 | .function = ip4_show_fib, |
| 800 | }; |
Billy McFall | 0683c9c | 2016-10-13 08:27:31 -0400 | [diff] [blame] | 801 | /* *INDENT-ON* */ |