diff options
Diffstat (limited to 'package/mac80211/files/lib/wifi')
-rw-r--r-- | package/mac80211/files/lib/wifi/mac80211.sh | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/package/mac80211/files/lib/wifi/mac80211.sh b/package/mac80211/files/lib/wifi/mac80211.sh index 20f6bfa93c..1994ca38d4 100644 --- a/package/mac80211/files/lib/wifi/mac80211.sh +++ b/package/mac80211/files/lib/wifi/mac80211.sh @@ -19,11 +19,8 @@ mac80211_hostapd_setup_base() { [ -n "$channel" -a -z "$hwmode" ] && wifi_fixup_hwmode "$device" - [ "$channel" = auto ] && { - channel=$(iw phy "$phy" info | \ - sed -ne '/MHz/ { /disabled\|passive\|radar/d; s/.*\[//; s/\].*//; p; q }') - config_set "$device" channel "$channel" - } + hostapd_channel=$channel + [ "$channel" = auto -o "$channel" = 0 ] && hostapd_channel=acs_survey [ -n "$hwmode" ] && { config_get hwmode_11n "$device" hwmode_11n @@ -97,7 +94,7 @@ tx_queue_data0_cwmin=3 tx_queue_data0_cwmax=7 tx_queue_data0_burst=1.5 ${hwmode:+hw_mode=$hwmode} -${channel:+channel=$channel} +${hostapd_channel:+channel=$hostapd_channel} ${beacon_int:+beacon_int=$beacon_int} ${country:+country_code=$country} ${noscan:+noscan=$noscan} @@ -110,6 +107,7 @@ EOF mac80211_hostapd_setup_bss() { local phy="$1" local vif="$2" + local staidx="$3" hostapd_cfg= cfgfile="/var/run/hostapd-$phy.conf" @@ -132,6 +130,8 @@ mac80211_hostapd_setup_bss() { config_get_bool wds "$vif" wds 0 [ "$wds" -gt 0 ] && append hostapd_cfg "wds_sta=1" "$N" + [ "$staidx" -gt 0 ] && append hostapd_cfg "start_disabled=1" "$N" + local macaddr hidden maxassoc wmm config_get macaddr "$vif" macaddr config_get maxassoc "$vif" maxassoc @@ -251,7 +251,7 @@ disable_mac80211() ( include /lib/network 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 + for pid in `pidof wpa_supplicant meshd-nl80211`; do grep "$wdev" /proc/$pid/cmdline >/dev/null && \ kill $pid done @@ -318,6 +318,7 @@ enable_mac80211() { local i=0 local macidx=0 local apidx=0 + local staidx=0 fixed="" local hostapd_ctrl="" @@ -370,14 +371,20 @@ enable_mac80211() { [ "$apidx" -gt 1 ] || iw phy "$phy" interface add "$ifname" type managed ;; mesh) - config_get mesh_id "$vif" mesh_id - iw phy "$phy" interface add "$ifname" type mp mesh_id "$mesh_id" + config_get key "$vif" key "" + if [ -n "$key" ]; then + iw phy "$phy" interface add "$ifname" type mp + else + config_get mesh_id "$vif" mesh_id + iw phy "$phy" interface add "$ifname" type mp mesh_id "$mesh_id" + fi ;; monitor) iw phy "$phy" interface add "$ifname" type monitor ;; sta) local wdsflag + staidx="$(($staidx + 1))" config_get_bool wds "$vif" wds 0 [ "$wds" -gt 0 ] && wdsflag="4addr on" iw phy "$phy" interface add "$ifname" type managed $wdsflag @@ -426,9 +433,16 @@ enable_mac80211() { rm -f /var/run/hostapd-$phy.conf for vif in $vifs; do config_get mode "$vif" mode - [ "$mode" = "ap" ] || continue - mac80211_hostapd_setup_bss "$phy" "$vif" - start_hostapd=1 + case "$mode" in + ap) + mac80211_hostapd_setup_bss "$phy" "$vif" "$staidx" + start_hostapd=1 + ;; + mesh) + config_get key "$vif" key "" + [ -n "$key" ] && authsae_start_interface "$device" "$vif" + ;; + esac done [ -n "$start_hostapd" ] && { |