Re: [PATCH wireless v2] nl80211/cfg80211: add nla_policy for S1G band

From: Jeff Johnson
Date: Mon Jan 22 2024 - 14:00:21 EST


On 1/20/2024 12:27 PM, Johannes Berg wrote:
> On Fri, 2024-01-19 at 15:47 -0800, Jeff Johnson wrote:
>>> --- a/net/wireless/nl80211.c
>>> +++ b/net/wireless/nl80211.c
>>> @@ -911,6 +911,7 @@ nl80211_match_band_rssi_policy[NUM_NL80211_BANDS] = {
>>> [NL80211_BAND_5GHZ] = { .type = NLA_S32 },
>>> [NL80211_BAND_6GHZ] = { .type = NLA_S32 },
>>> [NL80211_BAND_60GHZ] = { .type = NLA_S32 },
>>> + [NL80211_BAND_S1GHZ] = { .type = NLA_S32 },
>>> [NL80211_BAND_LC] = { .type = NLA_S32 },
>>> };
>>>
>> something is really suspicious since the NL80211_BAND_* enums are
>> *value* enums, not attribute ID enums, and hence they should never be
>> used in an nla_policy.
>
> Yeah, that's what it looks like first, but then they do get used
> anyway...
>
>> what is actually using these as attribute IDs, noting that
>> NL80211_BAND_2GHZ == 0 and hence cannot be used as an attribute ID
>
> Ohh. Good catch!
>
>> seems the logic that introduced this policy needs to be revisited.
>>
>
> Let's just remove it?
>
> commit 1e1b11b6a1111cd9e8af1fd6ccda270a9fa3eacf
> Author: vamsi krishna <vamsin@xxxxxxxxxxxxxx>
> Date: Fri Feb 1 18:34:51 2019 +0530
>
> nl80211/cfg80211: Specify band specific min RSSI thresholds with sched scan
>
>
> As far as I can tell nothing is using that in the first place ...
> Certainly not in the kernel, nor wpa_s, nor anything else I could find
> really ...
>
> We can't completely revert it since we need the attribute number to stay
> allocated, but that's all we cannot remove.

I'm investigating this and will report back.