bridge: Give bridge name in per-bss configuration

Currently, when different BSS using different tagged vlan
interfaces, they are forced to share the bridge brvlan#,
which is not desirable.

This patch fixes this by making the bridge name configurable.

Signed-hostap: Michael Braun <michael-dev@fami-braun.de>
This commit is contained in:
Michael Braun 2013-06-25 11:09:01 +03:00 committed by Jouni Malinen
parent de36e348f9
commit 2aaeedfa07
4 changed files with 24 additions and 4 deletions

View File

@ -1689,6 +1689,9 @@ static int hostapd_config_fill(struct hostapd_config *conf,
sizeof(conf->bss[0].iface)); sizeof(conf->bss[0].iface));
} else if (os_strcmp(buf, "bridge") == 0) { } else if (os_strcmp(buf, "bridge") == 0) {
os_strlcpy(bss->bridge, pos, sizeof(bss->bridge)); os_strlcpy(bss->bridge, pos, sizeof(bss->bridge));
} else if (os_strcmp(buf, "vlan_bridge") == 0) {
os_strlcpy(bss->vlan_bridge, pos,
sizeof(bss->vlan_bridge));
} else if (os_strcmp(buf, "wds_bridge") == 0) { } else if (os_strcmp(buf, "wds_bridge") == 0) {
os_strlcpy(bss->wds_bridge, pos, os_strlcpy(bss->wds_bridge, pos,
sizeof(bss->wds_bridge)); sizeof(bss->wds_bridge));

View File

@ -844,6 +844,10 @@ own_ip_addr=127.0.0.1
# to the bridge. # to the bridge.
#vlan_tagged_interface=eth0 #vlan_tagged_interface=eth0
# Bridge (prefix) to add the wifi and the tagged interface to. This gets the
# VLAN ID appended.
#vlan_bridge=brvlan
# When hostapd creates a VLAN interface on vlan_tagged_interfaces, it needs # When hostapd creates a VLAN interface on vlan_tagged_interfaces, it needs
# to know how to name it. # to know how to name it.
# 0 = vlan<XXX>, e.g., vlan1 # 0 = vlan<XXX>, e.g., vlan1

View File

@ -180,6 +180,7 @@ struct hostapd_nai_realm_data {
struct hostapd_bss_config { struct hostapd_bss_config {
char iface[IFNAMSIZ + 1]; char iface[IFNAMSIZ + 1];
char bridge[IFNAMSIZ + 1]; char bridge[IFNAMSIZ + 1];
char vlan_bridge[IFNAMSIZ + 1];
char wds_bridge[IFNAMSIZ + 1]; char wds_bridge[IFNAMSIZ + 1];
enum hostapd_logger_level logger_syslog_level, logger_stdout_level; enum hostapd_logger_level logger_syslog_level, logger_stdout_level;

View File

@ -493,8 +493,14 @@ static void vlan_newlink(char *ifname, struct hostapd_data *hapd)
while (vlan) { while (vlan) {
if (os_strcmp(ifname, vlan->ifname) == 0) { if (os_strcmp(ifname, vlan->ifname) == 0) {
os_snprintf(br_name, sizeof(br_name), "brvlan%d", if (hapd->conf->vlan_bridge[0]) {
vlan->vlan_id); os_snprintf(br_name, sizeof(br_name), "%s%d",
hapd->conf->vlan_bridge,
vlan->vlan_id);
} else {
os_snprintf(br_name, sizeof(br_name),
"brvlan%d", vlan->vlan_id);
}
if (!br_addbr(br_name)) if (!br_addbr(br_name))
vlan->clean |= DVLAN_CLEAN_BR; vlan->clean |= DVLAN_CLEAN_BR;
@ -550,8 +556,14 @@ static void vlan_dellink(char *ifname, struct hostapd_data *hapd)
while (vlan) { while (vlan) {
if (os_strcmp(ifname, vlan->ifname) == 0) { if (os_strcmp(ifname, vlan->ifname) == 0) {
os_snprintf(br_name, sizeof(br_name), "brvlan%d", if (hapd->conf->vlan_bridge[0]) {
vlan->vlan_id); os_snprintf(br_name, sizeof(br_name), "%s%d",
hapd->conf->vlan_bridge,
vlan->vlan_id);
} else {
os_snprintf(br_name, sizeof(br_name),
"brvlan%d", vlan->vlan_id);
}
if (vlan->clean & DVLAN_CLEAN_WLAN_PORT) if (vlan->clean & DVLAN_CLEAN_WLAN_PORT)
br_delif(br_name, vlan->ifname); br_delif(br_name, vlan->ifname);