[ovs-dev] [PATCH] datapath: tunnel: Fix gre64 tunnel when key not specified.

Pravin B Shelar pshelar at nicira.com
Thu Aug 15 00:31:57 UTC 2013


User is allowed to create tunnel without any keys.  In this
case userspace set tunnel action does not set tun-key flag
which was confusing gre64 vport header calculations.  Following
patch fixes it by always assuming TUNNEL_KEY parameter as we
do it with tun-seq.

Signed-off-by: Pravin B Shelar <pshelar at nicira.com>
Bug #19121
---
 datapath/vport-gre.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/datapath/vport-gre.c b/datapath/vport-gre.c
index c74f5fc..38245a7 100644
--- a/datapath/vport-gre.c
+++ b/datapath/vport-gre.c
@@ -335,17 +335,19 @@ static __be32 be64_get_high32(__be64 x)
 
 static int gre64_send(struct vport *vport, struct sk_buff *skb)
 {
-	int hlen;
+	int hlen = GRE_HEADER_SECTION +		/* GRE Hdr */
+		   GRE_HEADER_SECTION +		/* GRE Key */
+		   GRE_HEADER_SECTION;		/* GRE SEQ */
 	__be32 seq;
 
 	if (unlikely(!OVS_CB(skb)->tun_key))
 		return -EINVAL;
 
-	hlen = ip_gre_calc_hlen(OVS_CB(skb)->tun_key->tun_flags)
-	       + GRE_HEADER_SECTION;
+	if (OVS_CB(skb)->tun_key->tun_flags & TUNNEL_CSUM)
+		hlen += GRE_HEADER_SECTION;
 
 	seq = be64_get_high32(OVS_CB(skb)->tun_key->tun_id);
-	return __send(vport, skb, hlen, seq, TUNNEL_SEQ);
+	return __send(vport, skb, hlen, seq, (TUNNEL_KEY|TUNNEL_SEQ));
 }
 
 const struct vport_ops ovs_gre64_vport_ops = {
-- 
1.7.1




More information about the dev mailing list