From 2b9453c55a7294d8eedf126d616a608c32be0e36 Mon Sep 17 00:00:00 2001 From: Jon Loeliger Date: Thu, 1 Feb 2018 12:10:40 -0600 Subject: [PATCH] vxlan: Lookup FIB in either IPv4 or IPv6 families. Prior to this commit, the VXLAN "create" API assumed the vrf_id belonged to only the IPv4 FIB tables space. With this commit, the FIB table is found in either the IPv4 or IPv6 table as determined by the is_ipv6 flag. This follows the same pattern that was already being done in the CLI code for the VXLAN "create" command. Change-Id: I35d5e37db24efa858e4696dc2c004fa64bb4a4a8 Signed-off-by: Jon Loeliger --- src/vnet/vxlan/vxlan_api.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/vnet/vxlan/vxlan_api.c b/src/vnet/vxlan/vxlan_api.c index 1227f883e3e..5c5e946343e 100644 --- a/src/vnet/vxlan/vxlan_api.c +++ b/src/vnet/vxlan/vxlan_api.c @@ -70,10 +70,11 @@ static void vl_api_vxlan_add_del_tunnel_t_handler { vl_api_vxlan_add_del_tunnel_reply_t *rmp; int rv = 0; - ip4_main_t *im = &ip4_main; + u32 fib_index; - uword *p = hash_get (im->fib_index_by_table_id, ntohl (mp->encap_vrf_id)); - if (!p) + fib_index = fib_table_find (fib_ip_proto (mp->is_ipv6), + ntohl (mp->encap_vrf_id)); + if (fib_index == ~0) { rv = VNET_API_ERROR_NO_SUCH_FIB; goto out; @@ -83,7 +84,7 @@ static void vl_api_vxlan_add_del_tunnel_t_handler .is_add = mp->is_add, .is_ip6 = mp->is_ipv6, .mcast_sw_if_index = ntohl (mp->mcast_sw_if_index), - .encap_fib_index = p[0], + .encap_fib_index = fib_index, .decap_next_index = ntohl (mp->decap_next_index), .vni = ntohl (mp->vni), .dst = to_ip46 (mp->is_ipv6, mp->dst_address), -- 2.16.6