Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [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/mfib/ip6_mfib.h> |
| 17 | |
| 18 | #include <vnet/mfib/mfib_table.h> |
| 19 | #include <vnet/mfib/mfib_entry.h> |
| 20 | #include <vnet/fib/ip6_fib.h> |
| 21 | |
| 22 | /** |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 23 | * Key and mask for radix |
| 24 | */ |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 25 | typedef clib_bihash_kv_40_8_t ip6_mfib_key_t; |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 26 | |
| 27 | static const mfib_prefix_t all_zeros = { |
| 28 | /* (*,*) */ |
| 29 | .fp_src_addr = { |
| 30 | .ip6.as_u64 = {0, 0}, |
| 31 | }, |
| 32 | .fp_grp_addr = { |
| 33 | .ip6.as_u64 = {0, 0}, |
| 34 | }, |
| 35 | .fp_len = 0, |
| 36 | .fp_proto = FIB_PROTOCOL_IP6, |
| 37 | }; |
| 38 | |
| 39 | typedef enum ip6_mfib_special_type_t_ { |
| 40 | IP6_MFIB_SPECIAL_TYPE_NONE, |
| 41 | IP6_MFIB_SPECIAL_TYPE_SOLICITED, |
| 42 | } ip6_mfib_special_type_t; |
| 43 | |
| 44 | typedef struct ip6_mfib_special_t_ { |
| 45 | /** |
| 46 | * @brief solicited or not |
| 47 | */ |
| 48 | ip6_mfib_special_type_t ims_type; |
| 49 | |
| 50 | /** |
| 51 | * @brief the Prefix length |
| 52 | */ |
| 53 | u8 ims_len; |
| 54 | |
| 55 | /** |
| 56 | * @brief The last byte of the mcast address |
| 57 | */ |
| 58 | u8 ims_byte; |
| 59 | /** |
| 60 | * @brief The scope of the address |
| 61 | */ |
| 62 | u8 ims_scope; |
| 63 | } ip6_mfib_special_t; |
| 64 | |
| 65 | static const ip6_mfib_special_t ip6_mfib_specials[] = |
| 66 | { |
| 67 | { |
| 68 | /* |
| 69 | * Add ff02::1:ff00:0/104 via local route for all tables. |
| 70 | * This is required for neighbor discovery to work. |
| 71 | */ |
| 72 | .ims_type = IP6_MFIB_SPECIAL_TYPE_SOLICITED, |
| 73 | .ims_len = 104, |
| 74 | }, |
| 75 | { |
| 76 | /* |
| 77 | * all-routers multicast address |
| 78 | */ |
| 79 | .ims_type = IP6_MFIB_SPECIAL_TYPE_NONE, |
| 80 | .ims_scope = IP6_MULTICAST_SCOPE_link_local, |
| 81 | .ims_byte = IP6_MULTICAST_GROUP_ID_all_routers, |
| 82 | .ims_len = 128, |
| 83 | }, |
| 84 | { |
| 85 | /* |
| 86 | * all-nodes multicast address |
| 87 | */ |
| 88 | .ims_type = IP6_MFIB_SPECIAL_TYPE_NONE, |
| 89 | .ims_scope = IP6_MULTICAST_SCOPE_link_local, |
| 90 | .ims_byte = IP6_MULTICAST_GROUP_ID_all_hosts, |
| 91 | .ims_len = 128, |
| 92 | }, |
| 93 | { |
| 94 | /* |
| 95 | * Add all-mldv2 multicast address via local route for all tables |
| 96 | */ |
| 97 | .ims_type = IP6_MFIB_SPECIAL_TYPE_NONE, |
| 98 | .ims_len = 128, |
| 99 | .ims_scope = IP6_MULTICAST_SCOPE_link_local, |
| 100 | .ims_byte = IP6_MULTICAST_GROUP_ID_mldv2_routers, |
| 101 | } |
| 102 | }; |
| 103 | |
| 104 | #define FOR_EACH_IP6_SPECIAL(_pfx, _body) \ |
| 105 | { \ |
| 106 | const ip6_mfib_special_t *_spec; \ |
| 107 | u8 _ii; \ |
| 108 | for (_ii = 0; \ |
| 109 | _ii < ARRAY_LEN(ip6_mfib_specials); \ |
| 110 | _ii++) \ |
| 111 | { \ |
| 112 | _spec = &ip6_mfib_specials[_ii]; \ |
| 113 | if (IP6_MFIB_SPECIAL_TYPE_SOLICITED == _spec->ims_type) \ |
| 114 | { \ |
| 115 | ip6_set_solicited_node_multicast_address( \ |
| 116 | &(_pfx)->fp_grp_addr.ip6, 0); \ |
| 117 | } \ |
| 118 | else \ |
| 119 | { \ |
| 120 | ip6_set_reserved_multicast_address ( \ |
| 121 | &(_pfx)->fp_grp_addr.ip6, \ |
| 122 | _spec->ims_scope, \ |
| 123 | _spec->ims_byte); \ |
| 124 | } \ |
| 125 | (_pfx)->fp_len = _spec->ims_len; \ |
| 126 | do { _body; } while (0); \ |
| 127 | } \ |
| 128 | } |
| 129 | |
| 130 | |
| 131 | static u32 |
Neale Ranns | 1500254 | 2017-09-10 04:39:11 -0700 | [diff] [blame] | 132 | ip6_create_mfib_with_table_id (u32 table_id, |
| 133 | mfib_source_t src) |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 134 | { |
| 135 | mfib_table_t *mfib_table; |
| 136 | mfib_prefix_t pfx = { |
| 137 | .fp_proto = FIB_PROTOCOL_IP6, |
| 138 | }; |
| 139 | const fib_route_path_t path_for_us = { |
Neale Ranns | da78f95 | 2017-05-24 09:15:43 -0700 | [diff] [blame] | 140 | .frp_proto = DPO_PROTO_IP6, |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 141 | .frp_addr = zero_addr, |
| 142 | .frp_sw_if_index = 0xffffffff, |
| 143 | .frp_fib_index = ~0, |
Neale Ranns | 097fa66 | 2018-05-01 05:17:55 -0700 | [diff] [blame] | 144 | .frp_weight = 1, |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 145 | .frp_flags = FIB_ROUTE_PATH_LOCAL, |
Neale Ranns | 097fa66 | 2018-05-01 05:17:55 -0700 | [diff] [blame] | 146 | .frp_mitf_flags = MFIB_ITF_FLAG_FORWARD, |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 147 | }; |
| 148 | |
| 149 | pool_get_aligned(ip6_main.mfibs, mfib_table, CLIB_CACHE_LINE_BYTES); |
Dave Barach | b7b9299 | 2018-10-17 10:38:51 -0400 | [diff] [blame] | 150 | clib_memset(mfib_table, 0, sizeof(*mfib_table)); |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 151 | |
| 152 | mfib_table->mft_proto = FIB_PROTOCOL_IP6; |
| 153 | mfib_table->mft_index = |
| 154 | mfib_table->v6.index = |
| 155 | (mfib_table - ip6_main.mfibs); |
| 156 | |
| 157 | hash_set (ip6_main.mfib_index_by_table_id, |
| 158 | table_id, |
| 159 | mfib_table->mft_index); |
| 160 | |
| 161 | mfib_table->mft_table_id = |
| 162 | mfib_table->v6.table_id = |
| 163 | table_id; |
| 164 | |
Neale Ranns | 1500254 | 2017-09-10 04:39:11 -0700 | [diff] [blame] | 165 | mfib_table_lock(mfib_table->mft_index, FIB_PROTOCOL_IP6, src); |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 166 | |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 167 | /* |
| 168 | * add the special entries into the new FIB |
| 169 | */ |
| 170 | mfib_table_entry_update(mfib_table->mft_index, |
| 171 | &all_zeros, |
| 172 | MFIB_SOURCE_DEFAULT_ROUTE, |
Neale Ranns | 0f26c5a | 2017-03-01 15:12:11 -0800 | [diff] [blame] | 173 | MFIB_RPF_ID_NONE, |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 174 | MFIB_ENTRY_FLAG_DROP); |
| 175 | |
| 176 | /* |
| 177 | * Add each of the specials |
| 178 | */ |
| 179 | FOR_EACH_IP6_SPECIAL(&pfx, |
| 180 | ({ |
| 181 | mfib_table_entry_path_update(mfib_table->mft_index, |
| 182 | &pfx, |
| 183 | MFIB_SOURCE_SPECIAL, |
Neale Ranns | 097fa66 | 2018-05-01 05:17:55 -0700 | [diff] [blame] | 184 | &path_for_us); |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 185 | })); |
| 186 | |
| 187 | return (mfib_table->mft_index); |
| 188 | } |
| 189 | |
| 190 | void |
| 191 | ip6_mfib_table_destroy (ip6_mfib_t *mfib) |
| 192 | { |
| 193 | mfib_table_t *mfib_table = (mfib_table_t*)mfib; |
| 194 | fib_node_index_t mfei; |
| 195 | mfib_prefix_t pfx = { |
| 196 | .fp_proto = FIB_PROTOCOL_IP6, |
| 197 | }; |
| 198 | const fib_route_path_t path_for_us = { |
Neale Ranns | da78f95 | 2017-05-24 09:15:43 -0700 | [diff] [blame] | 199 | .frp_proto = DPO_PROTO_IP6, |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 200 | .frp_addr = zero_addr, |
| 201 | .frp_sw_if_index = 0xffffffff, |
| 202 | .frp_fib_index = ~0, |
Neale Ranns | 097fa66 | 2018-05-01 05:17:55 -0700 | [diff] [blame] | 203 | .frp_weight = 1, |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 204 | .frp_flags = FIB_ROUTE_PATH_LOCAL, |
| 205 | }; |
| 206 | |
| 207 | /* |
| 208 | * remove all the specials we added when the table was created. |
| 209 | */ |
| 210 | FOR_EACH_IP6_SPECIAL(&pfx, |
| 211 | { |
| 212 | mfib_table_entry_path_remove(mfib_table->mft_index, |
| 213 | &pfx, |
| 214 | MFIB_SOURCE_SPECIAL, |
| 215 | &path_for_us); |
| 216 | }); |
| 217 | |
| 218 | mfei = mfib_table_lookup_exact_match(mfib_table->mft_index, &all_zeros); |
| 219 | mfib_table_entry_delete_index(mfei, MFIB_SOURCE_DEFAULT_ROUTE); |
| 220 | |
| 221 | /* |
| 222 | * validate no more routes. |
| 223 | */ |
| 224 | ASSERT(0 == mfib_table->mft_total_route_counts); |
| 225 | ASSERT(~0 != mfib_table->mft_table_id); |
| 226 | |
| 227 | hash_unset (ip6_main.mfib_index_by_table_id, mfib_table->mft_table_id); |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 228 | pool_put(ip6_main.mfibs, mfib_table); |
| 229 | } |
| 230 | |
| 231 | void |
| 232 | ip6_mfib_interface_enable_disable (u32 sw_if_index, int is_enable) |
| 233 | { |
| 234 | const fib_route_path_t path = { |
Neale Ranns | da78f95 | 2017-05-24 09:15:43 -0700 | [diff] [blame] | 235 | .frp_proto = DPO_PROTO_IP6, |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 236 | .frp_addr = zero_addr, |
| 237 | .frp_sw_if_index = sw_if_index, |
| 238 | .frp_fib_index = ~0, |
Neale Ranns | 097fa66 | 2018-05-01 05:17:55 -0700 | [diff] [blame] | 239 | .frp_weight = 1, |
| 240 | .frp_mitf_flags = MFIB_ITF_FLAG_ACCEPT, |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 241 | }; |
| 242 | mfib_prefix_t pfx = { |
| 243 | .fp_proto = FIB_PROTOCOL_IP6, |
| 244 | }; |
| 245 | u32 mfib_index; |
| 246 | |
| 247 | vec_validate (ip6_main.mfib_index_by_sw_if_index, sw_if_index); |
| 248 | mfib_index = ip6_mfib_table_get_index_for_sw_if_index(sw_if_index); |
| 249 | |
| 250 | if (is_enable) |
| 251 | { |
| 252 | FOR_EACH_IP6_SPECIAL(&pfx, |
| 253 | { |
| 254 | mfib_table_entry_path_update(mfib_index, |
| 255 | &pfx, |
| 256 | MFIB_SOURCE_SPECIAL, |
Neale Ranns | 097fa66 | 2018-05-01 05:17:55 -0700 | [diff] [blame] | 257 | &path); |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 258 | }); |
| 259 | } |
| 260 | else |
| 261 | { |
| 262 | FOR_EACH_IP6_SPECIAL(&pfx, |
| 263 | { |
| 264 | mfib_table_entry_path_remove(mfib_index, |
| 265 | &pfx, |
| 266 | MFIB_SOURCE_SPECIAL, |
| 267 | &path); |
| 268 | }); |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | u32 |
Neale Ranns | 1500254 | 2017-09-10 04:39:11 -0700 | [diff] [blame] | 273 | ip6_mfib_table_find_or_create_and_lock (u32 table_id, |
| 274 | mfib_source_t src) |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 275 | { |
| 276 | u32 index; |
| 277 | |
| 278 | index = ip6_mfib_index_from_table_id(table_id); |
| 279 | if (~0 == index) |
Neale Ranns | 1500254 | 2017-09-10 04:39:11 -0700 | [diff] [blame] | 280 | return ip6_create_mfib_with_table_id(table_id, src); |
| 281 | mfib_table_lock(index, FIB_PROTOCOL_IP6, src); |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 282 | |
| 283 | return (index); |
| 284 | } |
| 285 | |
| 286 | u32 |
| 287 | ip6_mfib_table_get_index_for_sw_if_index (u32 sw_if_index) |
| 288 | { |
| 289 | if (sw_if_index >= vec_len(ip6_main.mfib_index_by_sw_if_index)) |
| 290 | { |
| 291 | /* |
| 292 | * This is the case for interfaces that are not yet mapped to |
| 293 | * a IP table |
| 294 | */ |
| 295 | return (~0); |
| 296 | } |
| 297 | return (ip6_main.mfib_index_by_sw_if_index[sw_if_index]); |
| 298 | } |
| 299 | |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 300 | #define IPV6_MFIB_GRP_LEN(_len) \ |
| 301 | (_len > 128 ? 128 : _len) |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 302 | |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 303 | #define IP6_MFIB_MK_KEY(_mfib, _grp, _src, _len, _key) \ |
| 304 | { \ |
| 305 | _key.key[0] = (_grp->as_u64[0] & \ |
| 306 | ip6_main.fib_masks[IPV6_MFIB_GRP_LEN(_len)].as_u64[0]); \ |
| 307 | _key.key[1] = (_grp->as_u64[1] & \ |
| 308 | ip6_main.fib_masks[IPV6_MFIB_GRP_LEN(_len)].as_u64[1]); \ |
| 309 | if (_len == 256) { \ |
| 310 | _key.key[2] = _src->as_u64[0]; \ |
| 311 | _key.key[3] = _src->as_u64[1]; \ |
| 312 | } else { \ |
| 313 | _key.key[2] = 0; \ |
| 314 | _key.key[3] = 0; \ |
| 315 | } \ |
| 316 | _key.key[4] = _mfib->index; \ |
| 317 | _key.key[4] = (_key.key[4] << 32) | len; \ |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 318 | } |
| 319 | |
| 320 | /* |
| 321 | * ip6_fib_table_lookup_exact_match |
| 322 | * |
| 323 | * Exact match prefix lookup |
| 324 | */ |
| 325 | fib_node_index_t |
| 326 | ip6_mfib_table_lookup_exact_match (const ip6_mfib_t *mfib, |
| 327 | const ip6_address_t *grp, |
| 328 | const ip6_address_t *src, |
| 329 | u32 len) |
| 330 | { |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 331 | ip6_mfib_key_t key, value; |
| 332 | int rv; |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 333 | |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 334 | IP6_MFIB_MK_KEY(mfib, grp, src, len, key); |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 335 | |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 336 | rv = clib_bihash_search_inline_2_40_8(&ip6_main.ip6_mtable.ip6_mhash, |
| 337 | &key, &value); |
| 338 | if (rv == 0) |
| 339 | return value.value; |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 340 | |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 341 | return (FIB_NODE_INDEX_INVALID); |
| 342 | } |
| 343 | |
| 344 | /* |
| 345 | * ip6_fib_table_lookup |
| 346 | * |
| 347 | * Longest prefix match for the forwarding plane (no mask given) |
| 348 | */ |
| 349 | fib_node_index_t |
| 350 | ip6_mfib_table_fwd_lookup (const ip6_mfib_t *mfib, |
| 351 | const ip6_address_t *src, |
| 352 | const ip6_address_t *grp) |
| 353 | { |
| 354 | ip6_mfib_table_instance_t *table; |
| 355 | ip6_mfib_key_t key, value; |
| 356 | int i, n, len; |
| 357 | int rv; |
| 358 | |
| 359 | table = &ip6_main.ip6_mtable; |
| 360 | n = vec_len (table->prefix_lengths_in_search_order); |
| 361 | |
| 362 | for (i = 0; i < n; i++) |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 363 | { |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 364 | len = table->prefix_lengths_in_search_order[i]; |
| 365 | |
| 366 | ASSERT(len >= 0 && len <= 256); |
| 367 | IP6_MFIB_MK_KEY(mfib, grp, src, len, key); |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 368 | rv = clib_bihash_search_inline_2_40_8(&table->ip6_mhash, &key, &value); |
| 369 | if (rv == 0) |
| 370 | return value.value; |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 371 | } |
| 372 | |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 373 | return (FIB_NODE_INDEX_INVALID); |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 374 | } |
| 375 | |
Neale Ranns | 9e829a8 | 2018-12-17 05:50:32 -0800 | [diff] [blame] | 376 | |
| 377 | fib_node_index_t |
| 378 | ip6_mfib_table_get_less_specific (const ip6_mfib_t *mfib, |
| 379 | const ip6_address_t *src, |
| 380 | const ip6_address_t *grp, |
| 381 | u32 len) |
| 382 | { |
| 383 | u32 mask_len; |
| 384 | |
| 385 | /* |
| 386 | * in the absence of a tree structure for the table that allows for an O(1) |
| 387 | * parent get, a cheeky way to find the cover is to LPM for the prefix with |
| 388 | * mask-1. |
| 389 | * there should always be a cover, though it may be the default route. the |
| 390 | * default route's cover is the default route. |
| 391 | */ |
| 392 | if (len == 256) |
| 393 | { |
| 394 | /* go from (S,G) to (*,G*) */ |
| 395 | mask_len = 128; |
| 396 | } |
| 397 | else if (len != 0) |
| 398 | { |
| 399 | mask_len = len - 1; |
| 400 | } |
| 401 | else |
| 402 | { |
| 403 | mask_len = len; |
| 404 | } |
| 405 | |
| 406 | return (ip6_mfib_table_lookup(mfib, src, grp, mask_len)); |
| 407 | } |
| 408 | |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 409 | /* |
| 410 | * ip6_fib_table_lookup |
| 411 | * |
| 412 | * Longest prefix match |
| 413 | */ |
| 414 | fib_node_index_t |
| 415 | ip6_mfib_table_lookup (const ip6_mfib_t *mfib, |
| 416 | const ip6_address_t *src, |
| 417 | const ip6_address_t *grp, |
| 418 | u32 len) |
| 419 | { |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 420 | ip6_mfib_table_instance_t *table; |
| 421 | ip6_mfib_key_t key, value; |
| 422 | int i, n, rv; |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 423 | |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 424 | table = &ip6_main.ip6_mtable; |
| 425 | n = vec_len (table->prefix_lengths_in_search_order); |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 426 | |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 427 | /* |
| 428 | * start search from a mask length same length or shorter. |
| 429 | * we don't want matches longer than the mask passed |
| 430 | */ |
| 431 | i = 0; |
| 432 | while (i < n && table->prefix_lengths_in_search_order[i] > len) |
| 433 | { |
| 434 | i++; |
| 435 | } |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 436 | |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 437 | for (; i < n; i++) |
| 438 | { |
| 439 | len = table->prefix_lengths_in_search_order[i]; |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 440 | |
Neale Ranns | b7778b6 | 2018-12-21 07:00:56 -0800 | [diff] [blame] | 441 | ASSERT(len <= 256); |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 442 | IP6_MFIB_MK_KEY(mfib, grp, src, len, key); |
| 443 | |
| 444 | rv = clib_bihash_search_inline_2_40_8(&table->ip6_mhash, &key, &value); |
| 445 | if (rv == 0) |
| 446 | return value.value; |
| 447 | } |
| 448 | |
| 449 | return (FIB_NODE_INDEX_INVALID); |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 450 | } |
| 451 | |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 452 | static void |
| 453 | compute_prefix_lengths_in_search_order (ip6_mfib_table_instance_t *table) |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 454 | { |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 455 | int i; |
| 456 | vec_reset_length (table->prefix_lengths_in_search_order); |
| 457 | /* Note: bitmap reversed so this is in fact a longest prefix match */ |
| 458 | clib_bitmap_foreach (i, table->non_empty_dst_address_length_bitmap, |
| 459 | ({ |
| 460 | vec_add1(table->prefix_lengths_in_search_order, (256 - i)); |
| 461 | })); |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 462 | } |
| 463 | |
| 464 | void |
| 465 | ip6_mfib_table_entry_insert (ip6_mfib_t *mfib, |
| 466 | const ip6_address_t *grp, |
| 467 | const ip6_address_t *src, |
| 468 | u32 len, |
| 469 | fib_node_index_t mfib_entry_index) |
| 470 | { |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 471 | ip6_mfib_table_instance_t *table; |
| 472 | ip6_mfib_key_t key; |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 473 | |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 474 | table = &ip6_main.ip6_mtable; |
| 475 | IP6_MFIB_MK_KEY(mfib, grp, src, len, key); |
| 476 | key.value = mfib_entry_index; |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 477 | |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 478 | clib_bihash_add_del_40_8(&table->ip6_mhash, &key, 1); |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 479 | |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 480 | if (0 == table->dst_address_length_refcounts[len]++) |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 481 | { |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 482 | table->non_empty_dst_address_length_bitmap = |
| 483 | clib_bitmap_set (table->non_empty_dst_address_length_bitmap, |
| 484 | 256 - len, 1); |
| 485 | compute_prefix_lengths_in_search_order (table); |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 486 | } |
| 487 | } |
| 488 | |
| 489 | void |
| 490 | ip6_mfib_table_entry_remove (ip6_mfib_t *mfib, |
| 491 | const ip6_address_t *grp, |
| 492 | const ip6_address_t *src, |
| 493 | u32 len) |
| 494 | { |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 495 | ip6_mfib_table_instance_t *table; |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 496 | ip6_mfib_key_t key; |
| 497 | |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 498 | IP6_MFIB_MK_KEY(mfib, grp, src, len, key); |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 499 | |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 500 | table = &ip6_main.ip6_mtable; |
| 501 | clib_bihash_add_del_40_8(&table->ip6_mhash, &key, 0); |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 502 | |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 503 | ASSERT (table->dst_address_length_refcounts[len] > 0); |
| 504 | if (--table->dst_address_length_refcounts[len] == 0) |
| 505 | { |
| 506 | table->non_empty_dst_address_length_bitmap = |
| 507 | clib_bitmap_set (table->non_empty_dst_address_length_bitmap, |
| 508 | 256 - len, 0); |
| 509 | compute_prefix_lengths_in_search_order (table); |
| 510 | } |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 511 | } |
| 512 | |
| 513 | static clib_error_t * |
| 514 | ip6_mfib_module_init (vlib_main_t * vm) |
| 515 | { |
| 516 | return (NULL); |
| 517 | } |
| 518 | |
| 519 | VLIB_INIT_FUNCTION(ip6_mfib_module_init); |
| 520 | |
Neale Ranns | c87aafa | 2017-11-29 00:59:31 -0800 | [diff] [blame] | 521 | u8 * |
| 522 | format_ip6_mfib_table_memory (u8 * s, va_list * args) |
| 523 | { |
Neale Ranns | 05cac30 | 2019-05-28 11:09:40 +0000 | [diff] [blame] | 524 | u64 bytes_inuse; |
| 525 | |
| 526 | bytes_inuse = alloc_arena_next(&(ip6_main.ip6_mtable.ip6_mhash)); |
| 527 | |
| 528 | s = format(s, "%=30s %=6d %=12ld\n", |
Neale Ranns | c87aafa | 2017-11-29 00:59:31 -0800 | [diff] [blame] | 529 | "IPv6 multicast", |
Neale Ranns | 05cac30 | 2019-05-28 11:09:40 +0000 | [diff] [blame] | 530 | pool_elts(ip6_main.mfibs), |
| 531 | bytes_inuse); |
Neale Ranns | c87aafa | 2017-11-29 00:59:31 -0800 | [diff] [blame] | 532 | |
| 533 | return (s); |
| 534 | } |
| 535 | |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 536 | static void |
| 537 | ip6_mfib_table_show_one (ip6_mfib_t *mfib, |
| 538 | vlib_main_t * vm, |
| 539 | ip6_address_t *src, |
| 540 | ip6_address_t *grp, |
Neale Ranns | 9e829a8 | 2018-12-17 05:50:32 -0800 | [diff] [blame] | 541 | u32 mask_len, |
| 542 | u32 cover) |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 543 | { |
Neale Ranns | 9e829a8 | 2018-12-17 05:50:32 -0800 | [diff] [blame] | 544 | if (cover) |
| 545 | { |
| 546 | vlib_cli_output(vm, "%U", |
| 547 | format_mfib_entry, |
| 548 | ip6_mfib_table_get_less_specific(mfib, src, grp, mask_len), |
| 549 | MFIB_ENTRY_FORMAT_DETAIL); |
| 550 | } |
| 551 | else |
| 552 | { |
| 553 | vlib_cli_output(vm, "%U", |
| 554 | format_mfib_entry, |
| 555 | ip6_mfib_table_lookup(mfib, src, grp, mask_len), |
| 556 | MFIB_ENTRY_FORMAT_DETAIL); |
| 557 | } |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 558 | } |
| 559 | |
| 560 | typedef struct ip6_mfib_show_ctx_t_ { |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 561 | fib_node_index_t *entries; |
| 562 | } ip6_mfib_show_ctx_t; |
| 563 | |
| 564 | |
| 565 | static int |
Neale Ranns | 5a8123b | 2017-01-26 01:18:23 -0800 | [diff] [blame] | 566 | ip6_mfib_table_collect_entries (fib_node_index_t mfei, void *arg) |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 567 | { |
| 568 | ip6_mfib_show_ctx_t *ctx = arg; |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 569 | |
Neale Ranns | 5a8123b | 2017-01-26 01:18:23 -0800 | [diff] [blame] | 570 | vec_add1(ctx->entries, mfei); |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 571 | |
| 572 | return (0); |
| 573 | } |
| 574 | |
| 575 | static void |
| 576 | ip6_mfib_table_show_all (ip6_mfib_t *mfib, |
| 577 | vlib_main_t * vm) |
| 578 | { |
| 579 | fib_node_index_t *mfib_entry_index; |
| 580 | ip6_mfib_show_ctx_t ctx = { |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 581 | .entries = NULL, |
| 582 | }; |
| 583 | |
Neale Ranns | 5a8123b | 2017-01-26 01:18:23 -0800 | [diff] [blame] | 584 | ip6_mfib_table_walk(mfib, |
| 585 | ip6_mfib_table_collect_entries, |
| 586 | &ctx); |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 587 | |
| 588 | vec_sort_with_function(ctx.entries, mfib_entry_cmp_for_sort); |
| 589 | |
| 590 | vec_foreach(mfib_entry_index, ctx.entries) |
| 591 | { |
| 592 | vlib_cli_output(vm, "%U", |
| 593 | format_mfib_entry, |
| 594 | *mfib_entry_index, |
| 595 | MFIB_ENTRY_FORMAT_BRIEF); |
| 596 | } |
| 597 | |
| 598 | vec_free(ctx.entries); |
| 599 | } |
| 600 | |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 601 | /** |
| 602 | * @brief Context when walking the IPv6 table. Since all VRFs are in the |
| 603 | * same hash table, we need to filter only those we need as we walk |
| 604 | */ |
| 605 | typedef struct ip6_mfib_walk_ctx_t_ |
Neale Ranns | 5a8123b | 2017-01-26 01:18:23 -0800 | [diff] [blame] | 606 | { |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 607 | u32 i6w_mfib_index; |
| 608 | mfib_table_walk_fn_t i6w_fn; |
| 609 | void *i6w_ctx; |
| 610 | } ip6_mfib_walk_ctx_t; |
Neale Ranns | 5a8123b | 2017-01-26 01:18:23 -0800 | [diff] [blame] | 611 | |
| 612 | static int |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 613 | ip6_mfib_walk_cb (clib_bihash_kv_40_8_t * kvp, |
| 614 | void *arg) |
Neale Ranns | 5a8123b | 2017-01-26 01:18:23 -0800 | [diff] [blame] | 615 | { |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 616 | ip6_mfib_walk_ctx_t *ctx = arg; |
Neale Ranns | 5a8123b | 2017-01-26 01:18:23 -0800 | [diff] [blame] | 617 | |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 618 | if ((kvp->key[4] >> 32) == ctx->i6w_mfib_index) |
| 619 | { |
| 620 | return (ctx->i6w_fn(kvp->value, ctx->i6w_ctx)); |
| 621 | } |
| 622 | return (FIB_TABLE_WALK_CONTINUE); |
Neale Ranns | 5a8123b | 2017-01-26 01:18:23 -0800 | [diff] [blame] | 623 | } |
| 624 | |
| 625 | void |
| 626 | ip6_mfib_table_walk (ip6_mfib_t *mfib, |
| 627 | mfib_table_walk_fn_t fn, |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 628 | void *arg) |
Neale Ranns | 5a8123b | 2017-01-26 01:18:23 -0800 | [diff] [blame] | 629 | { |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 630 | ip6_mfib_walk_ctx_t ctx = { |
| 631 | .i6w_mfib_index = mfib->index, |
| 632 | .i6w_fn = fn, |
| 633 | .i6w_ctx = arg, |
Neale Ranns | 5a8123b | 2017-01-26 01:18:23 -0800 | [diff] [blame] | 634 | }; |
| 635 | |
Neale Ranns | ae80983 | 2018-11-23 09:00:27 -0800 | [diff] [blame] | 636 | clib_bihash_foreach_key_value_pair_40_8( |
| 637 | &ip6_main.ip6_mtable.ip6_mhash, |
| 638 | ip6_mfib_walk_cb, |
| 639 | &ctx); |
Neale Ranns | 5a8123b | 2017-01-26 01:18:23 -0800 | [diff] [blame] | 640 | } |
| 641 | |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 642 | static clib_error_t * |
| 643 | ip6_show_mfib (vlib_main_t * vm, |
| 644 | unformat_input_t * input, |
| 645 | vlib_cli_command_t * cmd) |
| 646 | { |
Neale Ranns | c87aafa | 2017-11-29 00:59:31 -0800 | [diff] [blame] | 647 | ip6_main_t * im6 = &ip6_main; |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 648 | mfib_table_t *mfib_table; |
| 649 | int verbose, matching; |
| 650 | ip6_address_t grp, src = {{0}}; |
Neale Ranns | 9e829a8 | 2018-12-17 05:50:32 -0800 | [diff] [blame] | 651 | u32 mask = 128, cover; |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 652 | int table_id = -1, fib_index = ~0; |
| 653 | |
| 654 | verbose = 1; |
| 655 | matching = 0; |
Neale Ranns | 9e829a8 | 2018-12-17 05:50:32 -0800 | [diff] [blame] | 656 | cover = 0; |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 657 | |
| 658 | while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) |
| 659 | { |
| 660 | if (unformat (input, "brief") || unformat (input, "summary") |
| 661 | || unformat (input, "sum")) |
| 662 | verbose = 0; |
| 663 | |
| 664 | else if (unformat (input, "%U %U", |
| 665 | unformat_ip6_address, &src, |
| 666 | unformat_ip6_address, &grp)) |
| 667 | { |
| 668 | matching = 1; |
Neale Ranns | c7409dc | 2017-05-19 02:54:32 -0700 | [diff] [blame] | 669 | mask = 256; |
| 670 | } |
| 671 | else if (unformat (input, "%U/%d", unformat_ip6_address, &grp, &mask)) |
| 672 | { |
Dave Barach | b7b9299 | 2018-10-17 10:38:51 -0400 | [diff] [blame] | 673 | clib_memset(&src, 0, sizeof(src)); |
Neale Ranns | c7409dc | 2017-05-19 02:54:32 -0700 | [diff] [blame] | 674 | matching = 1; |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 675 | } |
| 676 | else if (unformat (input, "%U", unformat_ip6_address, &grp)) |
| 677 | { |
Dave Barach | b7b9299 | 2018-10-17 10:38:51 -0400 | [diff] [blame] | 678 | clib_memset(&src, 0, sizeof(src)); |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 679 | matching = 1; |
Neale Ranns | c7409dc | 2017-05-19 02:54:32 -0700 | [diff] [blame] | 680 | mask = 128; |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 681 | } |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 682 | else if (unformat (input, "table %d", &table_id)) |
| 683 | ; |
| 684 | else if (unformat (input, "index %d", &fib_index)) |
| 685 | ; |
Neale Ranns | 9e829a8 | 2018-12-17 05:50:32 -0800 | [diff] [blame] | 686 | else if (unformat (input, "cover")) |
| 687 | cover = 1; |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 688 | else |
| 689 | break; |
| 690 | } |
| 691 | |
Neale Ranns | c87aafa | 2017-11-29 00:59:31 -0800 | [diff] [blame] | 692 | pool_foreach (mfib_table, im6->mfibs, |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 693 | ({ |
| 694 | ip6_mfib_t *mfib = &mfib_table->v6; |
| 695 | |
| 696 | if (table_id >= 0 && table_id != (int)mfib->table_id) |
| 697 | continue; |
| 698 | if (fib_index != ~0 && fib_index != (int)mfib->index) |
| 699 | continue; |
| 700 | |
| 701 | vlib_cli_output (vm, "%U, fib_index %d", |
| 702 | format_mfib_table_name, mfib->index, FIB_PROTOCOL_IP6, |
| 703 | mfib->index); |
| 704 | |
| 705 | /* Show summary? */ |
| 706 | if (! verbose) |
| 707 | { |
| 708 | /* vlib_cli_output (vm, "%=20s%=16s", "Prefix length", "Count"); */ |
| 709 | /* for (i = 0; i < ARRAY_LEN (mfib->fib_entry_by_dst_address); i++) */ |
| 710 | /* { */ |
| 711 | /* uword * hash = mfib->fib_entry_by_dst_address[i]; */ |
| 712 | /* uword n_elts = hash_elts (hash); */ |
| 713 | /* if (n_elts > 0) */ |
| 714 | /* vlib_cli_output (vm, "%20d%16d", i, n_elts); */ |
| 715 | /* } */ |
| 716 | continue; |
| 717 | } |
| 718 | |
| 719 | if (!matching) |
| 720 | { |
| 721 | ip6_mfib_table_show_all(mfib, vm); |
| 722 | } |
| 723 | else |
| 724 | { |
Neale Ranns | 9e829a8 | 2018-12-17 05:50:32 -0800 | [diff] [blame] | 725 | ip6_mfib_table_show_one(mfib, vm, &src, &grp, mask, cover); |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 726 | } |
| 727 | })); |
| 728 | |
| 729 | return 0; |
| 730 | } |
| 731 | |
| 732 | /* |
Neale Ranns | c87aafa | 2017-11-29 00:59:31 -0800 | [diff] [blame] | 733 | * This command displays the IPv6 MulticasrFIB Tables (VRF Tables) and |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 734 | * the route entries for each table. |
| 735 | * |
| 736 | * @note This command will run for a long time when the FIB tables are |
| 737 | * comprised of millions of entries. For those senarios, consider displaying |
| 738 | * a single table or summary mode. |
| 739 | * |
| 740 | * @cliexpar |
Neale Ranns | c87aafa | 2017-11-29 00:59:31 -0800 | [diff] [blame] | 741 | * Example of how to display all the IPv6 Multicast FIB tables: |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 742 | * @cliexstart{show ip fib} |
Neale Ranns | c87aafa | 2017-11-29 00:59:31 -0800 | [diff] [blame] | 743 | * ipv6-VRF:0, fib_index 0 |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 744 | * (*, 0.0.0.0/0): flags:D, |
| 745 | * Interfaces: |
| 746 | * multicast-ip6-chain |
| 747 | * [@1]: dpo-drop ip6 |
| 748 | * (*, 232.1.1.1/32): |
| 749 | * Interfaces: |
| 750 | * test-eth1: Forward, |
| 751 | * test-eth2: Forward, |
| 752 | * test-eth0: Accept, |
| 753 | * multicast-ip6-chain |
| 754 | * [@2]: dpo-replicate: [index:1 buckets:2 to:[0:0]] |
Neale Ranns | c87aafa | 2017-11-29 00:59:31 -0800 | [diff] [blame] | 755 | * [0] [@1]: ipv6-mcast: test-eth1: IP6: d0:d1:d2:d3:d4:01 -> 01:00:05:00:00:00 |
| 756 | * [1] [@1]: ipv6-mcast: test-eth2: IP6: d0:d1:d2:d3:d4:02 -> 01:00:05:00:00:00 |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 757 | * |
| 758 | * @cliexend |
Neale Ranns | c87aafa | 2017-11-29 00:59:31 -0800 | [diff] [blame] | 759 | * Example of how to display a summary of all IPv6 FIB tables: |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 760 | * @cliexstart{show ip fib summary} |
Neale Ranns | c87aafa | 2017-11-29 00:59:31 -0800 | [diff] [blame] | 761 | * ipv6-VRF:0, fib_index 0, flow hash: src dst sport dport proto |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 762 | * Prefix length Count |
| 763 | * 0 1 |
| 764 | * 8 2 |
| 765 | * 32 4 |
Neale Ranns | c87aafa | 2017-11-29 00:59:31 -0800 | [diff] [blame] | 766 | * ipv6-VRF:7, fib_index 1, flow hash: src dst sport dport proto |
Neale Ranns | 32e1c01 | 2016-11-22 17:07:28 +0000 | [diff] [blame] | 767 | * Prefix length Count |
| 768 | * 0 1 |
| 769 | * 8 2 |
| 770 | * 24 2 |
| 771 | * 32 4 |
| 772 | * @cliexend |
| 773 | */ |
| 774 | /* *INDENT-OFF* */ |
| 775 | VLIB_CLI_COMMAND (ip6_show_fib_command, static) = { |
| 776 | .path = "show ip6 mfib", |
| 777 | .short_help = "show ip mfib [summary] [table <table-id>] [index <fib-id>] [<grp-addr>[/<mask>]] [<grp-addr>] [<src-addr> <grp-addr>]", |
| 778 | .function = ip6_show_mfib, |
| 779 | }; |
| 780 | /* *INDENT-ON* */ |