X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/45aa23838fc18daf1c7a425492c574e99e8405e1..9cdf3516e5f0beec6aa8b8dd97f9b544b515941d:/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 af8dd2327..a00cdee1b 100644 --- a/package/mac80211/files/lib/wifi/mac80211.sh +++ b/package/mac80211/files/lib/wifi/mac80211.sh @@ -165,6 +165,14 @@ scan_mac80211() { config_set "$device" vifs "${ap:+$ap }${adhoc:+$adhoc }${sta:+$sta }${monitor:+$monitor }${mesh:+$mesh}" } +list_phy_interfaces() { + local phy="$1" + if [ -d "/sys/class/ieee80211/${phy}/device/net" ]; then + ls "/sys/class/ieee80211/${phy}/device/net" 2>/dev/null; + else + ls "/sys/class/ieee80211/${phy}/device" 2>/dev/null | grep net: | sed -e 's,net:,,g' + fi +} disable_mac80211() ( local device="$1" @@ -181,7 +189,7 @@ disable_mac80211() ( done include /lib/network - for wdev in $(ls /sys/class/ieee80211/${phy}/device/net 2>/dev/null); do + for wdev in $(list_phy_interfaces "$phy"); do [ -f "/var/run/$wdev.pid" ] && kill $(cat /var/run/$wdev.pid) >&/dev/null 2>&1 for pid in `pidof wpa_supplicant`; do grep "$wdev" /proc/$pid/cmdline >/dev/null && \ @@ -206,6 +214,8 @@ enable_mac80211() { config_get txpower "$device" txpower config_get country "$device" country config_get distance "$device" distance + config_get frag "$device" frag + config_get rts "$device" rts find_mac80211_phy "$device" || return 0 config_get phy "$device" phy local i=0 @@ -219,6 +229,8 @@ enable_mac80211() { } [ -n "$distance" ] && iw phy "$phy" set distance "$distance" + [ -n "$frag" ] && iw phy "$phy" set frag "${frag%%.*}" + [ -n "$rts" ] && iw phy "$phy" set rts "${rts%%.*}" export channel fixed # convert channel to frequency @@ -310,16 +322,6 @@ enable_mac80211() { # wifi-device) if the latter doesn't exist txpower="${txpower:-$vif_txpower}" [ -z "$txpower" ] || iwconfig "$ifname" txpower "${txpower%%.*}" - - config_get frag "$vif" frag - if [ -n "$frag" ]; then - iw phy "$phy" set frag "${frag%%.*}" - fi - - config_get rts "$vif" rts - if [ -n "$rts" ]; then - iw phy "$phy" set rts "${rts%%.*}" - fi done local start_hostapd= @@ -402,7 +404,7 @@ detect_mac80211() { mode_11n="" mode_band="g" - channel="5" + channel="11" ht_cap=0 for cap in $(iw phy "$dev" info | grep 'Capabilities:' | cut -d: -f2); do ht_cap="$(($ht_cap | $cap))"