openvswitch and hostap?
James Harper
james
Fri Nov 14 17:28:20 PST 2014
I just threw this patch together. It runs the 'ovs-vsctl port-to-br' command to determine the name of the bridge, falling back to the old bridge detection method if that fails.
It could be further developed to also add and remove the interface etc, but that's not really the way openvswitch works - interfaces are sticky wrt bridge membership and you don't need to re-add them each boot etc.
Another option would be to add a config parameter that says "don't do any bridge configuration".
James
diff --git a/src/drivers/linux_ioctl.c b/src/drivers/linux_ioctl.c
index 837971d..0fc132a 100644
--- a/src/drivers/linux_ioctl.c
+++ b/src/drivers/linux_ioctl.c
@@ -203,9 +203,24 @@ int linux_br_del_if(int sock, const char *brname, const char *ifname)
int linux_br_get(char *brname, const char *ifname)
{
+ FILE *ovs;
char path[128], brlink[128], *pos;
+ char cmd[128], *tmp;
ssize_t res;
+ os_snprintf(cmd, sizeof(cmd), "ovs-vsctl port-to-br %s",
+ ifname);
+ ovs = popen(cmd, "r");
+ if (ovs) {
+ if (fscanf(ovs, "%m[^ \t\r\n]", &tmp) == 1) {
+ os_strlcpy(brname, tmp, IFNAMSIZ);
+ free(tmp);
+ pclose(ovs);
+ return 0;
+ }
+ pclose(ovs);
+ }
+
os_snprintf(path, sizeof(path), "/sys/class/net/%s/brport/bridge",
ifname);
res = readlink(path, brlink, sizeof(brlink));
More information about the Hostap
mailing list