This is a rather unpleasant hack but I am unsure of how to rework things
such that ovs-controller will work with a version of make_openflow() which
uses prevailing OpenFlow version in the header of OpenFlow messages.

**** This is a local hack and should not be applied ****

---

v9
* No change

v8
* No change

v7
* No change

v6
* No change

v5
* No change

v4
* Initial post
---
 utilities/ovs-controller.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/utilities/ovs-controller.c b/utilities/ovs-controller.c
index 04b16e8..35bd440 100644
--- a/utilities/ovs-controller.c
+++ b/utilities/ovs-controller.c
@@ -23,6 +23,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include <unistd.h>
 
 #include "command-line.h"
 #include "compiler.h"
@@ -224,6 +225,25 @@ new_switch(struct switch_ *sw, struct vconn *vconn)
     struct lswitch_config cfg;
 
     sw->rconn = rconn_create(60, 0, DSCP_DEFAULT);
+
+    /* This is a hack (as evident by the presence of usleep()).
+     *
+     * vconn must be connected before the lswitch_create() makes any
+     * messages otherwise the correct version to place in the header
+     * is unknown.
+     */
+    while (1) {
+        int error = vconn_connect(vconn);
+        if (!error) {
+            break;
+        }
+        if (error != EAGAIN) {
+            VLOG_ERR("Failed to connect");
+            abort();
+        }
+        usleep(100000);
+    }
+
     rconn_connect_unreliably(sw->rconn, vconn, NULL);
 
     cfg.mode = (action_normal ? LSW_NORMAL
-- 
1.7.10.2.484.gcd07cc5

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to