aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2017-05-14 19:47:07 +0200
committerJo-Philipp Wich <jo@mein.io>2017-12-13 15:29:01 +0100
commitf0a493160cbc3feb683b6efb23ec80e0564d1be2 (patch)
tree1036a983ad24e16c44c0df5822971f8565037378 /package/kernel
parent827f108b42504bd468a771cf610373d16f8fd378 (diff)
downloadupstream-f0a493160cbc3feb683b6efb23ec80e0564d1be2.tar.gz
upstream-f0a493160cbc3feb683b6efb23ec80e0564d1be2.tar.bz2
upstream-f0a493160cbc3feb683b6efb23ec80e0564d1be2.zip
mac80211: gracefully handle preexisting VIF
Gracefully handle cases where the to-be-created wireless interface already exists on the system which might commonly happen with non-multi-SSID capable wireless drivers. This fixes commit 8301e613655c2d95fa5430a1a57d92d966fdc70b which caused previously ignored "Too many open files in system (-23)" errors to fail the wireless setup procedure. With the updated approach we'll still try recreating the vif after one second if the first attempt to do so failed with ENFILE but we will now consider the operation successfull if a second attempt still yields ENFILE with the requested ifname already existing on the system. Fixes FS#664, FS#704. Suggested-by: Vittorio Gambaletta <openwrt@vittgam.net> Signed-off-by: Jo-Philipp Wich <jo@mein.io> (cherry picked from commit 4a033475453b63d0d5ae41489e7c395882567698)
Diffstat (limited to 'package/kernel')
-rw-r--r--package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
index cda6f9f438..ebd24df0d3 100644
--- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
+++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
@@ -429,6 +429,12 @@ mac80211_iw_interface_add() {
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.
+ ip link show dev "$ifname" >/dev/null 2>/dev/null && rc=0
+ }
+
[ "$rc" != 0 ] && wireless_setup_failed INTERFACE_CREATION_FAILED
return $rc
}