From 09d0a5285d69035c52309bee7d5b54e224a24c67 Mon Sep 17 00:00:00 2001 From: Justin Pettit Date: Thu, 12 Mar 2009 17:32:33 -0700 Subject: [PATCH] Don't send mgmt OpenFlow messages if mgmt_rconn isn't set. In some circumstances we try to send a configuration update to the controller, regardless of whether we're actually connected. This fixes that and warns if others try to do similar things. --- vswitchd/mgmt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vswitchd/mgmt.c b/vswitchd/mgmt.c index 4e1130c7..22eaf7e8 100644 --- a/vswitchd/mgmt.c +++ b/vswitchd/mgmt.c @@ -162,7 +162,7 @@ mgmt_reconfigure(void) * resent automatically. If we're not reconnecting and the * config file has changed, we need to notify the controller of * changes. */ - if (cfg_updated) { + if (cfg_updated && mgmt_rconn) { send_config_update(0, false); } return; @@ -223,6 +223,11 @@ send_openflow_buffer(struct ofpbuf *buffer) { int retval; + if (!mgmt_rconn) { + VLOG_ERR("attempt to send openflow packet with no rconn\n"); + return EINVAL; + } + update_openflow_length(buffer); retval = rconn_send_with_limit(mgmt_rconn, buffer, txqlen, TXQ_LIMIT); if (retval) { -- 2.30.2