Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp588744iog; Mon, 13 Jun 2022 08:41:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgzAeSlFIEjW9XJejzUQxAP0c9NedKwErhJezXuSWuxz5SiiqzP9oV+Y1BFweF3wNS+yUY X-Received: by 2002:a17:90a:3e83:b0:1ea:b4d6:de76 with SMTP id k3-20020a17090a3e8300b001eab4d6de76mr4960263pjc.188.1655134878846; Mon, 13 Jun 2022 08:41:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655134878; cv=none; d=google.com; s=arc-20160816; b=UaUDl5gcxdivDTWYoC/CYG7q21+XKj+NrRToSboDIkZR+mmSu8RyNDKC4XuHCxZ9cG tc9AYOrxI82N38mVNcgFf3v+y7qsRF8g+6bZ4AM52bjukkmDLx+lt992/74QsL1YFxJK Rnwo+YQ1q0HrmudXddOWkp6hVcOCwn7+B5dtuZuis1sWQisaabxqE42Am2fIeFUG2iw2 JgLPz9hOL3/XCMm4DmeUy0nYrsyZV09k0fLAG/GF3z5tpNU4rRW4B2ooW9V/zV6qPXo5 5oSWUI+/3Pq729Wh4s14Ei9Q5xiszLHziLfg8aCqKlzC9FMulrwKBDwj3bKvbCsRiTRF yA1Q== 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=wtUcE/ptyuuBf9Va5z2UD2sxKXXVlB8X2HAW1zhOUJk=; b=eqiv4zYYI8tpY24RUrb5eB/w6YT1x7tbnOFYOKxefUnw79schvCd+OI3/oGxLKunHh N6XNeP8pupbiqz/0aJfHTT/D3yh9kVmGCXA/SBzTiKYPgwXMbqkKAXHCHztrQ9h9aVDC Xe5iZ8ba2+EY+PrkHfZRAIacd9I45//U+6h8Nnp6Rxv0cry8xM2Y+0i/Ax8NrgeSrbhv 9Mfeb0EurY6YhOJcOIKaGfbyJjCD/Fm78ekFdougOaZDECP8oF3rbdS0+0gLaU/8M+5Z GsLQofuTOv3cJHPWT39GoP2t15fuY7VDhiyvoV2c/9csC0carZjB6wNYBj9+6iX7J02m IiaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZsKCYcJZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bk11-20020a056a02028b00b004019bf283d2si11805248pgb.554.2022.06.13.08.41.07; Mon, 13 Jun 2022 08:41:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZsKCYcJZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244825AbiFMK1M (ORCPT + 99 others); Mon, 13 Jun 2022 06:27:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243870AbiFMKXk (ORCPT ); Mon, 13 Jun 2022 06:23:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94AB922BDB; Mon, 13 Jun 2022 03:18:05 -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 8446760AEC; Mon, 13 Jun 2022 10:18:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 917B2C3411F; Mon, 13 Jun 2022 10:18:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655115483; bh=MFJphTd9ebMQtaL1Iz22xfgXn5aSIxE9rsODUuWuKBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZsKCYcJZZqP9CboBfdwO/CaR8xOclxIFCp5EugcHTouvSQ3STSgLtJVxNr9qqyHph NDVAgn94/neh99Uo4XpDGZ8MDMjPANMgHZIOKBJj9VEHcsOqNaXjv/a3VZEqy6OGr0 ifTQjW/gnI5x1EwX9/Nb/LLhCpUWg3KS3ZIS/JeY= 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 4.9 093/167] mac80211: upgrade passive scan to active scan on DFS channels after beacon rx Date: Mon, 13 Jun 2022 12:09:27 +0200 Message-Id: <20220613094902.746908186@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094840.720778945@linuxfoundation.org> References: <20220613094840.720778945@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=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 @@ -1066,6 +1066,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, @@ -1074,6 +1077,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 @@ -205,6 +205,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; @@ -646,6 +656,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; @@ -826,6 +838,8 @@ static void ieee80211_scan_state_set_cha !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; } @@ -918,6 +932,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 @@ -928,6 +944,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 */