nl80211: Restore station mode on deinit only if station when started

With the earlier code, a mesh interface was changed to station after
deinit.

Signed-off-by: Peter Astrand <peter.astrand@etteplan.com>
This commit is contained in:
Peter Åstrand 2021-03-11 21:58:48 +01:00 committed by Jouni Malinen
parent 5013897532
commit 2f2a570755
2 changed files with 6 additions and 5 deletions

View file

@ -2839,8 +2839,8 @@ wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv,
set_addr))) set_addr)))
return -1; return -1;
if (first && nl80211_get_ifmode(bss) == NL80211_IFTYPE_AP) if (first && nl80211_get_ifmode(bss) == NL80211_IFTYPE_STATION)
drv->start_mode_ap = 1; drv->start_mode_sta = 1;
if (drv->hostapd || bss->static_ap) if (drv->hostapd || bss->static_ap)
nlmode = NL80211_IFTYPE_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->nlmode != NL80211_IFTYPE_P2P_DEVICE) {
if (!drv->hostapd || !drv->start_mode_ap) if (drv->start_mode_sta)
wpa_driver_nl80211_set_mode(bss, wpa_driver_nl80211_set_mode(bss,
NL80211_IFTYPE_STATION); NL80211_IFTYPE_STATION);
nl80211_mgmt_unsubscribe(bss, "deinit"); nl80211_mgmt_unsubscribe(bss, "deinit");
@ -10550,7 +10550,8 @@ static int wpa_driver_nl80211_leave_mesh(void *priv)
"nl80211: mesh leave request send successfully"); "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)) { NL80211_IFTYPE_STATION)) {
wpa_printf(MSG_INFO, wpa_printf(MSG_INFO,
"nl80211: Failed to set interface into station mode"); "nl80211: Failed to set interface into station mode");

View file

@ -149,7 +149,7 @@ struct wpa_driver_nl80211_data {
unsigned int ignore_next_local_disconnect:1; unsigned int ignore_next_local_disconnect:1;
unsigned int ignore_next_local_deauth:1; unsigned int ignore_next_local_deauth:1;
unsigned int hostapd: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 start_iface_up:1;
unsigned int test_use_roc_tx:1; unsigned int test_use_roc_tx:1;
unsigned int ignore_deauth_event:1; unsigned int ignore_deauth_event:1;