Make vlan_file optional if dynamic_vlan is used
My APs generate their configuration on their own using a different number of (vlan-enabled) bss. Currently, all my vlan_file files consist of a single line: the wildcard line. Configuration file generation would be easier, if the hostapd configuration file would not depend on those simple vlan_file files. This patch removes the need for those one-line files by using the <device>.<vlan> naming scheme if no vlan_file is given (or that file is empty). This should not break any existing setup, as using dynamic_vlan with no vlan configured does not make sense anyway. Signed-hostap: Michael Braun <michael-dev@fami-braun.de>
This commit is contained in:
parent
bdb112d35f
commit
7ca902b53e
2 changed files with 25 additions and 3 deletions
|
@ -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 <bss-iface>.<vlan-id> interfaces.
|
||||
#vlan_file=/etc/hostapd.vlan
|
||||
|
||||
# Interface where 802.1q tagged packets should appear when a RADIUS server is
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue