aboutsummaryrefslogtreecommitdiffstats
path: root/vnet
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2016-05-31 15:53:44 +0300
committerChris Luke <chris_luke@cable.comcast.com>2016-05-31 19:38:50 +0000
commit1d3b2abc2cf9058b908175c330792105f935d54f (patch)
tree2be88df85ab12132894e0dda8e4bfd44239414d7 /vnet
parent58f886ab9a2dd8d3f5bdcb34fd1c4fde212ede97 (diff)
Fix hash table bogus read in ip6 vxlan-gpe
- consistent use of hash_*_mem methods. - tunnel setup copies the key from the wrong location - remove extraneous storage for keys copied from the vxlan node that is not applicable here Change-Id: I419fd30a52ba387104abe467c296de85233823d1 Signed-off-by: Florin Coras <fcoras@cisco.com> Signed-off-by: Chris Luke <chrisy@flirble.org>
Diffstat (limited to 'vnet')
-rw-r--r--vnet/vnet/vxlan-gpe/vxlan_gpe.c11
-rw-r--r--vnet/vnet/vxlan-gpe/vxlan_gpe.h5
2 files changed, 3 insertions, 13 deletions
diff --git a/vnet/vnet/vxlan-gpe/vxlan_gpe.c b/vnet/vnet/vxlan-gpe/vxlan_gpe.c
index e6565f4379b..2baf182888f 100644
--- a/vnet/vnet/vxlan-gpe/vxlan_gpe.c
+++ b/vnet/vnet/vxlan-gpe/vxlan_gpe.c
@@ -228,7 +228,7 @@ int vnet_vxlan_gpe_add_del_tunnel
key6.remote.as_u64[1] = a->remote.ip6.as_u64[1];
key6.vni = clib_host_to_net_u32 (a->vni << 8);
- p = hash_get(gm->vxlan6_gpe_tunnel_by_key, &key6);
+ p = hash_get_mem(gm->vxlan6_gpe_tunnel_by_key, &key6);
}
if (a->is_add)
@@ -250,11 +250,6 @@ int vnet_vxlan_gpe_add_del_tunnel
else foreach_copy_ipv6
#undef _
- if (a->is_ip6) {
- /* copy the key */
- t->key6 = key6;
- }
-
if (!a->is_ip6) t->flags |= VXLAN_GPE_TUNNEL_IS_IPV4;
if (!a->is_ip6) {
@@ -279,8 +274,8 @@ int vnet_vxlan_gpe_add_del_tunnel
else
{
key6_copy = clib_mem_alloc (sizeof (*key6_copy));
- clib_memcpy (key6_copy, &key4, sizeof (*key6_copy));
- hash_set_mem (gm->vxlan4_gpe_tunnel_by_key, key6_copy,
+ clib_memcpy (key6_copy, &key6, sizeof (*key6_copy));
+ hash_set_mem (gm->vxlan6_gpe_tunnel_by_key, key6_copy,
t - gm->tunnels);
}
diff --git a/vnet/vnet/vxlan-gpe/vxlan_gpe.h b/vnet/vnet/vxlan-gpe/vxlan_gpe.h
index be420b54f6d..c733e217b80 100644
--- a/vnet/vnet/vxlan-gpe/vxlan_gpe.h
+++ b/vnet/vnet/vxlan-gpe/vxlan_gpe.h
@@ -90,11 +90,6 @@ typedef struct {
u32 hw_if_index;
u32 sw_if_index;
- union { /* storage for the hash key */
- vxlan4_gpe_tunnel_key_t key4;
- vxlan6_gpe_tunnel_key_t key6;
- };
-
/* flags */
u32 flags;
} vxlan_gpe_tunnel_t;