summaryrefslogtreecommitdiff
path: root/include/net/vxlan.h
diff options
context:
space:
mode:
authorJiri Benc <jbenc@redhat.com>2016-02-18 18:19:29 (GMT)
committerDavid S. Miller <davem@davemloft.net>2016-02-18 18:55:24 (GMT)
commit07dabf20d9867710b90b91108b2adcd448773e25 (patch)
tree5fba2742a7df7451a1127c38b475f347623b6104 /include/net/vxlan.h
parentf169af2cdc069f5c7a6bce8e565728b841ae56e0 (diff)
downloadlinux-07dabf20d9867710b90b91108b2adcd448773e25.tar.xz
vxlan: tun_id is 64bit, not 32bit
The tun_id field in struct ip_tunnel_key is __be64, not __be32. We need to convert the vni to tun_id correctly. Fixes: 54bfd872bf16 ("vxlan: keep flags and vni in network byte order") Reported-by: Paolo Abeni <pabeni@redhat.com> Tested-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Jiri Benc <jbenc@redhat.com> Acked-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/vxlan.h')
-rw-r--r--include/net/vxlan.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/net/vxlan.h b/include/net/vxlan.h
index 1b85a3b..748083d 100644
--- a/include/net/vxlan.h
+++ b/include/net/vxlan.h
@@ -294,6 +294,15 @@ static inline __be32 vxlan_tun_id_to_vni(__be64 tun_id)
#endif
}
+static inline __be64 vxlan_vni_to_tun_id(__be32 vni)
+{
+#if defined(__BIG_ENDIAN)
+ return (__be64)vni;
+#else
+ return (__be64)vni << 32;
+#endif
+}
+
static inline size_t vxlan_rco_start(__be32 vni_field)
{
return be32_to_cpu(vni_field & VXLAN_RCO_MASK) << VXLAN_RCO_SHIFT;