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 8301e61365 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>
v19.07.3_mercusys_ac12_duma
Jo-Philipp Wich 7 years ago
parent 37e7a1734f
commit 4a03347545

@ -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
}

Loading…
Cancel
Save