There are corner cases in which an rconn might not have a defined OpenFlow
protocol or version.  These happen at connection startup, before the
protocol version has been negotiated, and can also happen when a connection
is being shut down.  It's desirable to avoid these situations entirely,
but so far we haven't managed to do this.  This commit avoids trying to
send messages to such connection, which is what really tends to get OVS in
trouble since there's no way to construct an OpenFlow message without
knowing what version of OpenFlow to use (with a few exceptions that don't
matter here).

Reported-at: 
https://mail.openvswitch.org/pipermail/ovs-discuss/2018-December/047876.html
Reported-by: Josh Bailey <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
---
 ofproto/connmgr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c
index 7a7790c0bdbb..226e493bda01 100644
--- a/ofproto/connmgr.c
+++ b/ofproto/connmgr.c
@@ -1492,7 +1492,7 @@ ofconn_receives_async_msg(const struct ofconn *ofconn,
     ovs_assert(reason < 32);
     ovs_assert((unsigned int) type < OAM_N_TYPES);
 
-    if (!rconn_is_connected(ofconn->rconn)) {
+    if (!rconn_is_connected(ofconn->rconn) || !ofconn_get_protocol(ofconn)) {
         return false;
     }
 
-- 
2.16.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to