Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2197548iof; Tue, 7 Jun 2022 22:56:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7vPLFXmez18wKYdqTd4FW02MY3PatP5JI41UEPmmoRjkt1v2jmirbCo920OsP1wUN2bzG X-Received: by 2002:a63:8443:0:b0:3fc:a29a:49ae with SMTP id k64-20020a638443000000b003fca29a49aemr28875598pgd.592.1654667807236; Tue, 07 Jun 2022 22:56:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654667807; cv=none; d=google.com; s=arc-20160816; b=L+hd6cF3wU9xXAy5CGUodCfoKbLQZIxodLiolTJLspGzvR2iRCRXubMYrnjMSRRB5/ poqSrU19IU5508PLSi0+dVEWCB6B/+6JCBenw7nh1oaZsGpSG80H97nWnFUBFeq9iZly 0TijxxvZq+n+CviN+/dPhDDgQgqF1u6PMcg6K19iGaRQVSqdxK9H0yka6pp4dCS6CgxL LQx7avw8MknGClniFIELrBEalzMG0kx/t2rRlskqhYKjyHeHovyCEwHwjxzKHeyxmEaE Yxtm0zA0fYqkCNyUWPAzaNdO/PfIHzUvEXeg4n8Uguq6xNWN8uvbKo3CMxSbo+AKyjdT svrw== 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=qNesbpt0qh5171+k8g50nKhTdDyU8ka6TISl2LZrzi0=; b=QoHNOHq0VJzqQYfVqlGcmy5CiR28Hzz+WWv5jvR2VHkncqeq/iwJVaI6Ed2bfky3mg 4kJiqEHHrE6H2vHRtCme8HTNh7ybzTwodwUzOfZDhUyhM/JfJWXO/45MzsfJ0ydUiazl Enmx0bdl5haPVAJCq8GhmdJ4BUC2Q0HkvIo+LeKZ+qOvS8Eu6VZcEPJwDMhZI/hcbcP6 SAiFtOBAytAUtSuBF04LUa0oR8pVXSsQ4PrUEhOe1/JfMFZiJbH0ZvuetH6fcyT9NEZd GMD7vFQ/S0KARcUHQvq4y2zENEFo/IaUj4kKhW2rw3ylE2Lo13TDFIUm/UtaR2jewZNm 4yog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QXIqRFvh; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id k190-20020a6384c7000000b003fcc0510870si25656910pgd.388.2022.06.07.22.56.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:56:47 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QXIqRFvh; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 5A6D426183F; Tue, 7 Jun 2022 22:22:52 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443503AbiFHA6K (ORCPT + 99 others); Tue, 7 Jun 2022 20:58:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384352AbiFGWZZ (ORCPT ); Tue, 7 Jun 2022 18:25:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24B1227040A; Tue, 7 Jun 2022 12:23:03 -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 ams.source.kernel.org (Postfix) with ESMTPS id B176DB823D5; Tue, 7 Jun 2022 19:23:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18FE7C385A2; Tue, 7 Jun 2022 19:22:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654629780; bh=Cg3ArwRd1oLn1Qcn5mD0py4uevjjvn1SuGSAybqOjzM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QXIqRFvhjg25lLT3KYnqxeqC9pssAxrCWrV1DzK4AooZsjgw3kM5uNMtZombpdL4Y 4JN2hQ4m5Bv+f2YzBC2vnNfUmGU1C+tWUfUuJUe/OXm5Xk/Br4HxBcTyahhQSbfI7x YoYNvttfy1aIbbCExRDoB9XcaS4mHNZhYSmxDXp0= 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.18 815/879] mac80211: upgrade passive scan to active scan on DFS channels after beacon rx Date: Tue, 7 Jun 2022 19:05:33 +0200 Message-Id: <20220607165026.513040981@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@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 @@ -1148,6 +1148,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, @@ -1156,6 +1159,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 @@ -281,6 +281,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; @@ -787,6 +797,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; @@ -998,6 +1010,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; } @@ -1090,6 +1104,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 @@ -1100,6 +1116,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 */