I use this feature often. I'll try to test this today and ack it if it
works for me.
On 10/16/2012 05:30 PM, Zenon Mousmoulas wrote:
This is based on the patches submitted by Matthew Bowman:
http://patchwork.openwrt.org/patch/1258/
http://patchwork.openwrt.org/patch/1261/
More recently hostapd has added support for setting the VLAN naming
scheme (eth0.11 vs. vlan11), in commit
a00237ceb8644fc270efd9fc0d0f8d0465db8410 upstream. So the updated patch
(620-dynamic_vlan-correct_bridge_interface_names.patch) only corrects
the bridge interface names (br-vlan11 vs. brvlan11).
Rather than shipping a default hostapd VLAN file, one is created at
runtime based on the wi-fi ifname.
Should this be accepted (hopefully!), I suppose the additional UCI
options would need to be documented; on the wiki? where else?
Signed-off-by: Zenon Mousmoulas <[email protected]>
---
package/network/services/hostapd/files/hostapd.sh | 17 +++++++++++++++++
...namic_vlan-correct_bridge_interface_names.patch | 20 ++++++++++++++++++++
2 files changed, 37 insertions(+), 0 deletions(-)
create mode 100644
package/network/services/hostapd/patches/620-dynamic_vlan-correct_bridge_interface_names.patch
diff --git a/package/network/services/hostapd/files/hostapd.sh
b/package/network/services/hostapd/files/hostapd.sh
index d60c26f..a462fe2 100644
--- a/package/network/services/hostapd/files/hostapd.sh
+++ b/package/network/services/hostapd/files/hostapd.sh
@@ -2,6 +2,7 @@ hostapd_set_bss_options() {
local var="$1"
local vif="$2"
local enc wep_rekey wpa_group_rekey wpa_pair_rekey wpa_master_rekey
wps_possible
+ local vlan_enable ifname vlan_file vlan_interface vlan_naming
config_get enc "$vif" encryption
config_get wep_rekey "$vif" wep_rekey # 300
@@ -112,6 +113,22 @@ hostapd_set_bss_options() {
[ -n "$wpa_group_rekey" ] && append "$var"
"wpa_group_rekey=$wpa_group_rekey" "$N"
[ -n "$wpa_pair_rekey" ] && append "$var"
"wpa_ptk_rekey=$wpa_pair_rekey" "$N"
[ -n "$wpa_master_rekey" ] && append "$var"
"wpa_gmk_rekey=$wpa_master_rekey" "$N"
+ config_get vlan_enable "$vif" vlan_enable 0
+ case "$vlan_enable" in
+ 1|2)
+ append "$var" "dynamic_vlan=$vlan_enable"
"$N"
+ config_get ifname "$vif" ifname
+ config_get vlan_file "$vif" vlan_file
"/var/run/hostapd.${ifname}.vlan"
+ [ "$vlan_file" = "/var/run/hostapd.${ifname}.vlan" ] &&
cat > "$vlan_file" <<-EOF
+ * ${ifname}.#
+ EOF
+ append "$var" "vlan_file=$vlan_file"
"$N"
+ config_get vlan_interface "$vif"
vlan_interface eth0
+ append "$var"
"vlan_tagged_interface=$vlan_interface" "$N"
+ config_get vlan_naming "$vif"
vlan_naming 1
+ append "$var" "vlan_naming=$vlan_naming"
"$N"
+ ;;
+ esac
;;
*wep*)
config_get key "$vif" key
diff --git
a/package/network/services/hostapd/patches/620-dynamic_vlan-correct_bridge_interface_names.patch
b/package/network/services/hostapd/patches/620-dynamic_vlan-correct_bridge_interface_names.patch
new file mode 100644
index 0000000..ff87d3d
--- /dev/null
+++
b/package/network/services/hostapd/patches/620-dynamic_vlan-correct_bridge_interface_names.patch
@@ -0,0 +1,20 @@
+--- a/src/ap/vlan_init.c 2012-10-14 22:30:08.000000000 +0300
++++ b/src/ap/vlan_init.c 2012-10-14 23:51:12.000000000 +0300
+@@ -493,7 +493,7 @@
+ while (vlan) {
+ if (os_strcmp(ifname, vlan->ifname) == 0) {
+
+- os_snprintf(br_name, sizeof(br_name), "brvlan%d",
++ os_snprintf(br_name, sizeof(br_name), "br-vlan%d",
+ vlan->vlan_id);
+
+ if (!br_addbr(br_name))
+@@ -550,7 +550,7 @@
+
+ while (vlan) {
+ if (os_strcmp(ifname, vlan->ifname) == 0) {
+- os_snprintf(br_name, sizeof(br_name), "brvlan%d",
++ os_snprintf(br_name, sizeof(br_name), "br-vlan%d",
+ vlan->vlan_id);
+
+ if (vlan->clean & DVLAN_CLEAN_WLAN_PORT)
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel