summaryrefslogtreecommitdiffstats
path: root/src/vnet/vxlan/vxlan_api.c
diff options
context:
space:
mode:
authorJon Loeliger <jdl@netgate.com>2018-02-01 12:10:40 -0600
committerJon Loeliger <jdl@netgate.com>2018-02-01 14:53:28 -0600
commit2b9453c55a7294d8eedf126d616a608c32be0e36 (patch)
treebca6e94218120608c0395ce274ed3221fcfa76cb /src/vnet/vxlan/vxlan_api.c
parent735f8793bf3e8ad37c7e608663283b7d89b7101d (diff)
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 <jdl@netgate.com>
Diffstat (limited to 'src/vnet/vxlan/vxlan_api.c')
-rw-r--r--src/vnet/vxlan/vxlan_api.c9
1 files 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),