Merge Official Source

This commit is contained in:
CN_SZTL 2019-11-17 00:49:07 +08:00
commit cfef343eef
No known key found for this signature in database
GPG Key ID: 6850B6345C862176

View File

@ -15,10 +15,6 @@ MP_CONFIG_INT="mesh_retry_timeout mesh_confirm_timeout mesh_holding_timeout mesh
MP_CONFIG_BOOL="mesh_auto_open_plinks mesh_fwding"
MP_CONFIG_STRING="mesh_power_mode"
iw() {
command iw $@ || logger -t mac80211 "Failed command: iw $@"
}
NEWAPLIST=
OLDAPLIST=
NEWSPLIST=
@ -446,6 +442,36 @@ mac80211_iw_interface_add() {
rc="$?"
}
[ "$rc" = 233 ] && {
# Keep matching pre-existing interface
[ -d "/sys/class/ieee80211/${phy}/device/net/${ifname}" ] && \
case "$(iw dev wlan0 info | grep "^\ttype" | cut -d' ' -f2- 2>/dev/null)" in
"AP")
[ "$type" = "__ap" ] && rc=0
;;
"IBSS")
[ "$type" = "adhoc" ] && rc=0
;;
"managed")
[ "$type" = "managed" ] && rc=0
;;
"mesh point")
[ "$type" = "mp" ] && rc=0
;;
"monitor")
[ "$type" = "monitor" ] && rc=0
;;
esac
}
[ "$rc" = 233 ] && {
iw dev "$ifname" del
sleep 1
iw phy "$phy" interface add "$ifname" type "$type" $wdsflag
rc="$?"
}
[ "$rc" = 233 ] && {
# Device might not support virtual interfaces, so the interface never got deleted in the first place.
# Check if the interface already exists, and avoid failing in this case.
@ -511,6 +537,11 @@ mac80211_prepare_vif() {
[ "$enable" = 0 ] || staidx="$(($staidx + 1))"
[ "$wds" -gt 0 ] && wdsflag="4addr on"
mac80211_iw_interface_add "$phy" "$ifname" managed "$wdsflag" || return
if [ "$wds" -gt 0 ]; then
iw "$ifname" set 4addr on
else
iw "$ifname" set 4addr off
fi
[ "$powersave" -gt 0 ] && powersave="on" || powersave="off"
iw "$ifname" set power_save "$powersave"
;;
@ -814,13 +845,6 @@ mac80211_interface_cleanup() {
mac80211_vap_cleanup hostapd "${primary_ap}"
mac80211_vap_cleanup wpa_supplicant "$(uci -q -P /var/state get wireless._${phy}.splist)"
for wdev in $(list_phy_interfaces "$phy"); do
local wdev_phy="$(readlink /sys/class/net/${wdev}/phy80211)"
wdev_phy="$(basename "$wdev_phy")"
[ -n "$wdev_phy" -a "$wdev_phy" != "$phy" ] && continue
ip link set dev "$wdev" down 2>/dev/null
iw dev "$wdev" del
done
}
mac80211_set_noscan() {
@ -952,15 +976,6 @@ drv_mac80211_setup() {
wireless_set_up
}
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
}
drv_mac80211_teardown() {
wireless_process_kill_all