]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Extend hostapd to support setband to driver via QCA vendor command
authorHu Wang <huw@codeaurora.org>
Wed, 23 Oct 2019 09:54:18 +0000 (17:54 +0800)
committerJouni Malinen <j@w1.fi>
Mon, 2 Dec 2019 13:55:43 +0000 (15:55 +0200)
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>
hostapd/ctrl_iface.c
src/ap/ap_drv_ops.h

index 1f1cea1114f4910035c10c2108ea1d4d6b4c2033..00febc30f19db4f1246a412b7214e61c18e46d09 100644 (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)
index 79b1302ac30cd24e5a75135698d76874958489bc..fa413df08d89819d5fa7421017f7cbd1af628e68 100644 (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 */