[ovs-dev] [tunnel hdr len: 1/1] datapath: compute header length only after options are set

Valient Gough valient at gmail.com
Fri Feb 25 06:09:24 UTC 2011


Valient Gough (1):
  datapath: call tnl_ops only after setting options

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

>From a141c2cc52c18e170bd48e265719e02b5b47b2a4 Mon Sep 17 00:00:00 2001
From: Valient Gough <vgough at pobox.com>
Date: Thu, 24 Feb 2011 21:45:18 -0800
Subject: [PATCH] datapath: call tnl_ops only after setting options

Calling methods in tnl_ops should be done only after initializing the tunnel
configuration options.  This patch moves the hdr_len call after the output key
setup.

Signed-off-by: Valient Gough <vgough at pobox.com>
---
 datapath/tunnel.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/datapath/tunnel.c b/datapath/tunnel.c
index a0d9fd9..541b190 100644
--- a/datapath/tunnel.c
+++ b/datapath/tunnel.c
@@ -1369,12 +1369,6 @@ static int tnl_set_config(struct nlattr
*options, const struct tnl_ops *tnl_ops,
 	if (a[ODP_TUNNEL_ATTR_TTL])
 		mutable->ttl = nla_get_u8(a[ODP_TUNNEL_ATTR_TTL]);

-	mutable->tunnel_hlen = tnl_ops->hdr_len(mutable);
-	if (mutable->tunnel_hlen < 0)
-		return mutable->tunnel_hlen;
-
-	mutable->tunnel_hlen += sizeof(struct iphdr);
-
 	mutable->tunnel_type = tnl_ops->tunnel_type;
 	if (!a[ODP_TUNNEL_ATTR_IN_KEY]) {
 		mutable->tunnel_type |= TNL_T_KEY_MATCH;
@@ -1388,6 +1382,12 @@ static int tnl_set_config(struct nlattr
*options, const struct tnl_ops *tnl_ops,
 		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)
+		return mutable->tunnel_hlen;
+
+	mutable->tunnel_hlen += sizeof(struct iphdr);

 	old_vport = tnl_find_port(mutable->saddr, mutable->daddr,
 				  mutable->in_key, mutable->tunnel_type,
-- 
1.7.1




More information about the dev mailing list