mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 21:22:37 +01:00
device: Workaround for 0 oper class in Neighbor Report
Some APs respond to Neighbor Report Requests with neighbor reports that have a zero operating class value and a non-zero channel number. This does not mean that the channel is in the same band that the reporting AP operates in. Try to guess the band that the channel refers to out of 2.4 and 5GHz -- the bands supported by those APs. wpa_supplicant also has this workaround in place.
This commit is contained in:
parent
e348c8e0ce
commit
d42e848567
28
src/device.c
28
src/device.c
@ -1184,11 +1184,31 @@ static uint32_t device_freq_from_neighbor_report(const uint8_t *country,
|
|||||||
enum scan_band band;
|
enum scan_band band;
|
||||||
uint32_t freq;
|
uint32_t freq;
|
||||||
|
|
||||||
band = scan_oper_class_to_band(country, info->oper_class);
|
if (info->oper_class == 0) {
|
||||||
if (!band) {
|
/*
|
||||||
l_debug("Ignored: unsupported oper class");
|
* Some Cisco APs report all operating class values as 0
|
||||||
|
* in the Neighbor Report Responses. Work around this by
|
||||||
|
* using the most likely operating class for the channel
|
||||||
|
* number as the 2.4GHz and 5GHz bands happen to mostly
|
||||||
|
* use channels in two disjoint ranges.
|
||||||
|
*/
|
||||||
|
if (info->channel_num >= 1 && info->channel_num <= 14)
|
||||||
|
band = SCAN_BAND_2_4_GHZ;
|
||||||
|
else if (info->channel_num >= 36 && info->channel_num <= 169)
|
||||||
|
band = SCAN_BAND_5_GHZ;
|
||||||
|
else {
|
||||||
|
l_debug("Ignored: 0 oper class with an unusual "
|
||||||
|
"channel number");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
band = scan_oper_class_to_band(country, info->oper_class);
|
||||||
|
if (!band) {
|
||||||
|
l_debug("Ignored: unsupported oper class");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
freq = scan_channel_to_freq(info->channel_num, band);
|
freq = scan_channel_to_freq(info->channel_num, band);
|
||||||
|
Loading…
Reference in New Issue
Block a user