This patch corrects the dynamic interface names created by hostapd to match
OpenWRT conventions. Currently, hostapd uses vlanX instead of eth0.X for
dynamic vlan interfaces and brvlanX instead of br-vlanX for dynamic bridge
interfaces. Back in December 2010, nbd committed the CONFIG_FULL_DYNAMIC_VLAN=y
option against the hostapd full package
(https://dev.openwrt.org/changeset/24722), however this feature has not yet
been fully integrated. I have tested this on ar71xx using a TP-Link WR1043ND
with the ath9k driver but I believe this will work on all platforms given the
trivial nature of the patch.
Signed-off-by: Matthew Bowman <mgbowman at gmx punct com>
--- a/src/ap/vlan_init.c
+++ b/src/ap/vlan_init.c
@@ -403,8 +403,8 @@ static int vlan_add(const char *if_name,
/* 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;
@@ -487,7 +487,7 @@ static void vlan_newlink(char *ifname, s
while (vlan) {
if (os_strcmp(ifname, vlan->ifname) == 0) {
- os_snprintf(br_name, sizeof(br_name), "brvlan%d",
+ os_snprintf(br_name, sizeof(br_name), "br-vlan%d",
vlan->vlan_id);
if (!br_addbr(br_name))
@@ -501,7 +501,7 @@ static void vlan_newlink(char *ifname, s
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;
@@ -534,7 +534,7 @@ static void vlan_dellink(char *ifname, s
while (vlan) {
if (os_strcmp(ifname, vlan->ifname) == 0) {
- os_snprintf(br_name, sizeof(br_name), "brvlan%d",
+ os_snprintf(br_name, sizeof(br_name), "br-vlan%d",
vlan->vlan_id);
if (vlan->clean & DVLAN_CLEAN_WLAN_PORT)
@@ -542,7 +542,7 @@ static void vlan_dellink(char *ifname, s
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 @@ full_dynamic_vlan_init(struct hostapd_da
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