DFS channels should not be actively scanned as we can't be sure
if we are allowed or not.
If the current channel is in the DFS band, active scan might be
performed after CSA, but we have no guarantee about other channels,
therefore it is safer to prevent active scanning at all.
Signed-off-by: Antonio Quartulli <[email protected]>
---
v2: remove unused scan_req argument in ieee80211_scan_get_channel_time()
net/mac80211/scan.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 4aeca4b..ce01f74 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -599,7 +599,8 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
if ((req->channels[0]->flags &
IEEE80211_CHAN_NO_IR) ||
- !req->n_ssids) {
+ !req->n_ssids ||
+ (req->channels[0]->flags & IEEE80211_CHAN_RADAR)) {
next_delay = IEEE80211_PASSIVE_CHANNEL_TIME;
} else {
ieee80211_scan_state_send_probe(local, &next_delay);
@@ -645,7 +646,8 @@ ieee80211_scan_get_channel_time(struct ieee80211_channel *chan)
* TODO: channel switching also consumes quite some time,
* add that delay as well to get a better estimation
*/
- if (chan->flags & IEEE80211_CHAN_NO_IR)
+ if ((chan->flags & IEEE80211_CHAN_NO_IR) ||
+ (chan->flags & IEEE80211_CHAN_RADAR))
return IEEE80211_PASSIVE_CHANNEL_TIME;
return IEEE80211_PROBE_DELAY + IEEE80211_CHANNEL_TIME;
}
@@ -698,7 +700,8 @@ static void ieee80211_scan_state_decision(struct ieee80211_local *local,
*/
bad_latency = time_after(jiffies +
- ieee80211_scan_get_channel_time(next_chan),
+ ieee80211_scan_get_channel_time(next_chan,
+ scan_req),
local->leave_oper_channel_time + HZ / 8);
if (associated && !tx_empty) {
@@ -777,7 +780,8 @@ static void ieee80211_scan_state_set_channel(struct ieee80211_local *local,
*
* In any case, it is not necessary for a passive scan.
*/
- if (chan->flags & IEEE80211_CHAN_NO_IR || !scan_req->n_ssids) {
+ if (chan->flags & IEEE80211_CHAN_NO_IR || !scan_req->n_ssids ||
+ (chan->flags & IEEE80211_CHAN_RADAR)) {
*next_delay = IEEE80211_PASSIVE_CHANNEL_TIME;
local->next_scan_state = SCAN_DECISION;
return;
--
2.6.3
Hi Antonio,
[auto build test ERROR on: mac80211-next/master]
[also build test ERROR on: v4.4-rc1 next-20151120]
url: https://github.com/0day-ci/linux/commits/Antonio-Quartulli/mac80211-do-not-actively-scan-DFS-channels/20151121-181426
base: https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
config: xtensa-allyesconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa
All error/warnings (new ones prefixed by >>):
In file included from include/linux/irqflags.h:14:0,
from include/asm-generic/bitops/atomic.h:5,
from arch/xtensa/include/asm/bitops.h:222,
from include/linux/bitops.h:36,
from include/linux/kernel.h:10,
from include/linux/skbuff.h:17,
from include/linux/if_arp.h:26,
from net/mac80211/scan.c:16:
net/mac80211/scan.c: In function 'ieee80211_scan_state_decision':
>> net/mac80211/scan.c:703:6: error: too many arguments to function 'ieee80211_scan_get_channel_time'
ieee80211_scan_get_channel_time(next_chan,
^
include/linux/typecheck.h:10:9: note: in definition of macro 'typecheck'
typeof(x) __dummy2; \
^
>> net/mac80211/scan.c:702:16: note: in expansion of macro 'time_after'
bad_latency = time_after(jiffies +
^
net/mac80211/scan.c:643:1: note: declared here
ieee80211_scan_get_channel_time(struct ieee80211_channel *chan)
^
In file included from include/linux/ktime.h:25:0,
from include/linux/rcupdate.h:47,
from include/linux/rbtree.h:34,
from include/linux/mm_types.h:9,
from include/linux/kmemcheck.h:4,
from include/linux/skbuff.h:18,
from include/linux/if_arp.h:26,
from net/mac80211/scan.c:16:
>> net/mac80211/scan.c:703:6: error: too many arguments to function 'ieee80211_scan_get_channel_time'
ieee80211_scan_get_channel_time(next_chan,
^
include/linux/jiffies.h:105:18: note: in definition of macro 'time_after'
((long)((b) - (a)) < 0))
^
net/mac80211/scan.c:643:1: note: declared here
ieee80211_scan_get_channel_time(struct ieee80211_channel *chan)
^
vim +/ieee80211_scan_get_channel_time +703 net/mac80211/scan.c
696 * see if we can scan another channel without interfering
697 * with the current traffic situation.
698 *
699 * Keep good latency, do not stay off-channel more than 125 ms.
700 */
701
> 702 bad_latency = time_after(jiffies +
> 703 ieee80211_scan_get_channel_time(next_chan,
704 scan_req),
705 local->leave_oper_channel_time + HZ / 8);
706
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation