Hi,

OpenWRT switched to the Interface+VlanID naming scheme for vlan devices recently and hostapd only supports the "vlan"+VID scheme. This sometimes leads to race conditions, when either system expects the other mode of operation. Although the best solution were to get the kernel return the name of the created interface (or let the user configure it), that would require more work. Further I prefer the dev+vid scheme over the "vlan"+VID scheme, as this avoids conflicts were the same vlan-id is added to more than one device, so I propose to change hostapd instead of openwrt. If this cannot go upstream, maybe it would still be a good thing to have in openwrt, hence the CC to OpenWRT.

I therefore propose to change hostapd to use dev+vid naming scheme and am attaching a patch.

Hostap-Signed-Off: M. Braun <[email protected]>
--- a/src/ap/vlan_init.c	2012-06-25 15:20:00.934769046 +0200
+++ b/src/ap/vlan_init.c	2012-06-25 15:31:13.881415772 +0200
@@ -403,8 +403,8 @@
 
 	/* Determine if a suitable vlan device already exists. */
 
-	os_snprintf(if_request.device1, sizeof(if_request.device1), "vlan%d",
-		    vid);
+	os_snprintf(if_request.device1, sizeof(if_request.device1), "%s.%d",
+		    if_name, vid);
 
 	if_request.cmd = _GET_VLAN_VID_CMD;
 
@@ -501,7 +501,7 @@
 					vlan->clean |= DVLAN_CLEAN_VLAN;
 
 				os_snprintf(vlan_ifname, sizeof(vlan_ifname),
-					    "vlan%d", vlan->vlan_id);
+					    "%s.%d", tagged_interface, vlan->vlan_id);
 
 				if (!br_addif(br_name, vlan_ifname))
 					vlan->clean |= DVLAN_CLEAN_VLAN_PORT;
@@ -542,7 +542,7 @@
 
 			if (tagged_interface) {
 				os_snprintf(vlan_ifname, sizeof(vlan_ifname),
-					    "vlan%d", vlan->vlan_id);
+					    "%s.%d", tagged_interface, vlan->vlan_id);
 				if (vlan->clean & DVLAN_CLEAN_VLAN_PORT)
 					br_delif(br_name, vlan_ifname);
 				ifconfig_down(vlan_ifname);
@@ -682,7 +682,7 @@
 	if (priv == NULL)
 		return NULL;
 
-	vlan_set_name_type(VLAN_NAME_TYPE_PLUS_VID_NO_PAD);
+	vlan_set_name_type(VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD);
 
 	priv->s = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
 	if (priv->s < 0) {

_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to