X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/6202b4177488b4eb6f9de6a0ce0c6463421deb27..a3bf9b4420d34660c7e4f44c642ed80740fa2d6b:/package/mac80211/files/lib/wifi/mac80211.sh diff --git a/package/mac80211/files/lib/wifi/mac80211.sh b/package/mac80211/files/lib/wifi/mac80211.sh index 2f8fedf24..e946a685a 100644 --- a/package/mac80211/files/lib/wifi/mac80211.sh +++ b/package/mac80211/files/lib/wifi/mac80211.sh @@ -6,13 +6,28 @@ 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 config_get channel "$device" channel + config_get beacon_int "$device" beacon_int + config_get basic_rate_list "$device" basic_rate config_get_bool noscan "$device" noscan + config_get_bool short_preamble "$device" short_preamble "0" + + hostapd_set_log_options base_cfg "$device" + [ -n "$channel" -a -z "$hwmode" ] && wifi_fixup_hwmode "$device" - [ "$channel" = auto ] && channel= + + [ "$channel" = auto ] && { + channel=$(iw phy "$phy" info | \ + sed -ne '/MHz/ { /disabled\|passive\|radar/d; s/.*\[//; s/\].*//; p; q }') + config_set "$device" channel "$channel" + } + [ -n "$hwmode" ] && { config_get hwmode_11n "$device" hwmode_11n [ -n "$hwmode_11n" ] && { @@ -30,7 +45,42 @@ mac80211_hostapd_setup_base() { [ -n "$ht_capab" ] && append base_cfg "ht_capab=$ht_capab" "$N" } } - cat > "$cfgfile" <> $macfile + done + } + + local br brval brstr + [ -n "$basic_rate_list" ] && { + for br in $basic_rate_list; do + brval="$(($br / 100))" + [ -n "$brstr" ] && brstr="$brstr " + brstr="$brstr$brval" + done + } + + append base_cfg "preamble=$short_preamble" "$N" + + cat >> "$cfgfile" <