X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fsvn-archive%2Farchive.git;a=blobdiff_plain;f=package%2Fmac80211%2Ffiles%2Flib%2Fwifi%2Fmac80211.sh;h=7e38cea557f854eb2e26d346fb82581686835e16;hp=027749e57841896ff422ba49e5f970b5298c54fa;hb=74c0b299517c1e8f2989dd517b845350fb12b5ba;hpb=1c719e035857b1692e6b18448a5c3a105f873895 diff --git a/package/mac80211/files/lib/wifi/mac80211.sh b/package/mac80211/files/lib/wifi/mac80211.sh index 027749e578..7e38cea557 100644 --- a/package/mac80211/files/lib/wifi/mac80211.sh +++ b/package/mac80211/files/lib/wifi/mac80211.sh @@ -1,8 +1,156 @@ #!/bin/sh append DRIVERS "mac80211" +mac80211_hostapd_setup_base() { + local phy="$1" + 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 + config_get channel "$device" channel + config_get_bool noscan "$device" noscan + [ -n "$channel" -a -z "$hwmode" ] && wifi_fixup_hwmode "$device" + [ "$channel" = auto ] && channel= + [ -n "$hwmode" ] && { + config_get hwmode_11n "$device" hwmode_11n + [ -n "$hwmode_11n" ] && { + hwmode="$hwmode_11n" + append base_cfg "ieee80211n=1" "$N" + config_get htmode "$device" htmode + config_get ht_capab_list "$device" ht_capab + case "$htmode" in + HT20|HT40+|HT40-) ht_capab="[$htmode]";; + *)ht_capab=;; + esac + for cap in $ht_capab_list; do + ht_capab="$ht_capab[$cap]" + done + [ -n "$ht_capab" ] && append base_cfg "ht_capab=$ht_capab" "$N" + } + } + + 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" <