aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel/mac80211
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2020-04-17 13:11:11 +0100
committerDaniel Golle <daniel@makrotopia.org>2020-04-17 13:31:58 +0100
commit0495324b9bd0b6a976ea731a1b4b77b26df32ee6 (patch)
tree6c6f93a4c958f7fc814c02c508c31fb56a59d492 /package/kernel/mac80211
parentedf812e25c9fd3d660b6918f2cea74d53221bdf7 (diff)
downloadupstream-0495324b9bd0b6a976ea731a1b4b77b26df32ee6.tar.gz
upstream-0495324b9bd0b6a976ea731a1b4b77b26df32ee6.tar.bz2
upstream-0495324b9bd0b6a976ea731a1b4b77b26df32ee6.zip
mac80211: make sure existing iface belongs to correct (fullmac) phy
Some FullMAC cfg80211 wireless devices do not support virtual interfaces, hence there is script logic to keep the existing network device. Improve this to support renaming the interface if needed and make sure the existing interface actually belongs to the right phy. Change calls to 'iw' to avoid outputing warnings and errors to not confuse users of such devices. Also bump PKG_RELEASE which has been forgotten in the previous two mac80211 changes. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'package/kernel/mac80211')
-rw-r--r--package/kernel/mac80211/Makefile2
-rw-r--r--package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh26
2 files changed, 19 insertions, 9 deletions
diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
index d01b689260..26c5ef4b1a 100644
--- a/package/kernel/mac80211/Makefile
+++ b/package/kernel/mac80211/Makefile
@@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=mac80211
PKG_VERSION:=5.4.27-1
-PKG_RELEASE:=2
+PKG_RELEASE:=3
PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.4.27/
PKG_HASH:=4c853a2f4c4fcc81cf60a3d59c5efbdb60c3e4acda22996cb192443581753950
diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
index 501b1ad0de..1ebdceaab8 100644
--- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
+++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
@@ -440,15 +440,16 @@ mac80211_iw_interface_add() {
local type="$3"
local wdsflag="$4"
local rc
+ local oldifname
- iw phy "$phy" interface add "$ifname" type "$type" $wdsflag
+ iw phy "$phy" interface add "$ifname" type "$type" $wdsflag >/dev/null 2>&1
rc="$?"
[ "$rc" = 233 ] && {
# Device might have just been deleted, give the kernel some time to finish cleaning it up
sleep 1
- iw phy "$phy" interface add "$ifname" type "$type" $wdsflag
+ iw phy "$phy" interface add "$ifname" type "$type" $wdsflag >/dev/null 2>&1
rc="$?"
}
@@ -475,17 +476,26 @@ mac80211_iw_interface_add() {
}
[ "$rc" = 233 ] && {
- iw dev "$ifname" del
- sleep 1
+ iw dev "$ifname" del >/dev/null 2>&1
+ [ "$?" = 0 ] && {
+ sleep 1
- iw phy "$phy" interface add "$ifname" type "$type" $wdsflag
- rc="$?"
+ iw phy "$phy" interface add "$ifname" type "$type" $wdsflag >/dev/null 2>&1
+ rc="$?"
+ }
}
- [ "$rc" = 233 ] && {
+ [ "$rc" != 0 ] && {
# 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.
- ip link show dev "$ifname" >/dev/null 2>/dev/null && rc=0
+ [ -d "/sys/class/ieee80211/${phy}/device/net/${ifname}" ] && rc=0
+ }
+
+ [ "$rc" != 0 ] && {
+ # Device doesn't support virtual interfaces and may have existing interface other than ifname.
+ oldifname="$(basename "/sys/class/ieee80211/${phy}/device/net"/* 2>/dev/null)"
+ [ "$oldifname" ] && ip link set "$oldifname" name "$ifname" 1>/dev/null 2>&1
+ rc="$?"
}
[ "$rc" != 0 ] && wireless_setup_failed INTERFACE_CREATION_FAILED