On Mon, Feb 10, 2014 at 2:32 PM, Roberto Riggio
<roberto.rig...@create-net.org> wrote:
> On 10/02/14 11:49, Helmut Schaa wrote:
>> What did you change to get this working now?
>
> I started from a clean build. In the previous version I played
> a little bit with verious version of OVS and some hack to the
> netidf script. Everything worked as expected on new image built
> from scratch.
>
> BTW the netifd was built from the upstream repo with your
> patch (generated from your git branch).
>
> Is the possibility to set the controller an option you are
> considering?

This is untested but feel free to give it a try:

diff --git a/ovs.c b/ovs.c
index 29db26c..21056cb 100644
--- a/ovs.c
+++ b/ovs.c
@@ -35,6 +35,7 @@ static const struct blobmsg_policy
ovs_attrs[__OVS_ATTR_MAX] = {
     [OVS_ATTR_BASE] = { "ovs_base", BLOBMSG_TYPE_STRING },
     [OVS_ATTR_TAG] = { "ovs_tag", BLOBMSG_TYPE_INT32 },
     [OVS_ATTR_EMPTY] = { "ovs_empty", BLOBMSG_TYPE_BOOL },
+    [OVS_ATTR_CONTROLLER] = { "ovs_controller", BLOBMSG_TYPE_STRING},
 };

 static const struct uci_blob_param_info ovs_attr_info[__OVS_ATTR_MAX] = {
@@ -581,6 +582,8 @@ ovs_apply_settings(struct ovs_state *ost, struct
blob_attr **tb)
     if (tb[OVS_ATTR_TAG] && tb[OVS_ATTR_BASE] ) {
         cfg->tag = blobmsg_get_u32(tb[OVS_ATTR_TAG]);
         cfg->base = blobmsg_get_string(tb[OVS_ATTR_BASE]);
+    } else if (tb[OVS_ATTR_CONTROLLER]) {
+        cfg->controller = blobmsg_get_string(tb[OVS_ATTR_CONTROLLER]);
     }

     if (tb[OVS_ATTR_EMPTY])
diff --git a/system-ovs.c b/system-ovs.c
index 92f0f43..25a42b5 100644
--- a/system-ovs.c
+++ b/system-ovs.c
@@ -92,6 +92,12 @@ int system_ovs_addbr(struct device *ovs, struct
ovs_config *cfg)
             return -1;
         return 0;
     }
+    if (cfg->controller) {
+        if (run_prog("/usr/bin/ovs-vsctl", "add-br", ovs->ifname,
"--", "set-controller", ovs->ifname, cfg->controller))
+            return -1;
+        return 0;
+    }
+
     if (run_prog("/usr/bin/ovs-vsctl", "add-br", ovs->ifname))
         return -1;
     return 0;
diff --git a/system-ovs.h b/system-ovs.h
index ad018d4..f39ac44 100644
--- a/system-ovs.h
+++ b/system-ovs.h
@@ -20,6 +20,7 @@ struct ovs_config {
     bool empty;
     int tag;
     char *base;
+    char *controller;
 };

 void system_ovs_if_clear_state(struct device *dev);
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to