diff mbox

[PATCHv2,02/21] bridge: use safe default

Message ID 9286530b800a51510dd61d286ff5fe0374b27ee8.1370512966.git.michael-dev@fami-braun.de
State Accepted
Commit 459eee923c02675890e9cc94086da8866180c944
Headers show

Commit Message

michael-dev May 17, 2013, 7:45 a.m. UTC
Currently by default, all BSS share the bridge brvlan%d.
While this is sane when no tagged-interface is given, this
is insane when different tagged interfaces are given, as
it would result in bridging those tagged interfaces.

This patch therefore uses br%s%d with %s=tagged_interface
and %d=VLAN ID as bridge name when a tagged-interface is given.

Signed-hostap: Michael Braun <michael-dev@fami-braun.de>

Comments

Jouni Malinen June 25, 2013, 8:11 a.m. UTC | #1
On Fri, May 17, 2013 at 09:45:14AM +0200, Michael Braun wrote:
> Currently by default, all BSS share the bridge brvlan%d.
> While this is sane when no tagged-interface is given, this
> is insane when different tagged interfaces are given, as
> it would result in bridging those tagged interfaces.
> 
> This patch therefore uses br%s%d with %s=tagged_interface
> and %d=VLAN ID as bridge name when a tagged-interface is given.

Thanks, applied.
diff mbox

Patch

diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index d9f4c9d..49beb94 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -845,7 +845,9 @@  own_ip_addr=127.0.0.1
 #vlan_tagged_interface=eth0
 
 # Bridge (Prefix) to add the wifi and the tagged interface to. This gets the
-# VLAN ID appended.
+# VLAN ID appended. It defaults to brvlan%d if no tagged interface is given
+# and br%s.%d if a tagged interface is given, provided %s = tagged interface
+# and %d = VLAN ID.
 #vlan_bridge=brvlan
 
 # When hostapd creates a VLAN interface on vlan_tagged_interfaces, it needs
diff --git a/src/ap/vlan_init.c b/src/ap/vlan_init.c
index e9ebcdd..3cdd1a6 100644
--- a/src/ap/vlan_init.c
+++ b/src/ap/vlan_init.c
@@ -497,6 +497,10 @@  static void vlan_newlink(char *ifname, struct hostapd_data *hapd)
 				os_snprintf(br_name, sizeof(br_name), "%s%d",
 					    hapd->conf->vlan_bridge,
 					    vlan->vlan_id);
+			} else if (tagged_interface) {
+				os_snprintf(br_name, sizeof(br_name),
+				            "br%s.%d", tagged_interface,
+					    vlan->vlan_id);
 			} else {
 				os_snprintf(br_name, sizeof(br_name),
 				            "brvlan%d", vlan->vlan_id);
@@ -560,6 +564,10 @@  static void vlan_dellink(char *ifname, struct hostapd_data *hapd)
 				os_snprintf(br_name, sizeof(br_name), "%s%d",
 					    hapd->conf->vlan_bridge,
 					    vlan->vlan_id);
+			} else if (tagged_interface) {
+				os_snprintf(br_name, sizeof(br_name),
+				            "br%s.%d", tagged_interface,
+					    vlan->vlan_id);
 			} else {
 				os_snprintf(br_name, sizeof(br_name),
 				            "brvlan%d", vlan->vlan_id);