X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/afb87b33ca6a84890e9080260df97b14c9104667..e3bd6b245abb37a08f7fe7b20832b90bd7f09d52:/package/madwifi/files/lib/wifi/madwifi.sh diff --git a/package/madwifi/files/lib/wifi/madwifi.sh b/package/madwifi/files/lib/wifi/madwifi.sh index db7f05794..a3cf4d75e 100755 --- a/package/madwifi/files/lib/wifi/madwifi.sh +++ b/package/madwifi/files/lib/wifi/madwifi.sh @@ -31,7 +31,7 @@ scan_atheros() { esac done - case "${adhoc:+1}:${sta:+1}:${ap+1}" in + case "${adhoc:+1}:${sta:+1}:${ap:+1}" in # valid mode combinations 1::) wds="";; 1::1);; @@ -67,14 +67,26 @@ disable_atheros() ( enable_atheros() { local device="$1" + + config_get regdomain "$device" regdomain + [ -n "$regdomain" ] && echo "$regdomain" > /proc/sys/dev/$device/regdomain + + config_get country "$device" country + [ -z "$country" ] && country="0" + echo "$country" > /proc/sys/dev/$device/countrycode + + config_get_bool outdoor "$device" outdoor "0" + echo "$outdoor" > /proc/sys/dev/$device/outdoor + config_get channel "$device" channel config_get vifs "$device" vifs + config_get txpower "$device" txpower [ auto = "$channel" ] && channel=0 local first=1 for vif in $vifs; do - local start_hostapd + local start_hostapd vif_txpower nosbeacon= config_get ifname "$vif" ifname config_get enc "$vif" encryption @@ -110,10 +122,10 @@ enable_atheros() { *fh) hwmode=fh;; *) hwmode=auto;; esac - iwpriv "$ifname" mode "$hwmode" iwpriv "$ifname" pureg "$pureg" [ "$first" = 1 ] && { + iwpriv "$ifname" mode "$hwmode" iwconfig "$ifname" channel "$channel" >/dev/null 2>/dev/null } @@ -157,7 +169,7 @@ enable_atheros() { esac case "$mode" in - adhoc|ahdemo) + sta|adhoc|ahdemo) config_get addr "$vif" bssid [ -z "$addr" ] || { iwconfig "$ifname" ap "$addr" @@ -247,9 +259,15 @@ enable_atheros() { config_get_bool turbo "$vif" turbo [ -n "$turbo" ] && iwpriv "$ifname" turbo "$turbo" + config_get_bool beacon_power "$vif" beacon_power + [ -n "$beacon_power" ] && iwpriv "$ifname" beacon_pwr "$beacon_power" + config_get_bool doth "$vif" doth 0 [ -n "$doth" ] && iwpriv "$ifname" doth "$doth" + config_get_bool probereq "$vif" probereq + [ -n "$probereq" ] && iwpriv "$ifname" probereq "$probereq" + config_get maclist "$vif" maclist [ -n "$maclist" ] && { # flush MAC list @@ -275,10 +293,6 @@ enable_atheros() { ifconfig "$ifname" up - # TXPower settings only work if device is up already - config_get txpwr "$vif" txpower - [ -n "$txpwr" ] && iwconfig "$ifname" txpower "${txpwr%%.*}" - local net_cfg bridge net_cfg="$(find_net_config "$vif")" [ -z "$net_cfg" ] || { @@ -289,6 +303,17 @@ enable_atheros() { [ -n "$ssid" ] && iwconfig "$ifname" essid on iwconfig "$ifname" essid "$ssid" set_wifi_up "$vif" "$ifname" + + # TXPower settings only work if device is up already + # while atheros hardware theoretically is capable of per-vif (even per-packet) txpower + # adjustment it does not work with the current atheros hal/madwifi driver + + config_get vif_txpower "$vif" txpower + # use vif_txpower (from wifi-iface) instead of txpower (from wifi-device) if + # the latter doesn't exist + txpower="${txpower:-$vif_txpower}" + [ -z "$txpower" ] || iwconfig "$ifname" txpower "${txpower%%.*}" + case "$mode" in ap) config_get_bool isolate "$vif" isolate 0