* [PATCH 1/5] band: correct oper class 136 starting frequency
@ 2024-10-24 16:46 James Prestwood
2024-10-24 16:46 ` [PATCH 2/5] nl80211util: check band when parsing supported frequencies James Prestwood
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: James Prestwood @ 2024-10-24 16:46 UTC (permalink / raw)
To: iwd; +Cc: James Prestwood
This should be 5925, not 5950
---
src/band.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/band.c b/src/band.c
index 14daeb37..4e8eb9b0 100644
--- a/src/band.c
+++ b/src/band.c
@@ -896,7 +896,7 @@ static const struct operating_class_info e4_operating_classes[] = {
},
{
.operating_class = 136,
- .starting_frequency = 5950,
+ .starting_frequency = 5925,
.channel_spacing = 20,
.center_frequencies = { 2 },
}
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/5] nl80211util: check band when parsing supported frequencies
2024-10-24 16:46 [PATCH 1/5] band: correct oper class 136 starting frequency James Prestwood
@ 2024-10-24 16:46 ` James Prestwood
2024-10-24 16:46 ` [PATCH 3/5] band: check the operating class band before checking e4 James Prestwood
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: James Prestwood @ 2024-10-24 16:46 UTC (permalink / raw)
To: iwd; +Cc: James Prestwood
When the frequencies/channels were parsed there was no check that the
resulting band matched what was expected. Now, pass the band object
itself in which has the band set to what is expected.
---
src/nl80211util.c | 13 ++++++++-----
src/nl80211util.h | 4 ++--
src/wiphy.c | 7 ++-----
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/nl80211util.c b/src/nl80211util.c
index 7590f90c..0fdefddf 100644
--- a/src/nl80211util.c
+++ b/src/nl80211util.c
@@ -697,8 +697,7 @@ int nl80211_parse_chandef(struct l_genl_msg *msg, struct band_chandef *out)
int nl80211_parse_supported_frequencies(struct l_genl_attr *band_freqs,
struct scan_freq_set *supported_list,
- struct band_freq_attrs *list,
- size_t num_channels)
+ struct band *band)
{
uint16_t type, len;
const void *data;
@@ -712,6 +711,7 @@ int nl80211_parse_supported_frequencies(struct l_genl_attr *band_freqs,
while (l_genl_attr_next(&nested, NULL, NULL, NULL)) {
uint32_t freq = 0;
struct band_freq_attrs freq_attr = { 0 };
+ enum band_freq out_band;
if (!l_genl_attr_recurse(&nested, &attr))
continue;
@@ -752,17 +752,20 @@ int nl80211_parse_supported_frequencies(struct l_genl_attr *band_freqs,
if (!freq)
continue;
- channel = band_freq_to_channel(freq, NULL);
+ channel = band_freq_to_channel(freq, &out_band);
if (!channel)
continue;
- if (L_WARN_ON(channel > num_channels))
+ if (L_WARN_ON(out_band != band->freq))
+ continue;
+
+ if (L_WARN_ON(channel > band->freqs_len))
continue;
if (supported_list)
scan_freq_set_add(supported_list, freq);
- list[channel] = freq_attr;
+ band->freq_attrs[channel] = freq_attr;
}
return 0;
diff --git a/src/nl80211util.h b/src/nl80211util.h
index 67fd7d7b..9f28b089 100644
--- a/src/nl80211util.h
+++ b/src/nl80211util.h
@@ -26,6 +26,7 @@ struct band_chandef;
struct scan_freq_set;
struct band_freq_attrs;
struct handshake_state;
+struct band;
int nl80211_parse_attrs(struct l_genl_msg *msg, int tag, ...);
int nl80211_parse_nested(struct l_genl_attr *attr, int type, int tag, ...);
@@ -95,8 +96,7 @@ struct l_genl_msg *nl80211_build_external_auth(uint32_t ifindex,
int nl80211_parse_chandef(struct l_genl_msg *msg, struct band_chandef *out);
int nl80211_parse_supported_frequencies(struct l_genl_attr *band_freqs,
struct scan_freq_set *supported_list,
- struct band_freq_attrs *list,
- size_t num_channels);
+ struct band *band);
void nl80211_append_rsn_attributes(struct l_genl_msg *msg,
struct handshake_state *hs);
diff --git a/src/wiphy.c b/src/wiphy.c
index d57d657a..d2793491 100644
--- a/src/wiphy.c
+++ b/src/wiphy.c
@@ -1706,8 +1706,7 @@ static void parse_supported_bands(struct wiphy *wiphy,
case NL80211_BAND_ATTR_FREQS:
nl80211_parse_supported_frequencies(&attr,
wiphy->supported_freqs,
- band->freq_attrs,
- band->freqs_len);
+ band);
break;
case NL80211_BAND_ATTR_RATES:
@@ -2288,9 +2287,7 @@ static void wiphy_dump_callback(struct l_genl_msg *msg,
* theory no new frequencies should be added so there
* should never be any stale values.
*/
- nl80211_parse_supported_frequencies(&attr, NULL,
- band->freq_attrs,
- band->freqs_len);
+ nl80211_parse_supported_frequencies(&attr, NULL, band);
}
}
}
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/5] band: check the operating class band before checking e4
2024-10-24 16:46 [PATCH 1/5] band: correct oper class 136 starting frequency James Prestwood
2024-10-24 16:46 ` [PATCH 2/5] nl80211util: check band when parsing supported frequencies James Prestwood
@ 2024-10-24 16:46 ` James Prestwood
2024-10-24 16:46 ` [PATCH 4/5] scan: warn on zero frequency when adding to request James Prestwood
2024-10-24 16:46 ` [PATCH 5/5] util: warn on invalid channels when iterating a frequency set James Prestwood
3 siblings, 0 replies; 6+ messages in thread
From: James Prestwood @ 2024-10-24 16:46 UTC (permalink / raw)
To: iwd; +Cc: James Prestwood
After the band is established we check the e4 table for the channel
that matches. The problem here is we will end up checking all the
operating classes, even those that are not within the band that was
determined. This could result in false positives and return a
channel that doesn't make sense.
---
src/band.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/band.c b/src/band.c
index 4e8eb9b0..09b2d932 100644
--- a/src/band.c
+++ b/src/band.c
@@ -1352,6 +1352,10 @@ check_e4:
const struct operating_class_info *info =
&e4_operating_classes[i];
+ if (band != band_oper_class_to_band(NULL,
+ info->operating_class))
+ continue;
+
if (e4_has_frequency(info, freq) == 0 ||
e4_has_ccfi(info, freq) == 0) {
if (out_band)
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/5] scan: warn on zero frequency when adding to request
2024-10-24 16:46 [PATCH 1/5] band: correct oper class 136 starting frequency James Prestwood
2024-10-24 16:46 ` [PATCH 2/5] nl80211util: check band when parsing supported frequencies James Prestwood
2024-10-24 16:46 ` [PATCH 3/5] band: check the operating class band before checking e4 James Prestwood
@ 2024-10-24 16:46 ` James Prestwood
2024-10-24 17:13 ` Denis Kenzior
2024-10-24 16:46 ` [PATCH 5/5] util: warn on invalid channels when iterating a frequency set James Prestwood
3 siblings, 1 reply; 6+ messages in thread
From: James Prestwood @ 2024-10-24 16:46 UTC (permalink / raw)
To: iwd; +Cc: James Prestwood
This shouldn't ever happen, but if it does we want to alert the user.
---
src/scan.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/scan.c b/src/scan.c
index 2ffbef6d..c1ccc234 100644
--- a/src/scan.c
+++ b/src/scan.c
@@ -292,6 +292,9 @@ static void scan_freq_append(uint32_t freq, void *user_data)
{
struct scan_freq_append_data *data = user_data;
+ if (L_WARN_ON(!freq))
+ return;
+
l_genl_msg_append_attr(data->msg, data->count++, 4, &freq);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 5/5] util: warn on invalid channels when iterating a frequency set
2024-10-24 16:46 [PATCH 1/5] band: correct oper class 136 starting frequency James Prestwood
` (2 preceding siblings ...)
2024-10-24 16:46 ` [PATCH 4/5] scan: warn on zero frequency when adding to request James Prestwood
@ 2024-10-24 16:46 ` James Prestwood
3 siblings, 0 replies; 6+ messages in thread
From: James Prestwood @ 2024-10-24 16:46 UTC (permalink / raw)
To: iwd; +Cc: James Prestwood
This should not happen but if it does we should alert the user.
---
src/util.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/util.c b/src/util.c
index 5ce764ae..8c690fc0 100644
--- a/src/util.c
+++ b/src/util.c
@@ -464,6 +464,11 @@ static void scan_channels_foreach(uint32_t channel, void *user_data)
uint32_t freq;
freq = band_channel_to_freq(channel, channels_data->band);
+ if (!freq) {
+ l_warn("invalid channel %u for band %u", channel,
+ channels_data->band);
+ return;
+ }
channels_data->func(freq, channels_data->user_data);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 4/5] scan: warn on zero frequency when adding to request
2024-10-24 16:46 ` [PATCH 4/5] scan: warn on zero frequency when adding to request James Prestwood
@ 2024-10-24 17:13 ` Denis Kenzior
0 siblings, 0 replies; 6+ messages in thread
From: Denis Kenzior @ 2024-10-24 17:13 UTC (permalink / raw)
To: James Prestwood, iwd
Hi James,
On 10/24/24 11:46 AM, James Prestwood wrote:
> This shouldn't ever happen, but if it does we want to alert the user.
> ---
> src/scan.c | 3 +++
> 1 file changed, 3 insertions(+)
>
This patch was redundant due to patch 5, so I dropped this. The rest applied,
thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-10-24 17:13 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-24 16:46 [PATCH 1/5] band: correct oper class 136 starting frequency James Prestwood
2024-10-24 16:46 ` [PATCH 2/5] nl80211util: check band when parsing supported frequencies James Prestwood
2024-10-24 16:46 ` [PATCH 3/5] band: check the operating class band before checking e4 James Prestwood
2024-10-24 16:46 ` [PATCH 4/5] scan: warn on zero frequency when adding to request James Prestwood
2024-10-24 17:13 ` Denis Kenzior
2024-10-24 16:46 ` [PATCH 5/5] util: warn on invalid channels when iterating a frequency set James Prestwood
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox