Add error handling for offloaded ACS with vendor command failures

In case vendor ACS command returns invalid channel or hardware mode,
complete the interface setup with an error code instead of simply
return, so that hostapd can properly clean up the interface setup.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Peng Xu 2016-03-01 11:13:25 -08:00 committed by Jouni Malinen
parent bef5e9a862
commit e1d00d47c7

View File

@ -570,6 +570,7 @@ void hostapd_acs_channel_selected(struct hostapd_data *hapd,
struct acs_selected_channels *acs_res) struct acs_selected_channels *acs_res)
{ {
int ret, i; int ret, i;
int err = 0;
if (hapd->iconf->channel) { if (hapd->iconf->channel) {
wpa_printf(MSG_INFO, "ACS: Channel was already set to %d", wpa_printf(MSG_INFO, "ACS: Channel was already set to %d",
@ -591,7 +592,8 @@ void hostapd_acs_channel_selected(struct hostapd_data *hapd,
hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
HOSTAPD_LEVEL_WARNING, HOSTAPD_LEVEL_WARNING,
"driver selected to bad hw_mode"); "driver selected to bad hw_mode");
return; err = 1;
goto out;
} }
} }
@ -601,7 +603,8 @@ void hostapd_acs_channel_selected(struct hostapd_data *hapd,
hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
HOSTAPD_LEVEL_WARNING, HOSTAPD_LEVEL_WARNING,
"driver switched to bad channel"); "driver switched to bad channel");
return; err = 1;
goto out;
} }
hapd->iconf->channel = acs_res->pri_channel; hapd->iconf->channel = acs_res->pri_channel;
@ -615,7 +618,8 @@ void hostapd_acs_channel_selected(struct hostapd_data *hapd,
hapd->iconf->secondary_channel = 1; hapd->iconf->secondary_channel = 1;
else { else {
wpa_printf(MSG_ERROR, "Invalid secondary channel!"); wpa_printf(MSG_ERROR, "Invalid secondary channel!");
return; err = 1;
goto out;
} }
if (hapd->iface->conf->ieee80211ac) { if (hapd->iface->conf->ieee80211ac) {
@ -644,7 +648,8 @@ void hostapd_acs_channel_selected(struct hostapd_data *hapd,
} }
} }
ret = hostapd_acs_completed(hapd->iface, 0); out:
ret = hostapd_acs_completed(hapd->iface, err);
if (ret) { if (ret) {
wpa_printf(MSG_ERROR, wpa_printf(MSG_ERROR,
"ACS: Possibly channel configuration is invalid"); "ACS: Possibly channel configuration is invalid");