Skip to content

Commit

Permalink
bridge: Fix controller status update to passive connections
Browse files Browse the repository at this point in the history
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: 85c5577 ("bridge: Fix controller status update")
Reported-by: Josh Bailey <[email protected]>
Signed-off-by: Andy Zhou <[email protected]>
Acked-by: Joe Stringer <[email protected]>
  • Loading branch information
azhou-nicira committed Sep 14, 2017
1 parent 5e8bed8 commit 1ea2184
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ Ben Basler [email protected]
Bhargava Shastry [email protected]
Bob Ball [email protected]
Brad Hall [email protected]
Brailey Josh [email protected]
Brandon Heller [email protected]
Brendan Kelley [email protected]
Brent Salisbury [email protected]
Expand Down
16 changes: 11 additions & 5 deletions vswitchd/bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1ea2184

Please sign in to comment.