datapath: Allow GRE64 tunnels without any key.
authorPravin B Shelar <pshelar@nicira.com>
Wed, 10 Oct 2012 00:13:05 +0000 (17:13 -0700)
committerPravin B Shelar <pshelar@nicira.com>
Wed, 10 Oct 2012 00:13:05 +0000 (17:13 -0700)
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 <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
datapath/vport-gre.c

index 4000c749b296c87e9505c6de58d1deb36fa92d7d..e3a190f50e5c7b41b4c9a1188f4e16fe366233c9 100644 (file)
@@ -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--;