diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-01-26 11:33:54 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2011-01-26 11:33:54 +0000 |
commit | d3e8689ee12fe7f0ce446fc1dd8e84e9ddfffba5 (patch) | |
tree | 30cbf474d9379b94afec2a7ee46bd8e90e2610f0 /package/mac80211/files/lib/wifi | |
parent | a1ee44e27fb86dc3333cad4108e1e25f94e3cfb9 (diff) | |
download | upstream-d3e8689ee12fe7f0ce446fc1dd8e84e9ddfffba5.tar.gz upstream-d3e8689ee12fe7f0ce446fc1dd8e84e9ddfffba5.tar.bz2 upstream-d3e8689ee12fe7f0ce446fc1dd8e84e9ddfffba5.zip |
mac80211: Add mac address filter configuration for hostapd
Add support of mac address filter. Now 'macfilter' and 'maclist' options
can be used with mac80211.
Patch from: kentarou matsuyama <matsuyama@thinktube.com>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@25105 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/mac80211/files/lib/wifi')
-rw-r--r-- | package/mac80211/files/lib/wifi/mac80211.sh | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/package/mac80211/files/lib/wifi/mac80211.sh b/package/mac80211/files/lib/wifi/mac80211.sh index b20785cf67..251c2f13d8 100644 --- a/package/mac80211/files/lib/wifi/mac80211.sh +++ b/package/mac80211/files/lib/wifi/mac80211.sh @@ -6,6 +6,9 @@ mac80211_hostapd_setup_base() { local ifname="$2" cfgfile="/var/run/hostapd-$phy.conf" + macfile="/var/run/hostapd-$phy.maclist" + [ -e "$macfile" ] && rm -f "$macfile" + config_get device "$vif" device config_get country "$device" country config_get hwmode "$device" hwmode @@ -30,7 +33,25 @@ mac80211_hostapd_setup_base() { [ -n "$ht_capab" ] && append base_cfg "ht_capab=$ht_capab" "$N" } } - cat > "$cfgfile" <<EOF + + config_get macfilter "$vif" macfilter + case "$macfilter" in + allow) + append base_cfg "macaddr_acl=1" "$N" + append base_cfg "accept_mac_file=$macfile" "$N" + ;; + deny) + append base_cfg "macaddr_acl=0" "$N" + append base_cfg "deny_mac_file=$macfile" "$N" + ;; + esac + config_get maclist "$vif" maclist + [ -n "$maclist" ] && { + for mac in $maclist; do + echo "$mac" >> $macfile + done + } + cat >> "$cfgfile" <<EOF ctrl_interface=/var/run/hostapd-$phy driver=nl80211 wmm_ac_bk_cwmin=4 |