[ovs-dev] [PATCH] datapath: Allow GRE64 tunnels without any key.

Pravin B Shelar pshelar at nicira.com
Tue Oct 9 23:31:28 UTC 2012


Now GRE64 deals with tunnel with no key and tunnel with zero key
as same. This behaviour is different than standard GRE.

Signed-off-by: Pravin B Shelar <pshelar at nicira.com>
---
 datapath/vport-gre.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/datapath/vport-gre.c b/datapath/vport-gre.c
index 4000c74..e3a190f 100644
--- a/datapath/vport-gre.c
+++ b/datapath/vport-gre.c
@@ -54,7 +54,11 @@ static int gre_hdr_len(const struct tnl_mutable_config *mutable)
 	if (mutable->flags & TNL_F_CSUM)
 		len += GRE_HEADER_SECTION;
 
-	if (mutable->out_key || mutable->flags & TNL_F_OUT_KEY_ACTION) {
+	/* Set key for GRE64 tunnels, even when key if is zero. */
+	if (mutable->out_key ||
+	    mutable->key.tunnel_type & TNL_T_PROTO_GRE64 ||
+	    mutable->flags & TNL_F_OUT_KEY_ACTION) {
+
 		len += GRE_HEADER_SECTION;
 		if (mutable->key.tunnel_type & TNL_T_PROTO_GRE64)
 			len += GRE_HEADER_SECTION;
@@ -103,7 +107,8 @@ static void gre_build_header(const struct vport *vport,
 		if (mutable->key.tunnel_type & TNL_T_PROTO_GRE64)
 			greh->flags |= GRE_SEQ;
 
-	} else if (mutable->out_key) {
+	} else if (mutable->out_key ||
+		   mutable->key.tunnel_type & TNL_T_PROTO_GRE64) {
 		greh->flags |= GRE_KEY;
 		*options = be64_get_low32(mutable->out_key);
 		if (mutable->key.tunnel_type & TNL_T_PROTO_GRE64) {
@@ -131,7 +136,8 @@ static struct sk_buff *gre_update_header(const struct vport *vport,
 		}
 		*options = be64_get_low32(OVS_CB(skb)->tun_id);
 		options--;
-	} else if (mutable->out_key) {
+	} else if (mutable->out_key ||
+		   mutable->key.tunnel_type & TNL_T_PROTO_GRE64) {
 		options--;
 		if (mutable->key.tunnel_type & TNL_T_PROTO_GRE64)
 			options--;
-- 
1.7.10




More information about the dev mailing list