Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2156563iof; Tue, 7 Jun 2022 21:39:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy25+zvbt9Cb7dZxTZcUpxHhsZar4Kpgy1u0y5TUTEf/Rcr5iPukDID+EcVjqbZ9kNmw3AL X-Received: by 2002:a63:31d0:0:b0:3fc:5770:e779 with SMTP id x199-20020a6331d0000000b003fc5770e779mr27996996pgx.376.1654663140157; Tue, 07 Jun 2022 21:39:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654663140; cv=none; d=google.com; s=arc-20160816; b=qZjLjV+dlXZs4nuoigrnShX7wT7HFPMa3G21HVAOUHuvDsNEFfYEse4JRNcKLHSZ38 ooJ3yz1RqhWE8c2kH31ntKjbU30csef9A1xdcvOvvmTSK4K2sxgYEAb8mf0AROIssQKC GLCDC/nxZhJ3vNuaerXJJvtBtN2f8HouQJmrPmdoAeWnLwTRrHgzZczm9DjO8wD51Rvc d+KQlg/JwqcOWv4p1gjzT2F+UTiphza5x2Gt0ln8G8+Lspqd2Hym+mIJ5lrPjq+U+eCI iU8U9kM4P/S9p65v3vncD13setpCXIrhShooiCAggD0qnabdnZ7LdPNWE204LnXme7wl 9gbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xmzGPHCviWlQhxYuBI3VVUzAk6WvZ2vOxRp9GyhTCzM=; b=OHM6It+rOR5nOC3gl3UIyYrWGA6HTjUBAQzjTyl8zH1JnaZXzTYeVN/1RhLjFbUP2o V/ma2rowGEePi88FxS+tqyjHEQspduwFagCEcyroXE0LoXtZQor7EKMQwBl68kaeYEte cN1ZCmjXq9rAbycObcusyx5EbQP7nyrX7tco4KsbAb06luJZymTDTLKGgGHMlCpZYXGR 9Obd+iWEy9uuzoHGkJFJPozozJFTegC/H4Fg+OdjLa5QpwRbe/uGfxJBLod2uceY03YE 49h6/+4WKqycDTIfJvKYJiZoYK2zDNWt9r6sQEsuzzsxA5C9m0He7klc2l2duubTass6 VfqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eeOKZbnL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l12-20020a056a00140c00b0051c395582d3si5736195pfu.186.2022.06.07.21.38.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 21:39:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eeOKZbnL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6113D28D692; Tue, 7 Jun 2022 21:07:31 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349807AbiFGSE7 (ORCPT + 99 others); Tue, 7 Jun 2022 14:04:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349062AbiFGRqo (ORCPT ); Tue, 7 Jun 2022 13:46:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07A2562BC4; Tue, 7 Jun 2022 10:36:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 979BF60DB5; Tue, 7 Jun 2022 17:36:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A65A9C385A5; Tue, 7 Jun 2022 17:36:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654623382; bh=mLUZPnwtxYepKpeekuKglrgz00FKKljKZilx1rGoNw4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eeOKZbnL95rtuzSKH49pVZALv8rOdyxP41Vh8/HbPkRAcfyzcaszlqbhM2i74fL7w p+bPqkUjT2I3YF37Udt7cp7WRXIefQGcvRLbSZoBeVO9ect5wyHliEfuWQInybuzaH 1DTKr95cGn5ETF63DlLQ1V8RpaFFXXzctGkZNopI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Catrinel Catrinescu , Felix Fietkau , Johannes Berg Subject: [PATCH 5.10 397/452] mac80211: upgrade passive scan to active scan on DFS channels after beacon rx Date: Tue, 7 Jun 2022 19:04:14 +0200 Message-Id: <20220607164920.391930459@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164908.521895282@linuxfoundation.org> References: <20220607164908.521895282@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Felix Fietkau commit b041b7b9de6e1d4362de855ab90f9d03ef323edd upstream. In client mode, we can't connect to hidden SSID APs or SSIDs not advertised in beacons on DFS channels, since we're forced to passive scan. Fix this by sending out a probe request immediately after the first beacon, if active scan was requested by the user. Cc: stable@vger.kernel.org Reported-by: Catrinel Catrinescu Signed-off-by: Felix Fietkau Link: https://lore.kernel.org/r/20220420104907.36275-1-nbd@nbd.name Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- net/mac80211/ieee80211_i.h | 5 +++++ net/mac80211/scan.c | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -1103,6 +1103,9 @@ struct tpt_led_trigger { * a scan complete for an aborted scan. * @SCAN_HW_CANCELLED: Set for our scan work function when the scan is being * cancelled. + * @SCAN_BEACON_WAIT: Set whenever we're passive scanning because of radar/no-IR + * and could send a probe request after receiving a beacon. + * @SCAN_BEACON_DONE: Beacon received, we can now send a probe request */ enum { SCAN_SW_SCANNING, @@ -1111,6 +1114,8 @@ enum { SCAN_COMPLETED, SCAN_ABORTED, SCAN_HW_CANCELLED, + SCAN_BEACON_WAIT, + SCAN_BEACON_DONE, }; /** --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c @@ -277,6 +277,16 @@ void ieee80211_scan_rx(struct ieee80211_ if (likely(!sdata1 && !sdata2)) return; + if (test_and_clear_bit(SCAN_BEACON_WAIT, &local->scanning)) { + /* + * we were passive scanning because of radar/no-IR, but + * the beacon/proberesp rx gives us an opportunity to upgrade + * to active scan + */ + set_bit(SCAN_BEACON_DONE, &local->scanning); + ieee80211_queue_delayed_work(&local->hw, &local->scan_work, 0); + } + if (ieee80211_is_probe_resp(mgmt->frame_control)) { struct cfg80211_scan_request *scan_req; struct cfg80211_sched_scan_request *sched_scan_req; @@ -783,6 +793,8 @@ static int __ieee80211_start_scan(struct IEEE80211_CHAN_RADAR)) || !req->n_ssids) { next_delay = IEEE80211_PASSIVE_CHANNEL_TIME; + if (req->n_ssids) + set_bit(SCAN_BEACON_WAIT, &local->scanning); } else { ieee80211_scan_state_send_probe(local, &next_delay); next_delay = IEEE80211_CHANNEL_TIME; @@ -994,6 +1006,8 @@ set_channel: !scan_req->n_ssids) { *next_delay = IEEE80211_PASSIVE_CHANNEL_TIME; local->next_scan_state = SCAN_DECISION; + if (scan_req->n_ssids) + set_bit(SCAN_BEACON_WAIT, &local->scanning); return; } @@ -1086,6 +1100,8 @@ void ieee80211_scan_work(struct work_str goto out; } + clear_bit(SCAN_BEACON_WAIT, &local->scanning); + /* * as long as no delay is required advance immediately * without scheduling a new work @@ -1096,6 +1112,10 @@ void ieee80211_scan_work(struct work_str goto out_complete; } + if (test_and_clear_bit(SCAN_BEACON_DONE, &local->scanning) && + local->next_scan_state == SCAN_DECISION) + local->next_scan_state = SCAN_SEND_PROBE; + switch (local->next_scan_state) { case SCAN_DECISION: /* if no more bands/channels left, complete scan */