mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 06:29:23 +01:00
nl80211util: check band when parsing supported frequencies
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.
This commit is contained in:
parent
8e10e00904
commit
e0727bfeb6
@ -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,
|
int nl80211_parse_supported_frequencies(struct l_genl_attr *band_freqs,
|
||||||
struct scan_freq_set *supported_list,
|
struct scan_freq_set *supported_list,
|
||||||
struct band_freq_attrs *list,
|
struct band *band)
|
||||||
size_t num_channels)
|
|
||||||
{
|
{
|
||||||
uint16_t type, len;
|
uint16_t type, len;
|
||||||
const void *data;
|
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)) {
|
while (l_genl_attr_next(&nested, NULL, NULL, NULL)) {
|
||||||
uint32_t freq = 0;
|
uint32_t freq = 0;
|
||||||
struct band_freq_attrs freq_attr = { 0 };
|
struct band_freq_attrs freq_attr = { 0 };
|
||||||
|
enum band_freq out_band;
|
||||||
|
|
||||||
if (!l_genl_attr_recurse(&nested, &attr))
|
if (!l_genl_attr_recurse(&nested, &attr))
|
||||||
continue;
|
continue;
|
||||||
@ -752,17 +752,20 @@ int nl80211_parse_supported_frequencies(struct l_genl_attr *band_freqs,
|
|||||||
if (!freq)
|
if (!freq)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
channel = band_freq_to_channel(freq, NULL);
|
channel = band_freq_to_channel(freq, &out_band);
|
||||||
if (!channel)
|
if (!channel)
|
||||||
continue;
|
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;
|
continue;
|
||||||
|
|
||||||
if (supported_list)
|
if (supported_list)
|
||||||
scan_freq_set_add(supported_list, freq);
|
scan_freq_set_add(supported_list, freq);
|
||||||
|
|
||||||
list[channel] = freq_attr;
|
band->freq_attrs[channel] = freq_attr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -26,6 +26,7 @@ struct band_chandef;
|
|||||||
struct scan_freq_set;
|
struct scan_freq_set;
|
||||||
struct band_freq_attrs;
|
struct band_freq_attrs;
|
||||||
struct handshake_state;
|
struct handshake_state;
|
||||||
|
struct band;
|
||||||
|
|
||||||
int nl80211_parse_attrs(struct l_genl_msg *msg, int tag, ...);
|
int nl80211_parse_attrs(struct l_genl_msg *msg, int tag, ...);
|
||||||
int nl80211_parse_nested(struct l_genl_attr *attr, int type, 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_chandef(struct l_genl_msg *msg, struct band_chandef *out);
|
||||||
int nl80211_parse_supported_frequencies(struct l_genl_attr *band_freqs,
|
int nl80211_parse_supported_frequencies(struct l_genl_attr *band_freqs,
|
||||||
struct scan_freq_set *supported_list,
|
struct scan_freq_set *supported_list,
|
||||||
struct band_freq_attrs *list,
|
struct band *band);
|
||||||
size_t num_channels);
|
|
||||||
|
|
||||||
void nl80211_append_rsn_attributes(struct l_genl_msg *msg,
|
void nl80211_append_rsn_attributes(struct l_genl_msg *msg,
|
||||||
struct handshake_state *hs);
|
struct handshake_state *hs);
|
||||||
|
@ -1699,8 +1699,7 @@ static void parse_supported_bands(struct wiphy *wiphy,
|
|||||||
case NL80211_BAND_ATTR_FREQS:
|
case NL80211_BAND_ATTR_FREQS:
|
||||||
nl80211_parse_supported_frequencies(&attr,
|
nl80211_parse_supported_frequencies(&attr,
|
||||||
wiphy->supported_freqs,
|
wiphy->supported_freqs,
|
||||||
band->freq_attrs,
|
band);
|
||||||
band->freqs_len);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NL80211_BAND_ATTR_RATES:
|
case NL80211_BAND_ATTR_RATES:
|
||||||
@ -2234,9 +2233,7 @@ static void wiphy_dump_callback(struct l_genl_msg *msg,
|
|||||||
* theory no new frequencies should be added so there
|
* theory no new frequencies should be added so there
|
||||||
* should never be any stale values.
|
* should never be any stale values.
|
||||||
*/
|
*/
|
||||||
nl80211_parse_supported_frequencies(&attr, NULL,
|
nl80211_parse_supported_frequencies(&attr, NULL, band);
|
||||||
band->freq_attrs,
|
|
||||||
band->freqs_len);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user