1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Thu, 26 Sep 2024 14:06:11 +0200
3 Subject: [PATCH] wifi: mac80211: use vif radio mask to limit ibss scan
6 Reject frequencies not supported by any radio that the vif is allowed to use.
8 Signed-off-by: Felix Fietkau <nbd@nbd.name>
11 --- a/net/mac80211/scan.c
12 +++ b/net/mac80211/scan.c
13 @@ -1178,14 +1178,14 @@ int ieee80211_request_ibss_scan(struct i
14 unsigned int n_channels)
16 struct ieee80211_local *local = sdata->local;
17 - int ret = -EBUSY, i, n_ch = 0;
19 enum nl80211_band band;
21 lockdep_assert_wiphy(local->hw.wiphy);
28 /* fill internal scan request */
30 @@ -1202,7 +1202,9 @@ int ieee80211_request_ibss_scan(struct i
31 &local->hw.wiphy->bands[band]->channels[i];
33 if (tmp_ch->flags & (IEEE80211_CHAN_NO_IR |
34 - IEEE80211_CHAN_DISABLED))
35 + IEEE80211_CHAN_DISABLED) ||
36 + !cfg80211_wdev_channel_allowed(&sdata->wdev,
40 local->int_scan_req->channels[n_ch] = tmp_ch;
41 @@ -1211,21 +1213,23 @@ int ieee80211_request_ibss_scan(struct i
44 if (WARN_ON_ONCE(n_ch == 0))
48 local->int_scan_req->n_channels = n_ch;
50 for (i = 0; i < n_channels; i++) {
51 if (channels[i]->flags & (IEEE80211_CHAN_NO_IR |
52 - IEEE80211_CHAN_DISABLED))
53 + IEEE80211_CHAN_DISABLED) ||
54 + !cfg80211_wdev_channel_allowed(&sdata->wdev,
58 local->int_scan_req->channels[n_ch] = channels[i];
62 - if (WARN_ON_ONCE(n_ch == 0))
67 local->int_scan_req->n_channels = n_ch;
69 @@ -1235,9 +1239,7 @@ int ieee80211_request_ibss_scan(struct i
70 memcpy(local->int_scan_req->ssids[0].ssid, ssid, IEEE80211_MAX_SSID_LEN);
71 local->int_scan_req->ssids[0].ssid_len = ssid_len;
73 - ret = __ieee80211_start_scan(sdata, sdata->local->int_scan_req);
76 + return __ieee80211_start_scan(sdata, sdata->local->int_scan_req);
79 void ieee80211_scan_cancel(struct ieee80211_local *local)