nl80211: Restore previous nlmode if set_freq for AP mode fails
wpa_driver_nl80211_ap() returned error if set_freq failed, but left the previously set nlmode to GO/AP. While this should not be issue for most purposes, it leaves the interface in somewhat unexpected state and could potentially affect operations prior to next connection attempt. Address this by restoring the previous nlmode if AP mode cannot be started for some reason. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
190e39d9cb
commit
708bc8e0e4
1 changed files with 10 additions and 3 deletions
|
@ -6604,7 +6604,7 @@ static int wpa_driver_nl80211_sta_set_flags(void *priv, const u8 *addr,
|
|||
static int wpa_driver_nl80211_ap(struct wpa_driver_nl80211_data *drv,
|
||||
struct wpa_driver_associate_params *params)
|
||||
{
|
||||
enum nl80211_iftype nlmode;
|
||||
enum nl80211_iftype nlmode, old_mode;
|
||||
|
||||
if (params->p2p) {
|
||||
wpa_printf(MSG_DEBUG, "nl80211: Setup AP operations for P2P "
|
||||
|
@ -6613,8 +6613,15 @@ static int wpa_driver_nl80211_ap(struct wpa_driver_nl80211_data *drv,
|
|||
} else
|
||||
nlmode = NL80211_IFTYPE_AP;
|
||||
|
||||
if (wpa_driver_nl80211_set_mode(&drv->first_bss, nlmode) ||
|
||||
wpa_driver_nl80211_set_freq(&drv->first_bss, params->freq, 0, 0)) {
|
||||
old_mode = drv->nlmode;
|
||||
if (wpa_driver_nl80211_set_mode(&drv->first_bss, nlmode)) {
|
||||
nl80211_remove_monitor_interface(drv);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (wpa_driver_nl80211_set_freq(&drv->first_bss, params->freq, 0, 0)) {
|
||||
if (old_mode != nlmode)
|
||||
wpa_driver_nl80211_set_mode(&drv->first_bss, old_mode);
|
||||
nl80211_remove_monitor_interface(drv);
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue