From patchwork Mon Apr 29 11:51:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Berg X-Patchwork-Id: 1928948 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=gQlQWokF; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=sipsolutions.net header.i=@sipsolutions.net header.a=rsa-sha256 header.s=mail header.b=xN2stcHn; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VShXV3Lycz23t4 for ; Mon, 29 Apr 2024 21:52:41 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=IyajT0J4Bz8NTy7pLpEcowbOrEb5v4H+/qX+FPv3zzI=; b=gQlQWokFtEPRri WeNYYqelEAI2Bvj8+i7LzuV4OnVXwrJqdrKENO72iKfYzLA1sSD6sZ2u117+mR7oEeiM1e1NrqREe 2n5xREXUh/ljiXDGH3m2JMdrO7dyYwRDmbbdh/HCIi6IWfZadgKUg3d6Y1UlnAGTAGyAPn1LJvYCW 4peGac4ZfMGjCkhsaSooI3IIoOxEEtOf3SNfi7urKh/TfLxYqVTSr3L1xqWxX/wLJmTu4g9gKOwZj vawGBQpfWVzqe/kwGdpXAks88XQsLOY9QMtN+2THr/JT5Z0hPSjsGqwHCA4lk+E9cqTTa8++1uX9x bVV/3wfVWgg0ijESLOVQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1PYQ-00000002XCh-2F1C; Mon, 29 Apr 2024 11:52:18 +0000 Received: from s3.sipsolutions.net ([2a01:4f8:242:246e::2] helo=sipsolutions.net) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1PYJ-00000002X7l-0MXK for hostap@lists.infradead.org; Mon, 29 Apr 2024 11:52:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To: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; bh=0z0qxPvhrHFLNJMYxMDjirvDyCnuo9JitfKcCeUjVlg=; t=1714391527; x=1715601127; b=xN2stcHnPpak6qrxDB+FJwNmFPvjhLN1gE+0Jq6k0GjiLzg MepI4fTp5Qox9/otT0L+W5KmWR0SshcvePDPkmakROeB1Yr7GDWuV1IpuoE325CyXbuZTPT9qN9ns qLqFjJLcWzeM7Va/ZqdwrXh6vGGEAAnZGwFiMaSFpDTvHH0kCxjmMaQsFmRd9JmxpfvR4y/1hzCbf eLkcbAy/2LdhHU2jQDQ26uF/xD6kMfP3Ha+d9OlWDd6rXauqKfqYnYnA93QO/UFRA/x7mfYwPF9GI hwR9N0hEd4fbCspLjKVpB0bWJrCGRIIcFnVvJJClySu8mpOkQCeIWEjDYz7vnXfQ==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1s1PYB-0000000CNIg-47Wz; Mon, 29 Apr 2024 13:52:04 +0200 From: benjamin@sipsolutions.net To: hostap@lists.infradead.org Cc: Benjamin Berg Subject: [PATCH 01/16] WNM: Only trigger selection logic for own scans Date: Mon, 29 Apr 2024 13:51:42 +0200 Message-ID: <20240429115157.211073-2-benjamin@sipsolutions.net> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240429115157.211073-1-benjamin@sipsolutions.net> References: <20240429115157.211073-1-benjamin@sipsolutions.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240429_045211_386747_82C0F8DB X-CRM114-Status: GOOD ( 17.26 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Benjamin Berg Commit e508c070c40e ("WNM: Keep BTM information until connection completes") changed the logic so that much of the information about a transition management request will be kept around for longer. How [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Benjamin Berg Commit e508c070c40e ("WNM: Keep BTM information until connection completes") changed the logic so that much of the information about a transition management request will be kept around for longer. However, doing this also implies that the scan logic can be called multiple times with wnm_dialog_token being set. Add a guard to bail out if the scan was not done for a BTM request. But, add it after the transition candidate validity check so that we reset the state when a new scan invalidated it. However, invalidation does not make sense for any scan, primarily an ML probe request during a connection attempt should not trigger invalidation. So move the call to wnm_scan_process further down in the list to avoid issues. Signed-off-by: Benjamin Berg --- wpa_supplicant/events.c | 6 +++--- wpa_supplicant/wnm_sta.c | 7 +++++++ wpa_supplicant/wpa_supplicant_i.h | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 8dc618e5c..4505d9e15 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -2498,9 +2498,6 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s, return 0; } - if (wnm_scan_process(wpa_s, false) > 0) - goto scan_work_done; - if (sme_proc_obss_scan(wpa_s) > 0) goto scan_work_done; @@ -2530,6 +2527,9 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s, wpas_wps_update_ap_info(wpa_s, scan_res); + if (wnm_scan_process(wpa_s, false) > 0) + goto scan_work_done; + if (wpa_s->wpa_state >= WPA_AUTHENTICATING && wpa_s->wpa_state < WPA_COMPLETED) goto scan_work_done; diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c index 7dc93ebff..a383ed803 100644 --- a/wpa_supplicant/wnm_sta.c +++ b/wpa_supplicant/wnm_sta.c @@ -1192,6 +1192,11 @@ int wnm_scan_process(struct wpa_supplicant *wpa_s, bool pre_scan_check) goto send_bss_resp_fail; } + if (!pre_scan_check && !wpa_s->wnm_transition_scan) + return 0; + + wpa_s->wnm_transition_scan = false; + /* Compare the Neighbor Report and scan results */ bss = compare_scan_neighbor_results(wpa_s, 0, &reason); @@ -1504,6 +1509,7 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s, if (wpa_s->wnm_dissoc_timer && !wpa_s->scanning && (!wpa_s->current_ssid || !wpa_s->current_ssid->bssid_set)) { wpa_printf(MSG_DEBUG, "Trying to find another BSS"); + wpa_s->wnm_transition_scan = true; wpa_supplicant_req_scan(wpa_s, 0, 0); } } @@ -1617,6 +1623,7 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s, "WNM: Scan only for a specific BSSID since there is only a single candidate " MACSTR, MAC2STR(wpa_s->next_scan_bssid)); } + wpa_s->wnm_transition_scan = true; wpa_supplicant_req_scan(wpa_s, 0, 0); } else if (reply) { enum bss_trans_mgmt_status_code status; diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index 426d077d2..6019fd1e1 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -1300,6 +1300,7 @@ struct wpa_supplicant { u8 *mac_addr_pno; #ifdef CONFIG_WNM + bool wnm_transition_scan; u8 wnm_dialog_token; u8 wnm_reply; u8 wnm_num_neighbor_report;