| From aaa8ad411db97a885da1d3a7f925df38df294f75 Mon Sep 17 00:00:00 2001 |
| From: Michael-CY Lee <michael-cy.lee@mediatek.com> |
| Date: Thu, 9 May 2024 09:24:43 +0800 |
| Subject: [PATCH 68/89] mtk: mac80211: legacy AP scan request should contain |
| valid channels |
| |
| In single-wiphy, if scan_freqs is not specified in scan request, |
| mac80211 will trigger a scan that includes all bands. |
| However, legacy AP should only scan the channels of its operating band. |
| |
| This commit adds the checks for including valid channels in legacy AP |
| scan. |
| |
| Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com> |
| |
| preset_chandef is only set on the first wdev of each phy, so we refer to |
| another data structure for the band of current wdev. |
| |
| Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com> |
| --- |
| net/wireless/nl80211.c | 21 +++++++++++++++++++++ |
| 1 file changed, 21 insertions(+) |
| |
| diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c |
| index ea251a9..cb14460 100644 |
| --- a/net/wireless/nl80211.c |
| +++ b/net/wireless/nl80211.c |
| @@ -9382,6 +9382,12 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) |
| n_channels = validate_scan_freqs(scan_freqs); |
| if (!n_channels) |
| return -EINVAL; |
| + } else if (wdev->iftype == NL80211_IFTYPE_AP && !wdev->valid_links) { |
| + struct ieee80211_channel *chan = wdev->links[0].ap.chandef.chan; |
| + if (!chan || !wiphy->bands[chan->band]) |
| + return -EINVAL; |
| + |
| + n_channels = wiphy->bands[chan->band]->n_channels; |
| } else { |
| n_channels = ieee80211_get_num_supported_channels(wiphy); |
| } |
| @@ -9434,6 +9440,21 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) |
| } |
| |
| /* ignore disabled channels */ |
| + if (chan->flags & IEEE80211_CHAN_DISABLED) |
| + continue; |
| + |
| + request->channels[i] = chan; |
| + i++; |
| + } |
| + } else if (wdev->iftype == NL80211_IFTYPE_AP && !wdev->valid_links) { |
| + enum nl80211_band band = wdev->links[0].ap.chandef.chan->band; |
| + int j; |
| + |
| + for (j = 0; j < wiphy->bands[band]->n_channels; j++) { |
| + struct ieee80211_channel *chan; |
| + |
| + chan = &wiphy->bands[band]->channels[j]; |
| + |
| if (chan->flags & IEEE80211_CHAN_DISABLED) |
| continue; |
| |
| -- |
| 2.18.0 |
| |