[ovs-dev] [PATCH] datapath: Fix mysterious GRE-over-IPSEC problems.

Ben Pfaff blp at nicira.com
Thu Mar 3 00:49:35 UTC 2011


We've noticed that packets that go up to userspace and then back down to
the kernel and then enter an GRE tunnel that is then ESP encapsulated
by IPSEC end up with a bad ESP "next header" value: it ends up as zero
instead of 0x2f (IPPROTO_GRE).  I'm still investigating but in the
meantime the "big hammer" of just putting packets from userspace into
a freshly allocated skb fixes the problem.

Signed-off-by: Ben Pfaff <blp at nicira.com>
Bug #4769.
---
 datapath/datapath.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/datapath/datapath.c b/datapath/datapath.c
index e06c3b0..a00dfef 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -676,6 +676,7 @@ static int odp_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
 	struct datapath *dp;
 	struct ethhdr *eth;
 	bool is_frag;
+	int len;
 	int err;
 
 	err = -EINVAL;
@@ -688,12 +689,14 @@ static int odp_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
 	if (err)
 		goto exit;
 
-	packet = skb_clone(skb, GFP_KERNEL);
+	len = nla_len(a[ODP_PACKET_ATTR_PACKET]);
+	packet = __dev_alloc_skb(NET_IP_ALIGN + len, GFP_KERNEL);
 	err = -ENOMEM;
 	if (!packet)
 		goto exit;
-	packet->data = nla_data(a[ODP_PACKET_ATTR_PACKET]);
-	packet->len = nla_len(a[ODP_PACKET_ATTR_PACKET]);
+	skb_reserve(packet, NET_IP_ALIGN);
+
+	memcpy(__skb_put(packet, len), nla_data(a[ODP_PACKET_ATTR_PACKET]), len);
 
 	skb_reset_mac_header(packet);
 	eth = eth_hdr(packet);
-- 
1.7.1





More information about the dev mailing list