mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-27 17:18:59 +00:00
87033c3a0b
- add support for configuring allowed radios for a vif - add support for monitor mode on multiple channels Signed-off-by: Felix Fietkau <nbd@nbd.name>
80 lines
2.2 KiB
Diff
80 lines
2.2 KiB
Diff
From: Felix Fietkau <nbd@nbd.name>
|
|
Date: Thu, 26 Sep 2024 14:06:11 +0200
|
|
Subject: [PATCH] wifi: mac80211: use vif radio mask to limit ibss scan
|
|
frequencies
|
|
|
|
Reject frequencies not supported by any radio that the vif is allowed to use.
|
|
|
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
---
|
|
|
|
--- a/net/mac80211/scan.c
|
|
+++ b/net/mac80211/scan.c
|
|
@@ -1178,14 +1178,14 @@ int ieee80211_request_ibss_scan(struct i
|
|
unsigned int n_channels)
|
|
{
|
|
struct ieee80211_local *local = sdata->local;
|
|
- int ret = -EBUSY, i, n_ch = 0;
|
|
+ int i, n_ch = 0;
|
|
enum nl80211_band band;
|
|
|
|
lockdep_assert_wiphy(local->hw.wiphy);
|
|
|
|
/* busy scanning */
|
|
if (local->scan_req)
|
|
- goto unlock;
|
|
+ return -EBUSY;
|
|
|
|
/* fill internal scan request */
|
|
if (!channels) {
|
|
@@ -1202,7 +1202,9 @@ int ieee80211_request_ibss_scan(struct i
|
|
&local->hw.wiphy->bands[band]->channels[i];
|
|
|
|
if (tmp_ch->flags & (IEEE80211_CHAN_NO_IR |
|
|
- IEEE80211_CHAN_DISABLED))
|
|
+ IEEE80211_CHAN_DISABLED) ||
|
|
+ !cfg80211_wdev_channel_allowed(&sdata->wdev,
|
|
+ tmp_ch))
|
|
continue;
|
|
|
|
local->int_scan_req->channels[n_ch] = tmp_ch;
|
|
@@ -1211,21 +1213,23 @@ int ieee80211_request_ibss_scan(struct i
|
|
}
|
|
|
|
if (WARN_ON_ONCE(n_ch == 0))
|
|
- goto unlock;
|
|
+ return -EINVAL;
|
|
|
|
local->int_scan_req->n_channels = n_ch;
|
|
} else {
|
|
for (i = 0; i < n_channels; i++) {
|
|
if (channels[i]->flags & (IEEE80211_CHAN_NO_IR |
|
|
- IEEE80211_CHAN_DISABLED))
|
|
+ IEEE80211_CHAN_DISABLED) ||
|
|
+ !cfg80211_wdev_channel_allowed(&sdata->wdev,
|
|
+ channels[i]))
|
|
continue;
|
|
|
|
local->int_scan_req->channels[n_ch] = channels[i];
|
|
n_ch++;
|
|
}
|
|
|
|
- if (WARN_ON_ONCE(n_ch == 0))
|
|
- goto unlock;
|
|
+ if (n_ch == 0)
|
|
+ return -EINVAL;
|
|
|
|
local->int_scan_req->n_channels = n_ch;
|
|
}
|
|
@@ -1235,9 +1239,7 @@ int ieee80211_request_ibss_scan(struct i
|
|
memcpy(local->int_scan_req->ssids[0].ssid, ssid, IEEE80211_MAX_SSID_LEN);
|
|
local->int_scan_req->ssids[0].ssid_len = ssid_len;
|
|
|
|
- ret = __ieee80211_start_scan(sdata, sdata->local->int_scan_req);
|
|
- unlock:
|
|
- return ret;
|
|
+ return __ieee80211_start_scan(sdata, sdata->local->int_scan_req);
|
|
}
|
|
|
|
void ieee80211_scan_cancel(struct ieee80211_local *local)
|