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
*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
}
esac
case "$mode" in
- adhoc|ahdemo)
+ sta|adhoc|ahdemo)
config_get addr "$vif" bssid
[ -z "$addr" ] || {
iwconfig "$ifname" ap "$addr"
[ -n "$antrx" ] && sysctl -w dev."$device".rxantenna="$antrx" >&-
[ -n "$anttx" ] && sysctl -w dev."$device".txantenna="$anttx" >&-
[ -n "$softled" ] && sysctl -w dev."$device".softled="$softled" >&-
-
- config_get distance "$device" distance
- [ -n "$distance" ] && athctrl -i "$device" -d "$distance" >&-
+ [ -n "$distance" ] && sysctl -w dev."$device".distance="$distance" >&-
config_get rate "$vif" rate
[ -n "$rate" ] && iwconfig "$ifname" rate "${rate%%.*}"
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
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" ] || {
[ -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