diff options
author | Neale Ranns <nranns@cisco.com> | 2020-04-03 07:46:28 +0000 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2020-04-10 12:21:30 +0000 |
commit | 91fd910d7d7611a28d1f85482ed5d5c3ee6a8853 (patch) | |
tree | f2594418e3e7e80a69f16491da15a7af152feb1a /src/vnet/geneve/geneve.c | |
parent | ae9c45938bdf6e180f83f02aed31113e60db20a9 (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>
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 52664b389a4..1e04c662431 100644 --- a/src/vnet/geneve/geneve.c +++ b/src/vnet/geneve/geneve.c @@ -292,14 +292,15 @@ geneve_decap_next_is_valid (geneve_main_t * vxm, u32 is_ip6, return decap_next_index < r->n_next_nodes; } -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) @@ -352,15 +353,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); } |