ieee80211: Add 6E support when converting freq. to channel number.

Converting from freq to channel only needed the 6 GHz freq. range
to be added, however, converting from channel to freq. will require
the function ieee80211_chan_to_mhz to take a starting frequency as
there's overlap in the channel numbering between 2.4/5 GHz and 6 GHz
bands. This may not be possible in some cases, so for now the
function will continue to do the conversion based on the order
on which the freq. ranges are defined. Specifically, it will favor
2.4/5 GHz over 6 GHz.
This commit is contained in:
Adrian Granados 2021-09-30 11:50:47 -04:00 committed by Wireshark GitLab Utility
parent 41f4855443
commit da11ef5770
1 changed files with 13 additions and 14 deletions

View File

@ -24,16 +24,6 @@ typedef struct freq_cvt_s {
#define FREQ_STEP 5 /* MHz. This seems to be consistent, thankfully */
/*
* From IEEE Std 802.11-2012:
*
* section 16.4.6.3 "Channel Numbering of operating channels";
*
* section 17.4.6.3 "Channel Numbering of operating channels";
*
* section 18.3.8.4.2 "Channel numbering";
*
* Annex E.
*
* XXX - Japanese channels 182 through 196 actually have center
* frequencies that are off by 2.5 MHz from these values, according
* to the IEEE standard, although the table in ARIB STD T-71 version 5.2:
@ -47,10 +37,11 @@ typedef struct freq_cvt_s {
* XXX - what about 802.11ad?
*/
static freq_cvt_t freq_cvt[] = {
{ 2412, 2472, 1, TRUE },
{ 2484, 2484, 14, TRUE },
{ 5000, 5995, 0, FALSE },
{ 4910, 4980, 182, FALSE }
{ 2412, 2472, 1, TRUE }, /* IEEE Std 802.11-2020: Section 15.4.4.3 and Annex E */
{ 2484, 2484, 14, TRUE }, /* IEEE Std 802.11-2020: Section 15.4.4.3 and Annex E */
{ 5000, 5925, 0, FALSE }, /* IEEE Std 802.11-2020: Annex E */
{ 5950, 7125, 0, FALSE }, /* IEEE Std 802.11ax-2021: Annex E */
{ 4910, 4980, 182, FALSE },
};
#define NUM_FREQ_CVT (sizeof(freq_cvt) / sizeof(freq_cvt_t))
@ -73,6 +64,14 @@ ieee80211_mhz_to_chan(guint freq) {
/*
* Get Frequency given a Channel number
*
* XXX - Because channel numbering schemes for 2.4 and 5 overlap with 6 GHz,
* this function may not return the correct channel. For example, the frequency
* for channel 1 in 2.4 GHz band is 2412 MHz, while the frequency for channel 1
* in the 6 GHz band is 5955 MHz. To resolve this problem, this function needs
* to take a starting frequency to convert channel to frequencies correctly.
* Unfortunately, this is not possible in some cases, so for now, the order on
* which frequency ranges are defined will favor 2.4 and 5 GHz over 6 GHz.
*/
guint
ieee80211_chan_to_mhz(gint chan, gboolean is_bg) {