Extend hostapd to support setband to driver via QCA vendor command

Commit 844dfeb804 ("QCA vendor command support to set band to driver")
added a vendor command to pass 'SET setband' command information to the
driver in wpa_supplicant. Add similar changes to hostapd control
interface.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Hu Wang 2019-10-23 17:54:18 +08:00 committed by Jouni Malinen
parent 3c13af5573
commit 38203148e9
2 changed files with 37 additions and 0 deletions

View file

@ -1326,6 +1326,33 @@ static void hostapd_disassoc_deny_mac(struct hostapd_data *hapd)
}
}
static int hostapd_ctrl_iface_set_band(struct hostapd_data *hapd,
const char *band)
{
union wpa_event_data event;
enum set_band setband;
if (os_strcmp(band, "AUTO") == 0)
setband = WPA_SETBAND_AUTO;
else if (os_strcmp(band, "5G") == 0)
setband = WPA_SETBAND_5G;
else if (os_strcmp(band, "2G") == 0)
setband = WPA_SETBAND_2G;
else
return -1;
if (hostapd_drv_set_band(hapd, setband) == 0) {
os_memset(&event, 0, sizeof(event));
event.channel_list_changed.initiator = REGDOM_SET_BY_USER;
event.channel_list_changed.type = REGDOM_TYPE_UNKNOWN;
wpa_supplicant_event(hapd, EVENT_CHANNEL_LIST_CHANGED, &event);
}
return 0;
}
static int hostapd_ctrl_iface_set(struct hostapd_data *hapd, char *cmd)
{
char *value;
@ -1409,6 +1436,8 @@ static int hostapd_ctrl_iface_set(struct hostapd_data *hapd, char *cmd)
os_free(hapd->dpp_configurator_params);
hapd->dpp_configurator_params = os_strdup(value);
#endif /* CONFIG_DPP */
} else if (os_strcasecmp(cmd, "setband") == 0) {
ret = hostapd_ctrl_iface_set_band(hapd, value);
} else {
ret = hostapd_set_iface(hapd->iconf, hapd->conf, cmd, value);
if (ret)

View file

@ -382,4 +382,12 @@ hostapd_drv_send_external_auth_status(struct hostapd_data *hapd,
return hapd->driver->send_external_auth_status(hapd->drv_priv, params);
}
static inline int
hostapd_drv_set_band(struct hostapd_data *hapd, enum set_band band)
{
if (!hapd->driver || !hapd->drv_priv || !hapd->driver->set_band)
return -1;
return hapd->driver->set_band(hapd->drv_priv, band);
}
#endif /* AP_DRV_OPS */