[ovs-dev] [PATCH 07/14] vswitchd: Configuration of allowed OpenFlow versions

Simon Horman horms at verge.net.au
Wed Nov 7 08:03:05 UTC 2012


Versions may be configured using a comma delimited list as
the value for 'openflow-versions' the 'other-config' column
of the Bridge table.

Currently list elements other than 'OpenFlow10' and 'OpenFlow12' will
be ignored.

If the list is empty, then OpenFlow10 is used.
This default is consistent with the behaviour of ovs-vswtichd
prior to this patch.

Signed-off-by: Simon Horman <horms at verge.net.au>

---

v4
* Rebase
---
 vswitchd/bridge.c |   18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 9fe7750..b698b48 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -36,6 +36,7 @@
 #include "meta-flow.h"
 #include "netdev.h"
 #include "ofp-print.h"
+#include "ofp-util.h"
 #include "ofpbuf.h"
 #include "ofproto/ofproto.h"
 #include "poll-loop.h"
@@ -812,6 +813,20 @@ bridge_configure_datapath_id(struct bridge *br)
     free(dpid_string);
 }
 
+/* Pick local port hardware address and datapath ID for 'br'. */
+static uint32_t
+bridge_get_allowed_versions(struct bridge *br)
+{
+    const char *config_str = smap_get(&br->cfg->other_config,
+                                      "openflow-versions");
+    if (config_str) {
+        return ofputil_versions_from_string(config_str) &
+            OFPUTIL_SUPPORTED_VERSIONS;
+    } else {
+        return 0;
+    }
+}
+
 /* Set NetFlow configuration on 'br'. */
 static void
 bridge_configure_netflow(struct bridge *br)
@@ -2797,7 +2812,8 @@ bridge_configure_remotes(struct bridge *br,
         n_ocs++;
     }
 
-    ofproto_set_controllers(br->ofproto, ocs, n_ocs, 0);
+    ofproto_set_controllers(br->ofproto, ocs, n_ocs,
+                            bridge_get_allowed_versions(br));
     free(ocs[0].target); /* From bridge_ofproto_controller_for_mgmt(). */
     free(ocs);
 
-- 
1.7.10.4




More information about the dev mailing list