mac80211: gracefully handle preexisting VIF
[openwrt/openwrt.git] / package / kernel / mac80211 / files / lib / netifd / wireless / mac80211.sh
index cda6f9f438c89fb78a834c60251c13bd53a10eb6..ebd24df0d3e984bf2afc5997207509f8150509b2 100644 (file)
@@ -429,6 +429,12 @@ mac80211_iw_interface_add() {
                rc="$?"
        }
 
                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
 }
        [ "$rc" != 0 ] && wireless_setup_failed INTERFACE_CREATION_FAILED
        return $rc
 }