nl80211: support receiving split frequencies
In order to get more details about each frequency we will need to set NL80211_ATTR_SPLIT_WIPHY_DUMP in the future. This will result in our callback being called multiple times. Modify it to support such a scenario: 1) Start putting new frequencies after the last set one 2) Make sure that attribute is set before iterating it Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Acked-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
335967c6c2
commit
5c10efa2cb
1 changed files with 26 additions and 19 deletions
|
@ -2367,18 +2367,23 @@ static int nl80211_get_freqlist_cb(struct nl_msg *msg, void *arg)
|
||||||
int bands_remain, freqs_remain;
|
int bands_remain, freqs_remain;
|
||||||
|
|
||||||
struct nl80211_array_buf *arr = arg;
|
struct nl80211_array_buf *arr = arg;
|
||||||
struct iwinfo_freqlist_entry *e = arr->buf;
|
struct iwinfo_freqlist_entry *e;
|
||||||
|
|
||||||
struct nlattr **attr = nl80211_parse(msg);
|
struct nlattr **attr = nl80211_parse(msg);
|
||||||
struct nlattr *bands[NL80211_BAND_ATTR_MAX + 1];
|
struct nlattr *bands[NL80211_BAND_ATTR_MAX + 1];
|
||||||
struct nlattr *freqs[NL80211_FREQUENCY_ATTR_MAX + 1];
|
struct nlattr *freqs[NL80211_FREQUENCY_ATTR_MAX + 1];
|
||||||
struct nlattr *band, *freq;
|
struct nlattr *band, *freq;
|
||||||
|
|
||||||
|
e = arr->buf;
|
||||||
|
e += arr->count;
|
||||||
|
|
||||||
|
if (attr[NL80211_ATTR_WIPHY_BANDS]) {
|
||||||
nla_for_each_nested(band, attr[NL80211_ATTR_WIPHY_BANDS], bands_remain)
|
nla_for_each_nested(band, attr[NL80211_ATTR_WIPHY_BANDS], bands_remain)
|
||||||
{
|
{
|
||||||
nla_parse(bands, NL80211_BAND_ATTR_MAX,
|
nla_parse(bands, NL80211_BAND_ATTR_MAX,
|
||||||
nla_data(band), nla_len(band), NULL);
|
nla_data(band), nla_len(band), NULL);
|
||||||
|
|
||||||
|
if (bands[NL80211_BAND_ATTR_FREQS]) {
|
||||||
nla_for_each_nested(freq, bands[NL80211_BAND_ATTR_FREQS], freqs_remain)
|
nla_for_each_nested(freq, bands[NL80211_BAND_ATTR_FREQS], freqs_remain)
|
||||||
{
|
{
|
||||||
nla_parse(freqs, NL80211_FREQUENCY_ATTR_MAX,
|
nla_parse(freqs, NL80211_FREQUENCY_ATTR_MAX,
|
||||||
|
@ -2400,6 +2405,8 @@ static int nl80211_get_freqlist_cb(struct nl_msg *msg, void *arg)
|
||||||
arr->count++;
|
arr->count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return NL_SKIP;
|
return NL_SKIP;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue