summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Zhou <azhou@ovn.org>2017-09-06 15:08:10 -0700
committerAndy Zhou <azhou@ovn.org>2017-09-14 12:34:03 -0700
commit5f2c65d792bf996e1cf81b1068d742a16b2aaf94 (patch)
treeed04c46e7c18a2e8d31eb00c01b97108563413c7
parent0711d8aa370f3c5bc177371be7ca4e381befed4a (diff)
downloadopenvswitch-5f2c65d792bf996e1cf81b1068d742a16b2aaf94.tar.gz
bridge: Fix controller status update to passive connections
The bug can cause ovs-vswitchd to crash (due to assert) when it is set up with a passive controller connection. Since only active connections are kept, the passive connection status update should be ignored and not trigger asserts. Fixes: 85c55772a453 ("bridge: Fix controller status update") Reported-by: Josh Bailey <josh@faucet.nz> Signed-off-by: Andy Zhou <azhou@ovn.org> Acked-by: Joe Stringer <joe@ovn.org>
-rw-r--r--AUTHORS.rst1
-rw-r--r--vswitchd/bridge.c16
2 files changed, 12 insertions, 5 deletions
diff --git a/AUTHORS.rst b/AUTHORS.rst
index 1fc42b5ff..1f7bf53d8 100644
--- a/AUTHORS.rst
+++ b/AUTHORS.rst
@@ -388,6 +388,7 @@ Ben Basler bbasler@nicira.com
Bhargava Shastry bshastry@sec.t-labs.tu-berlin.de
Bob Ball bob.ball@citrix.com
Brad Hall brad@nicira.com
+Brailey Josh josh@faucet.nz
Brandon Heller brandonh@stanford.edu
Brendan Kelley bkelley@nicira.com
Brent Salisbury brent.salisbury@gmail.com
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index a8cbae78c..eec9689e6 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -2720,11 +2720,17 @@ refresh_controller_status(void)
struct ofproto_controller_info *cinfo =
shash_find_data(&info, cfg->target);
- ovs_assert(cinfo);
- ovsrec_controller_set_is_connected(cfg, cinfo->is_connected);
- const char *role = ofp12_controller_role_to_str(cinfo->role);
- ovsrec_controller_set_role(cfg, role);
- ovsrec_controller_set_status(cfg, &cinfo->pairs);
+ /* cinfo is NULL when 'cfg->target' is a passive connection. */
+ if (cinfo) {
+ ovsrec_controller_set_is_connected(cfg, cinfo->is_connected);
+ const char *role = ofp12_controller_role_to_str(cinfo->role);
+ ovsrec_controller_set_role(cfg, role);
+ ovsrec_controller_set_status(cfg, &cinfo->pairs);
+ } else {
+ ovsrec_controller_set_is_connected(cfg, false);
+ ovsrec_controller_set_role(cfg, NULL);
+ ovsrec_controller_set_status(cfg, NULL);
+ }
}
ofproto_free_ofproto_controller_info(&info);