summaryrefslogtreecommitdiff
path: root/include/net/vxlan.h
diff options
context:
space:
mode:
authorChris Zankel <chris@zankel.net>2014-12-16 07:09:06 +0300
committerChris Zankel <chris@zankel.net>2014-12-16 07:09:06 +0300
commit865566ed33f08637c3486b4d301e96a9064ad2eb (patch)
treedfa26622c8feaa57153d87d207133f01aff5858b /include/net/vxlan.h
parentc0d7aa07504a8f4abd7b02b9144c4a92b7565f45 (diff)
parentb2776bf7149bddd1f4161f14f79520f17fc1d71d (diff)
downloadlinux-865566ed33f08637c3486b4d301e96a9064ad2eb.tar.xz
Merge tag 'v3.18' into for_next
Linux 3.18
Diffstat (limited to 'include/net/vxlan.h')
-rw-r--r--include/net/vxlan.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/net/vxlan.h b/include/net/vxlan.h
index d5f59f3fc35d..57cccd0052e5 100644
--- a/include/net/vxlan.h
+++ b/include/net/vxlan.h
@@ -8,6 +8,12 @@
#define VNI_HASH_BITS 10
#define VNI_HASH_SIZE (1<<VNI_HASH_BITS)
+/* VXLAN protocol header */
+struct vxlanhdr {
+ __be32 vx_flags;
+ __be32 vx_vni;
+};
+
struct vxlan_sock;
typedef void (vxlan_rcv_t)(struct vxlan_sock *vh, struct sk_buff *skb, __be32 key);
@@ -45,6 +51,18 @@ int vxlan_xmit_skb(struct vxlan_sock *vs,
__be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df,
__be16 src_port, __be16 dst_port, __be32 vni, bool xnet);
+static inline bool vxlan_gso_check(struct sk_buff *skb)
+{
+ if ((skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL) &&
+ (skb->inner_protocol_type != ENCAP_TYPE_ETHER ||
+ skb->inner_protocol != htons(ETH_P_TEB) ||
+ (skb_inner_mac_header(skb) - skb_transport_header(skb) !=
+ sizeof(struct udphdr) + sizeof(struct vxlanhdr))))
+ return false;
+
+ return true;
+}
+
/* IP header + UDP + VXLAN + Ethernet header */
#define VXLAN_HEADROOM (20 + 8 + 8 + 14)
/* IPv6 header + UDP + VXLAN + Ethernet header */