Skip to content

Commit

Permalink
ovn-controller: avoid crash when vswitchd connection is lost
Browse files Browse the repository at this point in the history
When ovs-vswitchd has dropped its connection to ovn-controller,
rconn_get_version() will return -1. OpenFlow messages built by
ofctrl_put() in this condition will have an invalid OpenFlow version
value of 255, which eventually leads to ovn-controller crashing
due to an assertion failure in raw_instance_get().

Avoid this crash by improving the ofctrl_can_put() test to ensure
that the negotiated version is available. (Note that checking
rconn_is_connected() would not be sufficient since rconn S_IDLE
state is considered "connected" but version negotiation is not
necessarily complete).

Signed-off-by: Lance Richardson <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
hlrichardson authored and blp committed Jul 12, 2017
1 parent ebfe9a2 commit ab9dfac
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ovn/controller/ofctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,8 @@ bool
ofctrl_can_put(void)
{
if (state != S_UPDATE_FLOWS
|| rconn_packet_counter_n_packets(tx_counter)) {
|| rconn_packet_counter_n_packets(tx_counter)
|| rconn_get_version(swconn) < 0) {
return false;
}
return true;
Expand Down

0 comments on commit ab9dfac

Please sign in to comment.