[ovs-dev] [PATCH] vxlan: Support for receiving "ethernet over VXLAN-gpe" packets.

Pritesh Kothari pritesh.kothari at cisco.com
Mon Mar 3 23:27:49 UTC 2014


Current VXLAN VTEP receives only VXLAN packets and ethernet over VXLAN-gpe [1]
packets are rejected. This patch adds support for receiving "ethernet over
VXLAN-gpe" packets which have same inner ethernet frame but a different VXLAN
and VXLAN-gpe headers.

[1] https://tools.ietf.org/html/draft-quinn-vxlan-gpe-02

Signed-off-by: Pritesh Kothari <pritesh.kothari at cisco.com>
---
 datapath/linux/compat/vxlan.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/datapath/linux/compat/vxlan.c b/datapath/linux/compat/vxlan.c
index 64877e0..aec291e 100644
--- a/datapath/linux/compat/vxlan.c
+++ b/datapath/linux/compat/vxlan.c
@@ -59,6 +59,7 @@
 #define VXLAN_HLEN (sizeof(struct udphdr) + sizeof(struct vxlanhdr))
 
 #define VXLAN_FLAGS 0x08000000	/* struct vxlanhdr.vx_flags required value. */
+#define VXLAN_GPE_FLAGS 0x0C006558	/* Flags for ethernet over VXLAN-gpe */
 
 /* VXLAN protocol header */
 struct vxlanhdr {
@@ -76,11 +77,15 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
 	if (!pskb_may_pull(skb, VXLAN_HLEN))
 		goto error;
 
-	/* Return packets with reserved bits set */
+	/* Return packets with reserved bits set for VXLAN.
+	 * Return non-ethernet packets for VXLAN-gpe until non
+	 * ethernet packets are supported here.
+	 */
 	vxh = (struct vxlanhdr *)(udp_hdr(skb) + 1);
-	if (vxh->vx_flags != htonl(VXLAN_FLAGS) ||
+	if (!(vxh->vx_flags == htonl(VXLAN_FLAGS) ||
+	      vxh->vx_flags == htonl(VXLAN_GPE_FLAGS)) ||
 	    (vxh->vx_vni & htonl(0xff))) {
-		pr_warn("invalid vxlan flags=%#x vni=%#x\n",
+		pr_warn("invalid vxlan(-gpe) flags=%#x vni=%#x\n",
 			ntohl(vxh->vx_flags), ntohl(vxh->vx_vni));
 		goto error;
 	}
-- 
1.7.9.5




More information about the dev mailing list