aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHu Wang <huw@codeaurora.org>2019-10-23 09:54:18 (GMT)
committerJouni Malinen <j@w1.fi>2019-12-02 13:55:43 (GMT)
commit38203148e99b13e7c26cebe43404b976d8108b07 (patch)
tree3af0a060dd0b75130c0385be6bd5c139ab1c9823
parent3c13af55731c06ca24f7df0734f11b94649a7d39 (diff)
downloadhostap-38203148e99b13e7c26cebe43404b976d8108b07.zip
hostap-38203148e99b13e7c26cebe43404b976d8108b07.tar.gz
hostap-38203148e99b13e7c26cebe43404b976d8108b07.tar.bz2
Extend hostapd to support setband to driver via QCA vendor command
Commit 844dfeb804af ("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>
-rw-r--r--hostapd/ctrl_iface.c29
-rw-r--r--src/ap/ap_drv_ops.h8
2 files changed, 37 insertions, 0 deletions
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index 1f1cea1..00febc3 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -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)
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
index 79b1302..fa413df 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -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 */