[ovs-dev] [PATCH] ovn-controller: Fix log conditions for unexpected openflow messages.

Han Zhou zhouhan at gmail.com
Wed May 17 23:13:55 UTC 2017


Currently in pinctrl.c and ofctrl.c there are similar logic to log
ignored messages, which is somehow inaccurate and confusing. For example,
OFPTYPE_PACKET_IN is handled only in pinctrl.c but in ofctrl.c it
is listed as expected input and not logged as "ignored" messages, while
it is in fact unexpected and ignored there. This patch clearup the
unnecessary "if" conditions and logs all messages that are not
expected/handled honestly, so that there will be logs for debugging
if such abnormal case really happens.

Signed-off-by: Han Zhou <zhouhan at gmail.com>
---
 ovn/controller/ofctrl.c  | 6 +-----
 ovn/controller/pinctrl.c | 2 +-
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/ovn/controller/ofctrl.c b/ovn/controller/ofctrl.c
index 417fdc9..4b4277a 100644
--- a/ovn/controller/ofctrl.c
+++ b/ovn/controller/ofctrl.c
@@ -587,11 +587,7 @@ ofctrl_recv(const struct ofp_header *oh, enum ofptype type)
     } else if (type == OFPTYPE_ERROR) {
         static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(30, 300);
         log_openflow_rl(&rl, VLL_INFO, oh, "OpenFlow error");
-    } else if (type != OFPTYPE_ECHO_REPLY &&
-               type != OFPTYPE_BARRIER_REPLY &&
-               type != OFPTYPE_PACKET_IN &&
-               type != OFPTYPE_PORT_STATUS &&
-               type != OFPTYPE_FLOW_REMOVED) {
+    } else {
         static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(30, 300);
         log_openflow_rl(&rl, VLL_DBG, oh, "OpenFlow packet ignored");
     }
diff --git a/ovn/controller/pinctrl.c b/ovn/controller/pinctrl.c
index 9ad4133..b93cf06 100644
--- a/ovn/controller/pinctrl.c
+++ b/ovn/controller/pinctrl.c
@@ -991,7 +991,7 @@ pinctrl_recv(const struct ofp_header *oh, enum ofptype type,
         set_switch_config(swconn, &config);
     } else if (type == OFPTYPE_PACKET_IN) {
         process_packet_in(oh, ctx);
-    } else if (type != OFPTYPE_ECHO_REPLY && type != OFPTYPE_BARRIER_REPLY) {
+    } else {
         if (VLOG_IS_DBG_ENABLED()) {
             static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(30, 300);
 
-- 
2.1.0



More information about the dev mailing list