Add error handling for offloaded ACS with vendor command failures
authorPeng Xu <pxu@qca.qualcomm.com>
Tue, 1 Mar 2016 19:13:25 +0000 (11:13 -0800)
committerJouni Malinen <j@w1.fi>
Thu, 3 Mar 2016 10:19:43 +0000 (12:19 +0200)
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>
src/ap/drv_callbacks.c

index 803ca8e..f54d1ad 100644 (file)
@@ -570,6 +570,7 @@ void hostapd_acs_channel_selected(struct hostapd_data *hapd,
                                  struct acs_selected_channels *acs_res)
 {
        int ret, i;
+       int err = 0;
 
        if (hapd->iconf->channel) {
                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_LEVEL_WARNING,
                                       "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_LEVEL_WARNING,
                               "driver switched to bad channel");
-               return;
+               err = 1;
+               goto out;
        }
 
        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;
        else {
                wpa_printf(MSG_ERROR, "Invalid secondary channel!");
-               return;
+               err = 1;
+               goto out;
        }
 
        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) {
                wpa_printf(MSG_ERROR,
                           "ACS: Possibly channel configuration is invalid");