From: Pravin B Shelar Date: Wed, 10 Oct 2012 00:13:05 +0000 (-0700) Subject: datapath: Allow GRE64 tunnels without any key. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=986390c3ab79ec7447240de539a673e3621c0bd8;p=openvswitch datapath: Allow GRE64 tunnels without any key. Now GRE64 deals with tunnel with no key and tunnel with zero key as a same. This behaviour is different than standard GRE. Signed-off-by: Pravin B Shelar Acked-by: Jesse Gross --- diff --git a/datapath/vport-gre.c b/datapath/vport-gre.c index 4000c749..e3a190f5 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--;