aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2013-06-17 11:59:29 +0000
committerJo-Philipp Wich <jow@openwrt.org>2013-06-17 11:59:29 +0000
commit49f5201b52e2cdc702ba872e27a83457173db84e (patch)
tree48756df1cf5ab189f3c58e8f7a77a2fa2ae8655e /package
parentbf4c0b1b8ac1fb69f5bd0978e75366595e8d1fae (diff)
downloadupstream-49f5201b52e2cdc702ba872e27a83457173db84e.tar.gz
upstream-49f5201b52e2cdc702ba872e27a83457173db84e.tar.bz2
upstream-49f5201b52e2cdc702ba872e27a83457173db84e.zip
hostapd: correctly handle macfile uci option
Make hostapd.sh correctly handle the macfile uci option. Such option specifies the macfile name to pass into the hostapd configuration file. Moreover, if a maclist option has been specified, copy the macfile before appending new entries. Signed-off-by: Antonio Quartulli <antonio@open-mesh.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@36944 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package')
-rw-r--r--package/network/services/hostapd/files/hostapd.sh33
1 files changed, 24 insertions, 9 deletions
diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
index 00c6a094cf..8d6f30538d 100644
--- a/package/network/services/hostapd/files/hostapd.sh
+++ b/package/network/services/hostapd/files/hostapd.sh
@@ -215,10 +215,31 @@ hostapd_set_bss_options() {
esac
fi
- config_get macfilter "$vif" macfilter
- macfile="/var/run/hostapd-$ifname.maclist"
- [ -e "$macfile" ] && rm -f "$macfile"
+ config_get macfile "$vif" macfile
+ config_get maclist "$vif" maclist
+ if [ -z "$macfile" ]
+ then
+ # if no macfile has been specified, fallback to the default name
+ macfile="/var/run/hostapd-$ifname.maclist"
+ else
+ if [ -n "$maclist" ]
+ then
+ # to avoid to overwrite the original file, make a copy
+ # before appending the entries specified by the maclist
+ # option
+ cp $macfile $macfile.maclist
+ macfile=$macfile.maclist
+ fi
+ fi
+
+ if [ -n "$maclist" ]
+ then
+ for mac in $maclist; do
+ echo "$mac" >> $macfile
+ done
+ fi
+ config_get macfilter "$vif" macfilter
case "$macfilter" in
allow)
append "$var" "macaddr_acl=1" "$N"
@@ -229,12 +250,6 @@ hostapd_set_bss_options() {
append "$var" "deny_mac_file=$macfile" "$N"
;;
esac
- config_get maclist "$vif" maclist
- [ -n "$maclist" ] && {
- for mac in $maclist; do
- echo "$mac" >> $macfile
- done
- }
}
hostapd_set_log_options() {