While adding support for a tunnel with optional tunnel key, I've found problems 
handling the key configuration.  In existing tunnel code, such as GRE, the 
tunnel determines a key should be added to the packet if either 
TNL_F_OUT_KEY_ACTION is set, or else out_key is provided.  The logic below in 
tunnel.c will set the ACTION flag if NO key is provided, which means a tunnel 
with key support will always attempt to insert a key.  Patch below.


Valient Gough (1):
  datapath: fix out key action flag setting.

 datapath/tunnel.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

From 709b54eeca00ed8a2b22939980f75091ac7d3b5a Mon Sep 17 00:00:00 2001
From: Valient Gough <vgo...@pobox.com>
Date: Tue, 1 Mar 2011 15:23:31 -0800
Subject: [PATCH] datapath: fix out key action flag setting.

If an output key is specified for the tunnel, then set TNL_F_OUT_KEY_ACTION
flag.

Signed-off-by: Valient Gough <vgo...@pobox.com>
---
 datapath/tunnel.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/datapath/tunnel.c b/datapath/tunnel.c
index f1711f1..53700cc 100644
--- a/datapath/tunnel.c
+++ b/datapath/tunnel.c
@@ -1378,10 +1378,10 @@ static int tnl_set_config(struct nlattr *options, const 
struct tnl_ops *tnl_ops,
                mutable->in_key = nla_get_be64(a[ODP_TUNNEL_ATTR_IN_KEY]);
        }
 
-       if (!a[ODP_TUNNEL_ATTR_OUT_KEY])
+       if (a[ODP_TUNNEL_ATTR_OUT_KEY]) {
                mutable->flags |= TNL_F_OUT_KEY_ACTION;
-       else
                mutable->out_key = nla_get_be64(a[ODP_TUNNEL_ATTR_OUT_KEY]);
+       }
 
        mutable->tunnel_hlen = tnl_ops->hdr_len(mutable);
        if (mutable->tunnel_hlen < 0)
-- 
1.7.1

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev_openvswitch.org

Reply via email to