[ovs-dev] [PATCH 2/3] tunnel: Log sanely in tnl_port_receive().

Ben Pfaff blp at ovn.org
Thu Dec 28 20:34:49 UTC 2017


When this function was introduced in 2012, it modified its 'flow' argument
and logged the changes (at debug level).  However, since 2013 it has no
longer modified its 'flow' argument, but the logging was still oriented
around the idea that it did.  This commit fixes up the logging to make
sense again.

This doesn't fix an actual bug that causes problems, but it does fix a
conceptual error.

Fixes: 2301f7ebc15e ("tunnel: Make tnl_port_receive() parameter 'const'.")
Signed-off-by: Ben Pfaff <blp at ovn.org>
---
 ofproto/tunnel.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/ofproto/tunnel.c b/ofproto/tunnel.c
index 9896d715a6f7..f6d266a00607 100644
--- a/ofproto/tunnel.c
+++ b/ofproto/tunnel.c
@@ -301,7 +301,6 @@ tnl_port_del(const struct ofport_dpif *ofport, odp_port_t odp_port)
 const struct ofport_dpif *
 tnl_port_receive(const struct flow *flow) OVS_EXCLUDED(rwlock)
 {
-    char *pre_flow_str = NULL;
     const struct ofport_dpif *ofport;
     struct tnl_port *tnl_port;
 
@@ -318,20 +317,11 @@ tnl_port_receive(const struct flow *flow) OVS_EXCLUDED(rwlock)
     }
 
     if (!VLOG_DROP_DBG(&dbg_rl)) {
-        pre_flow_str = flow_to_string(flow, NULL);
-    }
-
-    if (pre_flow_str) {
-        char *post_flow_str = flow_to_string(flow, NULL);
+        char *flow_str = flow_to_string(flow, NULL);
         char *tnl_str = tnl_port_fmt(tnl_port);
-        VLOG_DBG("flow received\n"
-                 "%s"
-                 " pre: %s\n"
-                 "post: %s",
-                 tnl_str, pre_flow_str, post_flow_str);
+        VLOG_DBG("tunnel port %s receive from flow %s", tnl_str, flow_str);
         free(tnl_str);
-        free(pre_flow_str);
-        free(post_flow_str);
+        free(flow_str);
     }
 
 out:
-- 
2.10.2



More information about the dev mailing list