diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index c2721ae37..a67bef9a3 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -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"); diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h index 945015bf2..9d61c1d69 100644 --- a/src/drivers/driver_nl80211.h +++ b/src/drivers/driver_nl80211.h @@ -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;