summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLance Richardson <lrichard@redhat.com>2017-06-28 14:54:47 -0400
committerBen Pfaff <blp@ovn.org>2017-07-11 22:01:34 -0700
commiteb46e318faccf99c24cffee18501fe36cb87a0f8 (patch)
treee72f99d442b66bbf92784bd3e6dc5eccef60d31a
parent73435d7f6d84955e9510a75de6d5f8c66814603a (diff)
downloadopenvswitch-eb46e318faccf99c24cffee18501fe36cb87a0f8.tar.gz
ovn-controller: avoid crash when vswitchd connection is lost
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 <lrichard@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
-rw-r--r--ovn/controller/ofctrl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ovn/controller/ofctrl.c b/ovn/controller/ofctrl.c
index 10c8105b2..12f4e59b9 100644
--- a/ovn/controller/ofctrl.c
+++ b/ovn/controller/ofctrl.c
@@ -836,7 +836,8 @@ ofctrl_put(struct hmap *flow_table, struct shash *pending_ct_zones,
* criteria for being backlogged appear very conservative, but the socket
* between ovn-controller and OVS provides some buffering.) */
if (state != S_UPDATE_FLOWS
- || rconn_packet_counter_n_packets(tx_counter)) {
+ || rconn_packet_counter_n_packets(tx_counter)
+ || rconn_get_version(swconn) < 0) {
ovn_flow_table_clear(flow_table);
ovn_group_table_clear(groups, false);
return;