diff options
author | Neale Ranns <nranns@cisco.com> | 2020-04-03 07:46:28 +0000 |
---|---|---|
committer | Neale Ranns <nranns@cisco.com> | 2020-04-10 09:49:55 -0400 |
commit | 8c6efc06104ebccf4915d0d10c399292bac55874 (patch) | |
tree | dc9ef15ba24cc9ddfe6bfe986a65ad44a9af2a7b /src/vnet/geneve/geneve.c | |
parent | 5a4ee8d824d1d49d405832b4251a5282e3cc9373 (diff) |
geneve: Fix the byte swapping for the VNI
Type: fix
- swipe away the vomit indent left last time.
- add tests for VNIs > 16bit
Change-Id: I2d1f591bfb9d7a18996c38969365a509168d4193
Signed-off-by: Neale Ranns <nranns@cisco.com>
(cherry picked from commit 91fd910d7d7611a28d1f85482ed5d5c3ee6a8853)
Diffstat (limited to 'src/vnet/geneve/geneve.c')
-rw-r--r-- | src/vnet/geneve/geneve.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/vnet/geneve/geneve.c b/src/vnet/geneve/geneve.c index 0c551a0545e..f04917a71a4 100644 --- a/src/vnet/geneve/geneve.c +++ b/src/vnet/geneve/geneve.c @@ -321,14 +321,15 @@ vtep_addr_unref (ip46_address_t * ip) return 0; } -typedef CLIB_PACKED (union - { - struct - { - fib_node_index_t mfib_entry_index; - adj_index_t mcast_adj_index; - }; u64 as_u64; - }) mcast_shared_t; +typedef union +{ + struct + { + fib_node_index_t mfib_entry_index; + adj_index_t mcast_adj_index; + }; + u64 as_u64; +} __clib_packed mcast_shared_t; static inline mcast_shared_t mcast_shared_get (ip46_address_t * ip) @@ -381,15 +382,13 @@ int vnet_geneve_add_del_tunnel if (!is_ip6) { key4.remote = a->remote.ip4.as_u32; - key4.vni = - clib_host_to_net_u32 ((a->vni << GENEVE_VNI_SHIFT) & GENEVE_VNI_MASK); + key4.vni = clib_host_to_net_u32 (a->vni << GENEVE_VNI_SHIFT); p = hash_get (vxm->geneve4_tunnel_by_key, key4.as_u64); } else { key6.remote = a->remote.ip6; - key6.vni = - clib_host_to_net_u32 ((a->vni << GENEVE_VNI_SHIFT) & GENEVE_VNI_MASK); + key6.vni = clib_host_to_net_u32 (a->vni << GENEVE_VNI_SHIFT); p = hash_get_mem (vxm->geneve6_tunnel_by_key, &key6); } |