diff options
author | Nathan Skrzypczak <nathan.skrzypczak@gmail.com> | 2021-08-16 16:13:40 +0200 |
---|---|---|
committer | Beno�t Ganne <bganne@cisco.com> | 2021-09-13 13:54:59 +0000 |
commit | 7854b46f7789aae662f01fc29f4dd222a67bfe3d (patch) | |
tree | 607736025d42db84ac52558a08d18ba5431987b0 /src | |
parent | 006bbc4945bc7df58c3e631f5626acb2555aa171 (diff) |
interface: fix init fib_index_by_sw_if_index
Type: fix
The init of fib_index_by_sw_if_index wasn't
setting default value to 0. Which we now
need for setting interfaces unnumbered
Change-Id: Ie5be9b5e5373ef055557a871ad4d1c45fbfc1dee
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/lisp/lisp-gpe/interface.c | 2 | ||||
-rw-r--r-- | src/plugins/lisp/lisp-gpe/lisp_gpe_sub_interface.c | 2 | ||||
-rw-r--r-- | src/plugins/unittest/bier_test.c | 2 | ||||
-rw-r--r-- | src/plugins/unittest/fib_test.c | 12 | ||||
-rw-r--r-- | src/plugins/unittest/mfib_test.c | 8 | ||||
-rw-r--r-- | src/vnet/gre/interface.c | 4 | ||||
-rw-r--r-- | src/vnet/interface.c | 10 | ||||
-rw-r--r-- | src/vnet/interface_api.c | 6 | ||||
-rw-r--r-- | src/vnet/ip/ip4_forward.c | 17 | ||||
-rw-r--r-- | src/vnet/ip/ip6_forward.c | 18 | ||||
-rw-r--r-- | src/vnet/ipip/ipip.c | 4 | ||||
-rw-r--r-- | src/vnet/mfib/ip4_mfib.c | 1 | ||||
-rw-r--r-- | src/vnet/mfib/ip6_mfib.c | 1 |
13 files changed, 18 insertions, 69 deletions
diff --git a/src/plugins/lisp/lisp-gpe/interface.c b/src/plugins/lisp/lisp-gpe/interface.c index 1d2abaf3f90..d73471d6b3d 100644 --- a/src/plugins/lisp/lisp-gpe/interface.c +++ b/src/plugins/lisp/lisp-gpe/interface.c @@ -507,13 +507,11 @@ lisp_gpe_iface_set_table (u32 sw_if_index, u32 table_id) fib_index = fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP4, table_id, FIB_SOURCE_LISP); - vec_validate (ip4_main.fib_index_by_sw_if_index, sw_if_index); ip4_main.fib_index_by_sw_if_index[sw_if_index] = fib_index; ip4_sw_interface_enable_disable (sw_if_index, 1); fib_index = fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP6, table_id, FIB_SOURCE_LISP); - vec_validate (ip6_main.fib_index_by_sw_if_index, sw_if_index); ip6_main.fib_index_by_sw_if_index[sw_if_index] = fib_index; ip6_sw_interface_enable_disable (sw_if_index, 1); } diff --git a/src/plugins/lisp/lisp-gpe/lisp_gpe_sub_interface.c b/src/plugins/lisp/lisp-gpe/lisp_gpe_sub_interface.c index 9c48c0064ca..aea84a3fa92 100644 --- a/src/plugins/lisp/lisp-gpe/lisp_gpe_sub_interface.c +++ b/src/plugins/lisp/lisp-gpe/lisp_gpe_sub_interface.c @@ -93,14 +93,12 @@ lisp_gpe_sub_interface_set_table (u32 sw_if_index, u32 table_id) FIB_SOURCE_LISP); ASSERT (FIB_NODE_INDEX_INVALID != fib_index); - vec_validate (ip4_main.fib_index_by_sw_if_index, sw_if_index); ip4_main.fib_index_by_sw_if_index[sw_if_index] = fib_index; fib_index = fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP6, table_id, FIB_SOURCE_LISP); ASSERT (FIB_NODE_INDEX_INVALID != fib_index); - vec_validate (ip6_main.fib_index_by_sw_if_index, sw_if_index); ip6_main.fib_index_by_sw_if_index[sw_if_index] = fib_index; } diff --git a/src/plugins/unittest/bier_test.c b/src/plugins/unittest/bier_test.c index 9b4ba67e7cd..f1f9e03f461 100644 --- a/src/plugins/unittest/bier_test.c +++ b/src/plugins/unittest/bier_test.c @@ -134,8 +134,6 @@ bier_test_mk_intf (u32 ninterfaces) tm->hw[i] = vnet_get_hw_interface(vnet_get_main(), tm->hw_if_indicies[i]); - vec_validate (ip4_main.fib_index_by_sw_if_index, tm->hw[i]->sw_if_index); - vec_validate (ip6_main.fib_index_by_sw_if_index, tm->hw[i]->sw_if_index); ip4_main.fib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0; ip6_main.fib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0; error = vnet_sw_interface_set_flags(vnet_get_main(), diff --git a/src/plugins/unittest/fib_test.c b/src/plugins/unittest/fib_test.c index 76b675bca83..f62f232580d 100644 --- a/src/plugins/unittest/fib_test.c +++ b/src/plugins/unittest/fib_test.c @@ -158,10 +158,6 @@ fib_test_mk_intf (u32 ninterfaces) VNET_HW_INTERFACE_FLAG_LINK_UP); tm->hw[i] = vnet_get_hw_interface(vnet_get_main(), tm->hw_if_indicies[i]); - vec_validate (ip4_main.fib_index_by_sw_if_index, - tm->hw[i]->sw_if_index); - vec_validate (ip6_main.fib_index_by_sw_if_index, - tm->hw[i]->sw_if_index); ip4_main.fib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0; ip6_main.fib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0; @@ -5341,7 +5337,6 @@ fib_test_ae (void) }, }; - vec_validate(im->fib_index_by_sw_if_index, tm->hw[0]->sw_if_index); im->fib_index_by_sw_if_index[tm->hw[0]->sw_if_index] = fib_index; dpo_drop = drop_dpo_get(DPO_PROTO_IP4); @@ -5888,8 +5883,6 @@ fib_test_pref (void) }, }; - vec_validate(im->fib_index_by_sw_if_index, tm->hw[2]->sw_if_index); - for (i = 0; i <= 2; i++) im->fib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0; @@ -6365,7 +6358,6 @@ fib_test_label (void) FIB_TEST((0 == adj_nbr_db_size()), "ADJ DB size is %d", adj_nbr_db_size()); - vec_validate(im->fib_index_by_sw_if_index, tm->hw[0]->sw_if_index); im->fib_index_by_sw_if_index[tm->hw[0]->sw_if_index] = fib_index; fib_table_entry_update_one_path(fib_index, &local0_pfx, @@ -6411,7 +6403,6 @@ fib_test_label (void) }, }; - vec_validate(im->fib_index_by_sw_if_index, tm->hw[1]->sw_if_index); im->fib_index_by_sw_if_index[tm->hw[1]->sw_if_index] = fib_index; fib_table_entry_update_one_path(fib_index, &local1_pfx, @@ -9136,9 +9127,6 @@ fib_test_inherit (void) im6 = &ip6_main; res = 0; - vec_validate(im4->fib_index_by_sw_if_index, tm->hw[2]->sw_if_index); - vec_validate(im6->fib_index_by_sw_if_index, tm->hw[2]->sw_if_index); - for (i = 0; i <= 2; i++) { im4->fib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0; diff --git a/src/plugins/unittest/mfib_test.c b/src/plugins/unittest/mfib_test.c index c456d59d7db..373ea485969 100644 --- a/src/plugins/unittest/mfib_test.c +++ b/src/plugins/unittest/mfib_test.c @@ -139,17 +139,9 @@ mfib_test_mk_intf (u32 ninterfaces) VNET_HW_INTERFACE_FLAG_LINK_UP); tm->hw[i] = vnet_get_hw_interface(vnet_get_main(), tm->hw_if_indicies[i]); - vec_validate (ip4_main.fib_index_by_sw_if_index, - tm->hw[i]->sw_if_index); - vec_validate (ip6_main.fib_index_by_sw_if_index, - tm->hw[i]->sw_if_index); ip4_main.fib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0; ip6_main.fib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0; - vec_validate (ip4_main.mfib_index_by_sw_if_index, - tm->hw[i]->sw_if_index); - vec_validate (ip6_main.mfib_index_by_sw_if_index, - tm->hw[i]->sw_if_index); ip4_main.mfib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0; ip6_main.mfib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0; diff --git a/src/vnet/gre/interface.c b/src/vnet/gre/interface.c index f2c679cb9b5..0251ced598f 100644 --- a/src/vnet/gre/interface.c +++ b/src/vnet/gre/interface.c @@ -367,8 +367,6 @@ vnet_gre_tunnel_add (vnet_gre_tunnel_add_del_args_t * a, { gre_main_t *gm = &gre_main; vnet_main_t *vnm = gm->vnet_main; - ip4_main_t *im4 = &ip4_main; - ip6_main_t *im6 = &ip6_main; gre_tunnel_t *t; vnet_hw_interface_t *hi; u32 hw_if_index, sw_if_index; @@ -451,13 +449,11 @@ vnet_gre_tunnel_add (vnet_gre_tunnel_add_del_args_t * a, if (!is_ipv6) { - vec_validate (im4->fib_index_by_sw_if_index, sw_if_index); hi->min_packet_bytes = 64 + sizeof (gre_header_t) + sizeof (ip4_header_t); } else { - vec_validate (im6->fib_index_by_sw_if_index, sw_if_index); hi->min_packet_bytes = 64 + sizeof (gre_header_t) + sizeof (ip6_header_t); } diff --git a/src/vnet/interface.c b/src/vnet/interface.c index 20afce1fb6e..d0f94b101ad 100644 --- a/src/vnet/interface.c +++ b/src/vnet/interface.c @@ -1637,16 +1637,6 @@ static int vnet_sw_interface_check_table_same (u32 unnumbered_sw_if_index, u32 ip_sw_if_index) { - vec_validate (ip4_main.fib_index_by_sw_if_index, unnumbered_sw_if_index); - vec_validate (ip4_main.mfib_index_by_sw_if_index, unnumbered_sw_if_index); - vec_validate (ip6_main.fib_index_by_sw_if_index, unnumbered_sw_if_index); - vec_validate (ip6_main.mfib_index_by_sw_if_index, unnumbered_sw_if_index); - - vec_validate (ip4_main.fib_index_by_sw_if_index, ip_sw_if_index); - vec_validate (ip4_main.mfib_index_by_sw_if_index, ip_sw_if_index); - vec_validate (ip6_main.fib_index_by_sw_if_index, ip_sw_if_index); - vec_validate (ip6_main.mfib_index_by_sw_if_index, ip_sw_if_index); - if (ip4_main.fib_index_by_sw_if_index[unnumbered_sw_if_index] != ip4_main.fib_index_by_sw_if_index[ip_sw_if_index]) return VNET_API_ERROR_UNEXPECTED_INTF_STATE; diff --git a/src/vnet/interface_api.c b/src/vnet/interface_api.c index f9e03b9f1ea..80a3058303c 100644 --- a/src/vnet/interface_api.c +++ b/src/vnet/interface_api.c @@ -518,9 +518,6 @@ ip_table_bind (fib_protocol_t fproto, })); /* *INDENT-ON* */ - vec_validate (ip6_main.fib_index_by_sw_if_index, sw_if_index); - vec_validate (ip6_main.mfib_index_by_sw_if_index, sw_if_index); - /* * tell those that are interested that the binding is changing. */ @@ -566,9 +563,6 @@ ip_table_bind (fib_protocol_t fproto, })); /* *INDENT-ON* */ - vec_validate (ip4_main.fib_index_by_sw_if_index, sw_if_index); - vec_validate (ip4_main.mfib_index_by_sw_if_index, sw_if_index); - /* * tell those that are interested that the binding is changing. */ diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c index 57ad658b83f..35aff63e736 100644 --- a/src/vnet/ip/ip4_forward.c +++ b/src/vnet/ip/ip4_forward.c @@ -657,7 +657,6 @@ ip4_add_del_interface_address_internal (vlib_main_t * vm, if (error) return error; - vec_validate (im->fib_index_by_sw_if_index, sw_if_index); ip4_addr_fib_init (&ip4_af, address, vec_elt (im->fib_index_by_sw_if_index, sw_if_index)); vec_add1 (addr_fib, ip4_af); @@ -885,9 +884,6 @@ ip4_sw_interface_admin_up_down (vnet_main_t * vnm, u32 sw_if_index, u32 flags) ip4_address_t *a; u32 is_admin_up, fib_index; - /* Fill in lookup tables with default table (0). */ - vec_validate (im->fib_index_by_sw_if_index, sw_if_index); - vec_validate_init_empty (im-> lookup_main.if_address_pool_index_by_sw_if_index, sw_if_index, ~0); @@ -1064,11 +1060,16 @@ ip4_sw_interface_add_del (vnet_main_t * vnm, u32 sw_if_index, u32 is_add) { ip4_main_t *im = &ip4_main; - /* Fill in lookup tables with default table (0). */ - vec_validate (im->fib_index_by_sw_if_index, sw_if_index); - vec_validate (im->mfib_index_by_sw_if_index, sw_if_index); + vec_validate_init_empty (im->fib_index_by_sw_if_index, sw_if_index, ~0); + vec_validate_init_empty (im->mfib_index_by_sw_if_index, sw_if_index, ~0); - if (!is_add) + if (is_add) + { + /* Fill in lookup tables with default table (0). */ + im->fib_index_by_sw_if_index[sw_if_index] = 0; + im->mfib_index_by_sw_if_index[sw_if_index] = 0; + } + else { ip4_main_t *im4 = &ip4_main; ip_lookup_main_t *lm4 = &im4->lookup_main; diff --git a/src/vnet/ip/ip6_forward.c b/src/vnet/ip/ip6_forward.c index f1de446a504..8daf2614c15 100644 --- a/src/vnet/ip/ip6_forward.c +++ b/src/vnet/ip/ip6_forward.c @@ -351,9 +351,6 @@ ip6_add_del_interface_address (vlib_main_t * vm, return (NULL); } - vec_validate (im->fib_index_by_sw_if_index, sw_if_index); - vec_validate (im->mfib_index_by_sw_if_index, sw_if_index); - ip6_addr_fib_init (&ip6_af, address, vec_elt (im->fib_index_by_sw_if_index, sw_if_index)); vec_add1 (addr_fib, ip6_af); @@ -528,9 +525,6 @@ ip6_sw_interface_admin_up_down (vnet_main_t * vnm, u32 sw_if_index, u32 flags) ip6_address_t *a; u32 is_admin_up, fib_index; - /* Fill in lookup tables with default table (0). */ - vec_validate (im->fib_index_by_sw_if_index, sw_if_index); - vec_validate_init_empty (im-> lookup_main.if_address_pool_index_by_sw_if_index, sw_if_index, ~0); @@ -692,10 +686,16 @@ ip6_sw_interface_add_del (vnet_main_t * vnm, u32 sw_if_index, u32 is_add) { ip6_main_t *im = &ip6_main; - vec_validate (im->fib_index_by_sw_if_index, sw_if_index); - vec_validate (im->mfib_index_by_sw_if_index, sw_if_index); + vec_validate_init_empty (im->fib_index_by_sw_if_index, sw_if_index, ~0); + vec_validate_init_empty (im->mfib_index_by_sw_if_index, sw_if_index, ~0); - if (!is_add) + if (is_add) + { + /* Fill in lookup tables with default table (0). */ + im->fib_index_by_sw_if_index[sw_if_index] = 0; + im->mfib_index_by_sw_if_index[sw_if_index] = 0; + } + else { /* Ensure that IPv6 is disabled */ ip6_main_t *im6 = &ip6_main; diff --git a/src/vnet/ipip/ipip.c b/src/vnet/ipip/ipip.c index e6ea3ebe79d..5dbe85a1c5b 100644 --- a/src/vnet/ipip/ipip.c +++ b/src/vnet/ipip/ipip.c @@ -726,8 +726,6 @@ ipip_add_tunnel (ipip_transport_t transport, { ipip_main_t *gm = &ipip_main; vnet_main_t *vnm = gm->vnet_main; - ip4_main_t *im4 = &ip4_main; - ip6_main_t *im6 = &ip6_main; ipip_tunnel_t *t; vnet_hw_interface_t *hi; u32 hw_if_index, sw_if_index; @@ -788,12 +786,10 @@ ipip_add_tunnel (ipip_transport_t transport, if (t->transport == IPIP_TRANSPORT_IP4) { - vec_validate (im4->fib_index_by_sw_if_index, sw_if_index); hi->min_packet_bytes = 64 + sizeof (ip4_header_t); } else { - vec_validate (im6->fib_index_by_sw_if_index, sw_if_index); hi->min_packet_bytes = 64 + sizeof (ip6_header_t); } diff --git a/src/vnet/mfib/ip4_mfib.c b/src/vnet/mfib/ip4_mfib.c index 9c64c4ae92c..c1a9740b3bb 100644 --- a/src/vnet/mfib/ip4_mfib.c +++ b/src/vnet/mfib/ip4_mfib.c @@ -142,7 +142,6 @@ ip4_mfib_interface_enable_disable (u32 sw_if_index, int is_enable) u32 mfib_index; int ii; - vec_validate (ip4_main.mfib_index_by_sw_if_index, sw_if_index); mfib_index = ip4_mfib_table_get_index_for_sw_if_index(sw_if_index); for (ii = 0; ii < ARRAY_LEN(ip4_specials); ii++) diff --git a/src/vnet/mfib/ip6_mfib.c b/src/vnet/mfib/ip6_mfib.c index bbab7ae2214..37ae3776d89 100644 --- a/src/vnet/mfib/ip6_mfib.c +++ b/src/vnet/mfib/ip6_mfib.c @@ -246,7 +246,6 @@ ip6_mfib_interface_enable_disable (u32 sw_if_index, int is_enable) }; u32 mfib_index; - vec_validate (ip6_main.mfib_index_by_sw_if_index, sw_if_index); mfib_index = ip6_mfib_table_get_index_for_sw_if_index(sw_if_index); if (is_enable) |