3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-01 23:59:51 +01:00

device: Drop unsupported bands from roam scan frequency set

The kernel will reject the TRIGGER_SCAN commands that include
frequencies not supported by the wiphy.
This commit is contained in:
Andrew Zaborowski 2018-04-09 19:26:40 +02:00 committed by Denis Kenzior
parent 6de76f97b4
commit d9ae78b780

View File

@ -1180,7 +1180,7 @@ static void device_roam_scan(struct device *device,
} }
static uint32_t device_freq_from_neighbor_report(const uint8_t *country, static uint32_t device_freq_from_neighbor_report(const uint8_t *country,
struct ie_neighbor_report_info *info) struct ie_neighbor_report_info *info, enum scan_band *out_band)
{ {
enum scan_band band; enum scan_band band;
uint32_t freq; uint32_t freq;
@ -1219,6 +1219,9 @@ static uint32_t device_freq_from_neighbor_report(const uint8_t *country,
return 0; return 0;
} }
if (out_band)
*out_band = band;
return freq; return freq;
} }
@ -1256,6 +1259,7 @@ static void device_neighbor_report_cb(struct netdev *netdev, int err,
while (ie_tlv_iter_next(&iter)) { while (ie_tlv_iter_next(&iter)) {
struct ie_neighbor_report_info info; struct ie_neighbor_report_info info;
uint32_t freq; uint32_t freq;
enum scan_band band;
const uint8_t *cc = NULL; const uint8_t *cc = NULL;
if (ie_tlv_iter_get_tag(&iter) != IE_TYPE_NEIGHBOR_REPORT) if (ie_tlv_iter_get_tag(&iter) != IE_TYPE_NEIGHBOR_REPORT)
@ -1273,10 +1277,14 @@ static void device_neighbor_report_cb(struct netdev *netdev, int err,
if (device->connected_bss->cc_present) if (device->connected_bss->cc_present)
cc = device->connected_bss->cc; cc = device->connected_bss->cc;
freq = device_freq_from_neighbor_report(cc, &info); freq = device_freq_from_neighbor_report(cc, &info, &band);
if (!freq) if (!freq)
continue; continue;
/* Skip if the band is not supported */
if (!(band & wiphy_get_supported_bands(device->wiphy)))
continue;
if (!memcmp(info.addr, device->connected_bss->addr, ETH_ALEN)) { if (!memcmp(info.addr, device->connected_bss->addr, ETH_ALEN)) {
/* /*
* If this report is for the current AP, don't add * If this report is for the current AP, don't add