mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-25 00:38:24 -05:00
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.
This commit is contained in:
parent
ae9c400358
commit
6fb6d842bb
@ -1116,6 +1116,8 @@ int wpas_wps_init(struct wpa_supplicant *wpa_s)
|
|||||||
{
|
{
|
||||||
struct wps_context *wps;
|
struct wps_context *wps;
|
||||||
struct wps_registrar_config rcfg;
|
struct wps_registrar_config rcfg;
|
||||||
|
struct hostapd_hw_modes *modes;
|
||||||
|
u16 num_modes, flags, m;
|
||||||
|
|
||||||
wps = os_zalloc(sizeof(*wps));
|
wps = os_zalloc(sizeof(*wps));
|
||||||
if (wps == NULL)
|
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_TYPE_LEN * wps->dev.num_sec_dev_types);
|
||||||
|
|
||||||
wps->dev.os_version = WPA_GET_BE32(wpa_s->conf->os_version);
|
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);
|
os_memcpy(wps->dev.mac_addr, wpa_s->own_addr, ETH_ALEN);
|
||||||
wpas_wps_set_uuid(wpa_s, wps);
|
wpas_wps_set_uuid(wpa_s, wps);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user