diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2023-10-22 12:01:37 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2023-10-22 12:01:37 +0000 |
commit | 621447e46e4454c863f809ea801570378ff568c8 (patch) | |
tree | 9079b369f27a091d8d1896c24c8529ece8a4ca44 /sys | |
parent | a93ca7580d181fc41ee0a5f7899cd281fa2ba37a (diff) |
fix 40 MHz channel validation checks for the 2.4 GHz channel range
Just like the 5 GHz channels, 2.4 GHz channels are spaced 5 MHz apart.
40 MHz wide channels hence span channels [N, N + 4] not [N, N + 1].
Adjust our secondary channel range checks accordingly.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net80211/ieee80211_node.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index 48fe04c60d1..e3c5fc207b0 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_node.c,v 1.197 2023/10/21 06:47:23 stsp Exp $ */ +/* $OpenBSD: ieee80211_node.c,v 1.198 2023/10/22 12:01:36 stsp Exp $ */ /* $NetBSD: ieee80211_node.c,v 1.14 2004/05/09 09:18:47 dyoung Exp $ */ /*- @@ -2396,15 +2396,14 @@ int ieee80211_40mhz_valid_secondary_above(uint8_t primary_chan) { static const uint8_t valid_secondary_chan[] = { - 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 40, 48, 56, 64, 104, 112, 120, 128, 136, 144, 153, 161 }; uint8_t secondary_chan; int i; - if (primary_chan >= 1 && primary_chan <= 13) - secondary_chan = primary_chan + 1; - else if (primary_chan >= 36 && primary_chan <= 157) + if ((primary_chan >= 1 && primary_chan <= 9) || + (primary_chan >= 36 && primary_chan <= 157)) secondary_chan = primary_chan + 4; else return 0; @@ -2421,15 +2420,14 @@ int ieee80211_40mhz_valid_secondary_below(uint8_t primary_chan) { static const uint8_t valid_secondary_chan[] = { - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 36, 44, 52, 60, 100, 108, 116, 124, 132, 140, 149, 157 }; int8_t secondary_chan; int i; - if (primary_chan >= 2 && primary_chan <= 14) - secondary_chan = primary_chan - 1; - else if (primary_chan >= 40 && primary_chan <= 161) + if ((primary_chan >= 5 && primary_chan <= 13) || + (primary_chan >= 40 && primary_chan <= 161)) secondary_chan = primary_chan - 4; else return 0; |