aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2018-11-14 16:50:23 (GMT)
committerJouni Malinen <j@w1.fi>2018-12-21 10:02:57 (GMT)
commit4d663233e64f639998aab31195ab7c819164019c (patch)
treecf8e9c1c728a85ff7174b6372b83ea8cf6b84392 /hostapd
parentd2b5138116a0ad5370c8c72978341a916321fc97 (diff)
downloadhostap-4d663233e64f639998aab31195ab7c819164019c.zip
hostap-4d663233e64f639998aab31195ab7c819164019c.tar.gz
hostap-4d663233e64f639998aab31195ab7c819164019c.tar.bz2
hostapd: Support for overriding the bridge name per VLAN via vlan_file
This makes it easier to integrate dynamic VLANs in custom network configurations. The bridge name is added after the interface name in the vlan_file line, also separated by whitespace. Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'hostapd')
-rw-r--r--hostapd/config_file.c15
-rw-r--r--hostapd/hostapd.conf1
2 files changed, 14 insertions, 2 deletions
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index b76d3a3..306afce 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -37,7 +37,7 @@ static int hostapd_config_read_vlan_file(struct hostapd_bss_config *bss,
const char *fname)
{
FILE *f;
- char buf[128], *pos, *pos2;
+ char buf[128], *pos, *pos2, *pos3;
int line = 0, vlan_id;
struct hostapd_vlan *vlan;
@@ -82,7 +82,10 @@ static int hostapd_config_read_vlan_file(struct hostapd_bss_config *bss,
pos2 = pos;
while (*pos2 != ' ' && *pos2 != '\t' && *pos2 != '\0')
pos2++;
- *pos2 = '\0';
+
+ if (*pos2 != '\0')
+ *(pos2++) = '\0';
+
if (*pos == '\0' || os_strlen(pos) > IFNAMSIZ) {
wpa_printf(MSG_ERROR, "Invalid VLAN ifname at line %d "
"in '%s'", line, fname);
@@ -90,6 +93,13 @@ static int hostapd_config_read_vlan_file(struct hostapd_bss_config *bss,
return -1;
}
+ while (*pos2 == ' ' || *pos2 == '\t')
+ pos2++;
+ pos3 = pos2;
+ while (*pos3 != ' ' && *pos3 != '\t' && *pos3 != '\0')
+ pos3++;
+ *pos3 = '\0';
+
vlan = os_zalloc(sizeof(*vlan));
if (vlan == NULL) {
wpa_printf(MSG_ERROR, "Out of memory while reading "
@@ -102,6 +112,7 @@ static int hostapd_config_read_vlan_file(struct hostapd_bss_config *bss,
vlan->vlan_desc.untagged = vlan_id;
vlan->vlan_desc.notempty = !!vlan_id;
os_strlcpy(vlan->ifname, pos, sizeof(vlan->ifname));
+ os_strlcpy(vlan->bridge, pos2, sizeof(vlan->bridge));
vlan->next = bss->vlan;
bss->vlan = vlan;
}
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index 75f4e4e..6134559 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -1135,6 +1135,7 @@ own_ip_addr=127.0.0.1
# white space (space or tab).
# If no entries are provided by this file, the station is statically mapped
# to <bss-iface>.<vlan-id> interfaces.
+# Each line can optionally also contain the name of a bridge to add the VLAN to
#vlan_file=/etc/hostapd.vlan
# Interface where 802.1q tagged packets should appear when a RADIUS server is