diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf index d4425866b..6a1c500bd 100644 --- a/hostapd/hostapd.conf +++ b/hostapd/hostapd.conf @@ -814,9 +814,8 @@ own_ip_addr=127.0.0.1 # is used for the stations. This information is parsed from following RADIUS # attributes based on RFC 3580 and RFC 2868: Tunnel-Type (value 13 = VLAN), # Tunnel-Medium-Type (value 6 = IEEE 802), Tunnel-Private-Group-ID (value -# VLANID as a string). vlan_file option below must be configured if dynamic -# VLANs are used. Optionally, the local MAC ACL list (accept_mac_file) can be -# used to set static client MAC address to VLAN ID mapping. +# VLANID as a string). Optionally, the local MAC ACL list (accept_mac_file) can +# be used to set static client MAC address to VLAN ID mapping. # 0 = disabled (default) # 1 = option; use default interface if RADIUS server does not include VLAN ID # 2 = required; reject authentication if RADIUS server does not include VLAN ID @@ -828,6 +827,8 @@ own_ip_addr=127.0.0.1 # multiple BSSIDs or SSIDs. Each line in this text file is defining a new # interface and the line must include VLAN ID and interface name separated by # white space (space or tab). +# If no entries are provided by this file, the station is statically mapped +# to . interfaces. #vlan_file=/etc/hostapd.vlan # Interface where 802.1q tagged packets should appear when a RADIUS server is diff --git a/src/ap/vlan_init.c b/src/ap/vlan_init.c index 7b1a9e671..6390e8bdc 100644 --- a/src/ap/vlan_init.c +++ b/src/ap/vlan_init.c @@ -837,6 +837,27 @@ int vlan_init(struct hostapd_data *hapd) hapd->full_dynamic_vlan = full_dynamic_vlan_init(hapd); #endif /* CONFIG_FULL_DYNAMIC_VLAN */ + if (hapd->conf->ssid.dynamic_vlan != DYNAMIC_VLAN_DISABLED && + !hapd->conf->vlan) { + /* dynamic vlans enabled but no (or empty) vlan_file given */ + struct hostapd_vlan *vlan; + vlan = os_zalloc(sizeof(*vlan)); + if (vlan == NULL) { + wpa_printf(MSG_ERROR, "Out of memory while assigning " + "VLAN interfaces"); + return -1; + } + + vlan->vlan_id = VLAN_ID_WILDCARD; + os_snprintf(vlan->ifname, sizeof(vlan->ifname), "%s.#", + hapd->conf->iface); + if (hapd->conf->vlan_tail) + hapd->conf->vlan_tail->next = vlan; + else + hapd->conf->vlan = vlan; + hapd->conf->vlan_tail = vlan; + } + if (vlan_dynamic_add(hapd, hapd->conf->vlan)) return -1;