]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Restore station mode on deinit only if station when started
authorPeter Åstrand <astrand@lysator.liu.se>
Thu, 11 Mar 2021 20:58:48 +0000 (21:58 +0100)
committerJouni Malinen <j@w1.fi>
Fri, 12 Mar 2021 09:00:15 +0000 (11:00 +0200)
With the earlier code, a mesh interface was changed to station after
deinit.

Signed-off-by: Peter Astrand <peter.astrand@etteplan.com>
src/drivers/driver_nl80211.c
src/drivers/driver_nl80211.h

index c2721ae37425196267353b99a256a987a433654b..a67bef9a30ef68e94706ca22f5fd993b1ecacc53 100644 (file)
@@ -2839,8 +2839,8 @@ wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv,
                                set_addr)))
                return -1;
 
-       if (first && nl80211_get_ifmode(bss) == NL80211_IFTYPE_AP)
-               drv->start_mode_ap = 1;
+       if (first && nl80211_get_ifmode(bss) == NL80211_IFTYPE_STATION)
+               drv->start_mode_sta = 1;
 
        if (drv->hostapd || bss->static_ap)
                nlmode = NL80211_IFTYPE_AP;
@@ -3005,7 +3005,7 @@ static void wpa_driver_nl80211_deinit(struct i802_bss *bss)
        }
 
        if (drv->nlmode != NL80211_IFTYPE_P2P_DEVICE) {
-               if (!drv->hostapd || !drv->start_mode_ap)
+               if (drv->start_mode_sta)
                        wpa_driver_nl80211_set_mode(bss,
                                                    NL80211_IFTYPE_STATION);
                nl80211_mgmt_unsubscribe(bss, "deinit");
@@ -10550,7 +10550,8 @@ static int wpa_driver_nl80211_leave_mesh(void *priv)
                           "nl80211: mesh leave request send successfully");
        }
 
-       if (wpa_driver_nl80211_set_mode(drv->first_bss,
+       if (drv->start_mode_sta &&
+           wpa_driver_nl80211_set_mode(drv->first_bss,
                                        NL80211_IFTYPE_STATION)) {
                wpa_printf(MSG_INFO,
                           "nl80211: Failed to set interface into station mode");
index 945015bf20628e8d55fad89d8461246fade6e2e5..9d61c1d6930ff812ef1eace7522f5bd3c932d072 100644 (file)
@@ -149,7 +149,7 @@ struct wpa_driver_nl80211_data {
        unsigned int ignore_next_local_disconnect:1;
        unsigned int ignore_next_local_deauth:1;
        unsigned int hostapd:1;
-       unsigned int start_mode_ap:1;
+       unsigned int start_mode_sta:1;
        unsigned int start_iface_up:1;
        unsigned int test_use_roc_tx:1;
        unsigned int ignore_deauth_event:1;