aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/wps_supplicant.c
diff options
context:
space:
mode:
authorBharat Chakravarty <bchakrav@qca.qualcomm.com>2011-08-31 14:53:55 (GMT)
committerJouni Malinen <j@w1.fi>2011-08-31 14:53:55 (GMT)
commit6fb6d842bba34ce9579ca2f5f9406e00254030f2 (patch)
tree37599410f8ccaa6ac713e11fbd0f19cce32e837c /wpa_supplicant/wps_supplicant.c
parentae9c40035829b6b5fbb4ff48bd50781df54642b3 (diff)
downloadhostap-6fb6d842bba34ce9579ca2f5f9406e00254030f2.zip
hostap-6fb6d842bba34ce9579ca2f5f9406e00254030f2.tar.gz
hostap-6fb6d842bba34ce9579ca2f5f9406e00254030f2.tar.bz2
WPS: Set RF bands based on driver capabilities
Instead of hardcoding support for both 2.4 GHz and 5 GHz bands, use driver capabilities to figure out which bands are supported.
Diffstat (limited to 'wpa_supplicant/wps_supplicant.c')
-rw-r--r--wpa_supplicant/wps_supplicant.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index 6f70cad..222c8fc 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -1116,6 +1116,8 @@ int wpas_wps_init(struct wpa_supplicant *wpa_s)
{
struct wps_context *wps;
struct wps_registrar_config rcfg;
+ struct hostapd_hw_modes *modes;
+ u16 num_modes, flags, m;
wps = os_zalloc(sizeof(*wps));
if (wps == NULL)
@@ -1148,7 +1150,24 @@ int wpas_wps_init(struct wpa_supplicant *wpa_s)
WPS_DEV_TYPE_LEN * wps->dev.num_sec_dev_types);
wps->dev.os_version = WPA_GET_BE32(wpa_s->conf->os_version);
- wps->dev.rf_bands = WPS_RF_24GHZ | WPS_RF_50GHZ; /* TODO: config */
+ modes = wpa_drv_get_hw_feature_data(wpa_s, &num_modes, &flags);
+ if (modes) {
+ for (m = 0; m < num_modes; m++) {
+ if (modes[m].mode == HOSTAPD_MODE_IEEE80211B ||
+ modes[m].mode == HOSTAPD_MODE_IEEE80211G)
+ wps->dev.rf_bands |= WPS_RF_24GHZ;
+ else if (modes[m].mode == HOSTAPD_MODE_IEEE80211A)
+ wps->dev.rf_bands |= WPS_RF_50GHZ;
+ }
+ ieee80211_sta_free_hw_features(modes, num_modes);
+ }
+ if (wps->dev.rf_bands == 0) {
+ /*
+ * Default to claiming support for both bands if the driver
+ * does not provide support for fetching supported bands.
+ */
+ wps->dev.rf_bands = WPS_RF_24GHZ | WPS_RF_50GHZ;
+ }
os_memcpy(wps->dev.mac_addr, wpa_s->own_addr, ETH_ALEN);
wpas_wps_set_uuid(wpa_s, wps);