Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2419028rbb; Wed, 28 Feb 2024 00:47:52 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVUArtp58TQo0Mv5BdW3uCh3RzXMEr8v5IGlMyxbVxsi8A6OGXh4eS9VkwB0wEucmeQe0QZurPJyFjjJ1qx+s6AODcT8GTgJ6+bbECDbg== X-Google-Smtp-Source: AGHT+IFI1/J+szJQl8ng3y6n7MzqacAoDGv21SwimdOFRcXk2JcRXafxvSs52vz8dTiNme8G3rTb X-Received: by 2002:a17:906:7fca:b0:a43:e64c:3e4c with SMTP id r10-20020a1709067fca00b00a43e64c3e4cmr1362146ejs.51.1709110072172; Wed, 28 Feb 2024 00:47:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709110072; cv=pass; d=google.com; s=arc-20160816; b=zgSk/7syTn47x9vySvg26kQydFTmI7kT962AnuHn+4dMhEva3zCFMOmu7DRCymNtz/ K6IJjEPZzFCDhBTDG+nAOnsz71sowqr0kr1P208pfqGs9YUqit4eWQKEDXxcm9JKdZe3 N8vBILBsCe4W5z9hp9nJd+tjuxojhv/6Wcvt4+KyFz1fKaxsnKZVqnV+16oJGB6Xob/R 1TPevLhWdhZrUHsIrqh06M1BU+WYlNxwqTC2mZ/iO9/2UI+yh/iRFqKiblPa9XThepOe 1IJICUDF9uG8EQs55apBz0tHQbTanO+UlpRhOMTmJkrbOafPzsxRdp1jvHZQ0LgeDmyJ 1Ilw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=bvkk/5Xt9/QlIs4gF6HaJSFaavS5FQyORqcoDH3pqFQ=; fh=4kaEP0xkIsazZZseuh0UEa7Egkfw7yi3+Z5XsxeuP3k=; b=n/sM3TN5x6IkjXM85g4VxDBVjOeQHePhvkUUS9ATM/bgq2p2rZm73OJT8315IOx77W SfVxKbnH79c89hbt9Dt3Li9MXs8aUW0R6BhXcUHpAVecQJPsi/qMS3eezWwpgGcD45d7 KoYVhFKTyAxNL6fFcwia2cjdVzdGD8lP6QjqKcD4vXmJMMG9T1qCOLyoUr5t5xtLd3A+ 7kHs2KpJ2BI3ykh09iVXUaudeuDSmo900SXE1xIO2Al1a6ixIlnji9qw2WUgGPUQbe3V OZOuz10W/h5cKCHMSGlXko1qsgxWVzgp+8e68msyQRjXJn5qXGGqrLS6UlO8BmKwMmSw n1yw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=BFG7n+Bg; arc=pass (i=1 spf=pass spfdomain=sipsolutions.net dkim=pass dkdomain=sipsolutions.net dmarc=pass fromdomain=sipsolutions.net); spf=pass (google.com: domain of linux-wireless+bounces-4142-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4142-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id h25-20020a1709063c1900b00a43ea7ed1d5si642774ejg.795.2024.02.28.00.47.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 00:47:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-4142-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=BFG7n+Bg; arc=pass (i=1 spf=pass spfdomain=sipsolutions.net dkim=pass dkdomain=sipsolutions.net dmarc=pass fromdomain=sipsolutions.net); spf=pass (google.com: domain of linux-wireless+bounces-4142-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4142-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id BE1561F24808 for ; Wed, 28 Feb 2024 08:47:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F1182D046; Wed, 28 Feb 2024 08:47:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="BFG7n+Bg" X-Original-To: linux-wireless@vger.kernel.org Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F0B62D608 for ; Wed, 28 Feb 2024 08:47:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709110069; cv=none; b=F5Pf06/osOdJ8b3f8Q/yYZJEldcHqw05pYhr5euDES70th2S0inikd5WQqdmYOaSAGRpDjT0j6zIC1DDHEdnTQquuzniv9Nq3gUznIvsox7Wl2AAH073nnVpyXxs8pRHJ//Vfg1B8A7VX3/DFL8KtKwNPeuB8IBerC3t78L/bYc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709110069; c=relaxed/simple; bh=ey49+WZyg49bzk/NgfYBR4M4pJUU/DmfdJztlDK1jZs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=d2ycJIaArs5n2EmfvF8jbMQEkwv5VTjIUgYYSCkDbsa0TbN/Q9ySQbyU9EpOTqoijCOFCJ7T0en/WTB3sWE+3TyA1UzzF6azTY1ghQKXoRBTIh2hfe3HF/iA/nnOVNKJgxQgAjEIdQyCdeF19bE6ps6qqMRuZ2oABZticzqrYOE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=BFG7n+Bg; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-To:Resent-Cc: Resent-Message-ID:In-Reply-To:References; bh=bvkk/5Xt9/QlIs4gF6HaJSFaavS5FQyORqcoDH3pqFQ=; t=1709110067; x=1710319667; b=BFG7n+BgELVhRkD2qlg522Lqc988UXIdaZe5LSR9IcW4AcPKMe5F1RoHOPebYQi9dPTrJ+f0LCY 3ny81e/UHi+JPaPP2dyg4adlmMMOrKpO/qEzB4IjTFWNcRf3KfYNT8heTB6GPmJ+JHklgA4iyabwA DxoJw1ilMSbx7DfN2ZK8scJV7D9ZF0P/90H9s6+NF/Izib7LwhlobAyJ/g1h85JQtKb0MRbsFAMr7 cXKTjajlA4XqdoKKY4/aM/RgQUGul1jNuFSGN+eQPOV+iCwCm/o60U6qO44U2IqQQpUqj9aVOuovJ EBsfwCPE5pdcK3rWPTiI3UOp9/execsQituA==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1rfFbM-0000000C06T-2MoB; Wed, 28 Feb 2024 09:47:44 +0100 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Ilan Peer , Miriam Rachel Korenblit Subject: [PATCH] wifi: mac80211: Allow beacons to update BSS table regardless of scan Date: Wed, 28 Feb 2024 09:47:39 +0100 Message-ID: <20240228094742.e508605f495b.I3ab24ab3543319e31165111b28bcdcc622b5cf02@changeid> X-Mailer: git-send-email 2.43.2 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Ilan Peer When a beacon is received use it to update the BSS table regardless of the scanning state. Do so only when there are active non-monitor interfaces. Also, while at it, in any case accept beacons only with broadcast address. Reviewed-by: Miriam Rachel Korenblit Signed-off-by: Ilan Peer Signed-off-by: Johannes Berg --- net/mac80211/scan.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index bca2a259fda6..0429e59ba387 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c @@ -257,7 +257,6 @@ static bool ieee80211_scan_accept_presp(struct ieee80211_sub_if_data *sdata, void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb) { struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb); - struct ieee80211_sub_if_data *sdata1, *sdata2; struct ieee80211_mgmt *mgmt = (void *)skb->data; struct ieee80211_bss *bss; struct ieee80211_channel *channel; @@ -281,12 +280,6 @@ void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb) if (skb->len < min_hdr_len) return; - sdata1 = rcu_dereference(local->scan_sdata); - sdata2 = rcu_dereference(local->sched_scan_sdata); - - 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 @@ -304,10 +297,17 @@ void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb) return; if (ieee80211_is_probe_resp(mgmt->frame_control)) { + struct ieee80211_sub_if_data *sdata1, *sdata2; struct cfg80211_scan_request *scan_req; struct cfg80211_sched_scan_request *sched_scan_req; u32 scan_req_flags = 0, sched_scan_req_flags = 0; + sdata1 = rcu_dereference(local->scan_sdata); + sdata2 = rcu_dereference(local->sched_scan_sdata); + + if (likely(!sdata1 && !sdata2)) + return; + scan_req = rcu_dereference(local->scan_req); sched_scan_req = rcu_dereference(local->sched_scan_req); @@ -327,8 +327,16 @@ void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb) sched_scan_req_flags, mgmt->da)) return; + } else { + /* Beacons are expected only with broadcast address */ + if (!is_broadcast_ether_addr(mgmt->da)) + return; } + /* Do not update the BSS table in case of only monitor interfaces */ + if (local->open_count == local->monitors) + return; + bss = ieee80211_bss_info_update(local, rx_status, mgmt, skb->len, channel); -- 2.43.2