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; From patchwork Mon Apr 29 11:51:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Berg X-Patchwork-Id: 1928946 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=tA4hLu3r; 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=qQHVaa8v; 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 4VShXV4Rwvz23tX 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=GVOh1yxD3O6sIJNP9oBywjscgPaZNU1DSiqEElrEXvk=; b=tA4hLu3rskeVJs yg/p8yQ7XhviQAEV7HCHV4jvWFowfCbFEw1o8PcbbAQ+VhVcwxXGGCsaifJkeccX+Ela7EWtKXZn3 PfwgaCGtTW2iYXTS5CRWIys5dYUhG2/5R31vykv/oKI4UFU5a6rkCqMNPzc0zvpjjhXnNE6yHtl76 3UdjW3hEDGx8pZ3gI1lytqnDpf7wIfU+8vxdq+l8JyMbZKW08pU//6h+0cPqSLb09ulu0Fcn90ch+ w6wOF8kiH0vCD5IJbxyDMBc5voTQrsFpsYNd/rnouw6xSlzEX2oUeU+GXGYjnCZUgf4P2L07lG8lb w5AiSCJgdASovROFpGxQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1PYM-00000002XBB-266W; Mon, 29 Apr 2024 11:52:14 +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-00000002X7p-0Q7i for hostap@lists.infradead.org; Mon, 29 Apr 2024 11:52:12 +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=+CQ5IP0Ipb2INkYGa/Zt2VlII+bIIx9CmUcJpe3whA0=; t=1714391527; x=1715601127; b=qQHVaa8vUfqbtDH3iKnpbWqNlWilRkay7MWMWWEYbzrXAhx bBnE4mi2hK07Z/yk1Nil9HFvS1CuRQ5HcjaESe3RBEcSF8H+d0Bj/lBAUqOda68eZbXBkgHB+Wg1S 2IZJ/ASOxBsAS2TFOBVRnbdox0SkA6NBwiedz4itUk3Wn5OijXBSsdwPvLzqOEOrglqXlJRVC/LEA uDzbAT2LaGeuuaox4eJf2tINEAnzxHNgYCKzu3GqW10VQcRmJ/Lb78aQf5PSnh80gVEwHTPT2pB25 d0Mbe3wz5GvwXOwx5w1rD4dbkNGqGjiSpOVYFrxYbuOf0BVniE/Do3gzUyRdvuow==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1s1PYD-0000000CNIg-1Jv6; Mon, 29 Apr 2024 13:52:05 +0200 From: benjamin@sipsolutions.net To: hostap@lists.infradead.org Cc: Benjamin Berg Subject: [PATCH 02/16] WNM: Store whether disassociation address is an MLD Address Date: Mon, 29 Apr 2024 13:51:43 +0200 Message-ID: <20240429115157.211073-3-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_381309_B2B3F131 X-CRM114-Status: GOOD ( 12.95 ) 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 17a2aa822c26 ("WNM: Follow BTM procedure if the last link is dropped") added code to store either the MLD address or BSSID when being diassociated. However, it did not save which one was stored [...] 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 17a2aa822c26 ("WNM: Follow BTM procedure if the last link is dropped") added code to store either the MLD address or BSSID when being diassociated. However, it did not save which one was stored making the tests later on awkward. Store whether it was an MLD address or not and then do the test accordingly. Signed-off-by: Benjamin Berg --- wpa_supplicant/wnm_sta.c | 19 +++++++++++-------- wpa_supplicant/wpa_supplicant_i.h | 3 ++- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c index a383ed803..015a1948e 100644 --- a/wpa_supplicant/wnm_sta.c +++ b/wpa_supplicant/wnm_sta.c @@ -1495,12 +1495,17 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s, /* The last link is being removed (which must be the assoc link) */ wpa_s->wnm_link_removal = true; - os_memcpy(wpa_s->wnm_dissoc_addr, + wpa_s->wnm_disassoc_mld = false; + os_memcpy(wpa_s->wnm_disassoc_addr, wpa_s->links[wpa_s->mlo_assoc_link_id].bssid, ETH_ALEN); + } else if (wpa_s->valid_links) { + wpa_s->wnm_disassoc_mld = true; + os_memcpy(wpa_s->wnm_disassoc_addr, wpa_s->ap_mld_addr, + ETH_ALEN); } else { - os_memcpy(wpa_s->wnm_dissoc_addr, wpa_s->valid_links ? - wpa_s->ap_mld_addr : wpa_s->bssid, ETH_ALEN); + wpa_s->wnm_disassoc_mld = false; + os_memcpy(wpa_s->wnm_disassoc_addr, wpa_s->bssid, ETH_ALEN); } if (disassoc_imminent) { @@ -2066,13 +2071,11 @@ bool wnm_is_bss_excluded(struct wpa_supplicant *wpa_s, struct wpa_bss *bss) * In case disassociation imminent is set, do no try to use a BSS to * which we are connected. */ - if (wpa_s->wnm_link_removal || - !(wpa_s->drv_flags2 & WPA_DRIVER_FLAGS2_MLO) || - is_zero_ether_addr(bss->mld_addr)) { - if (ether_addr_equal(bss->bssid, wpa_s->wnm_dissoc_addr)) + if (!wpa_s->wnm_disassoc_mld) { + if (ether_addr_equal(bss->bssid, wpa_s->wnm_disassoc_addr)) return true; } else { - if (ether_addr_equal(bss->mld_addr, wpa_s->wnm_dissoc_addr)) + if (ether_addr_equal(bss->mld_addr, wpa_s->wnm_disassoc_addr)) return true; } diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index 6019fd1e1..d4a1284c3 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -1306,7 +1306,8 @@ struct wpa_supplicant { u8 wnm_num_neighbor_report; u8 wnm_mode; bool wnm_link_removal; - u8 wnm_dissoc_addr[ETH_ALEN]; + bool wnm_disassoc_mld; + u8 wnm_disassoc_addr[ETH_ALEN]; u16 wnm_dissoc_timer; u8 wnm_bss_termination_duration[12]; struct neighbor_report *wnm_neighbor_report_elements; From patchwork Mon Apr 29 11:51:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Berg X-Patchwork-Id: 1928950 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=ZKsBuPO1; 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=crpO6I/u; 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 4VShXV2tFMz1ymX for ; Mon, 29 Apr 2024 21:52:40 +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=z7WkXJySSXTt0fYuAsaOrKVx5kBjKE8JAXueWnOXasA=; b=ZKsBuPO1XGsKrO nVLZfLQiU6MvuuTMUCFYdzp51V4sW/s/hcO696RIVtTDBJw3frzzxNsTa0j4oKlqTl5fonTVZs396 4r4G113vsry3c3xPNL5QMMfX22d+8oZ2eyI0eiIDcq1Y7gweNDz4Z/SQr/l1SP9ZPYUDNv0z/2zr+ TpERAzCyxlbdyibZEhOXnjUbFYzY394k5nO9eu4/XuFaNdrpGSbt0fZJ+ZE6SIaCDm2RpbdGbLvKX OutKSsDAMwhSujIWyuuNkQceTjOeQa+akvbYfoUzse9dz4WwBApow8/BqGSkpO9k6i0I4XbFSrWkD EdptufbZa/XHxb6HXj/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1PYP-00000002XC0-04m6; Mon, 29 Apr 2024 11:52:17 +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-00000002X7x-0KVz 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=nkbYzOmAEyQDLZRK40TuE55kPZgJ7vBNZT7FrZ/Nrns=; t=1714391528; x=1715601128; b=crpO6I/uTrS7kQVTSRMm2I+PVBHt5HSyx+Uv/DHCEMcassa gvCTsISdSJzad2msM2lNLQZY6KWYP1J48PcMtXZ49XV7AKH1kHB7WCWNFVV8B7/kWcRQ513JJEyui RuX3FIzucAl388r0FQu9HdaHlhM6TgU9NzrYu4OXUvlkHrAZnw5DJ2KkYDPbGsWm6nf1HnQEOxGEy I2YuSz32wLtMlkFKqYXcCEhoFLpPicYiGTN5bELalyVbNp0/OvnX4yIEmYE1WHYaIgbbTXsT/BZJd iZmIKKHtn2CPCDYge7Cyw6feUbeUwjICGGmIqCQeS3nPaUYbzOBkxpehDLzra23w==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1s1PYE-0000000CNIg-1v4e; Mon, 29 Apr 2024 13:52:06 +0200 From: benjamin@sipsolutions.net To: hostap@lists.infradead.org Cc: Benjamin Berg Subject: [PATCH 03/16] WNM: Use os_relatime_add_ms helper Date: Mon, 29 Apr 2024 13:51:44 +0200 Message-ID: <20240429115157.211073-4-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_386788_1C2B5A20 X-CRM114-Status: GOOD ( 10.02 ) 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 Just simplify the code a little bit by using the helper instead of doing the math inline. Signed-off-by: Benjamin Berg --- wpa_supplicant/wnm_sta.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) 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 Just simplify the code a little bit by using the helper instead of doing the math inline. Signed-off-by: Benjamin Berg --- wpa_supplicant/wnm_sta.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c index 015a1948e..7857e4ed8 100644 --- a/wpa_supplicant/wnm_sta.c +++ b/wpa_supplicant/wnm_sta.c @@ -1598,11 +1598,7 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s, wpa_printf(MSG_DEBUG, "WNM: Candidate list valid for %u ms", valid_ms); os_get_reltime(&wpa_s->wnm_cand_valid_until); - wpa_s->wnm_cand_valid_until.sec += valid_ms / 1000; - wpa_s->wnm_cand_valid_until.usec += (valid_ms % 1000) * 1000; - wpa_s->wnm_cand_valid_until.sec += - wpa_s->wnm_cand_valid_until.usec / 1000000; - wpa_s->wnm_cand_valid_until.usec %= 1000000; + os_reltime_add_ms(&wpa_s->wnm_cand_valid_until, valid_ms); /* * Try fetching the latest scan results from the kernel. From patchwork Mon Apr 29 11:51:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Berg X-Patchwork-Id: 1928944 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=GiFp9bxg; 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=YmcoAYwo; 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 4VShXV3b9Bz23tW 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=1ze3GoxGsewYxop12AQotKU8RNA94/Lb5LbSPe7y2Bc=; b=GiFp9bxgnud/Y7 ATiuT3YPNPAzSFqM14ma7GroijcihFZ6lKHu28a4Zup/cs19tlkSf6TRYT78HtRSzL0KLpfDrgEII guWejUAr4XI+9f6PLpdpijKFH49+zGoZG78zD73tHVnvlGwmey5PBw1VDLns/H65xxCGH7qt6jlQx 3X0PXs/+PwZPAakpAk4Ck3qUeNupXE7by8wYReen/iXToXXx4gEuAw081yvPkhspcnTK7vRkAE4wm jfI0l1VLBVfpaaiOeAV2Hy8GwyoAhSg1X9qiS+Lc7It4PtCpY7RhtaWAOPiWz0DcPQhKcQnrlsawu ZuqzQef7stRcmT7DH7xg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1PYU-00000002XEc-0WXu; Mon, 29 Apr 2024 11:52:22 +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-00000002X8D-1KWq 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=GbrW8k/EDiT6iI1PsmXzfOv2kUwlFmcpy/WWLdNKwMw=; t=1714391529; x=1715601129; b=YmcoAYwodpyTmQroLetJCR0UiyJWAsu09ASUsvP3zHm42a5 84KwBTuESyGjlJYMUoObqzZyi51ylxfrEFdDXEcwWnBt0PmOreQMZP8fOfHvd4SW21cK1MX7Zfqir Mu0VHw6bV2e/KIxnFdY9mRunnHYNZgFJd9OC+lxPuv6QesQz2tUVndEN0OmHeq9bJlZrIaPhxmJAo 52HGKrhYDQMRGOYyXsR8JnD/MlYAfyk9ajmTduo/S7CWCA0hH+I9jEXJS81s3u1Tn8rD/V8HJqI0R YatMdsNOfme2x8nmEWImp4FQxJLuoDmTdcvQVl7keplZQPjGBC026IJCkABQD0Fw==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1s1PYF-0000000CNIg-2ZO3; Mon, 29 Apr 2024 13:52:07 +0200 From: benjamin@sipsolutions.net To: hostap@lists.infradead.org Cc: Benjamin Berg Subject: [PATCH 04/16] WNM: Split candidate list parsing into a separate function Date: Mon, 29 Apr 2024 13:51:45 +0200 Message-ID: <20240429115157.211073-5-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_422780_5797507A X-CRM114-Status: GOOD ( 14.00 ) 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 ieee802_11_rx_bss_trans_mgmt_req is already dealing with a lot of things including the decisions on how to act on the frame. Split out candidate list parsing to make it easier to work with the functio [...] 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 ieee802_11_rx_bss_trans_mgmt_req is already dealing with a lot of things including the decisions on how to act on the frame. Split out candidate list parsing to make it easier to work with the function. Signed-off-by: Benjamin Berg --- wpa_supplicant/wnm_sta.c | 91 ++++++++++++++++++++++------------------ 1 file changed, 50 insertions(+), 41 deletions(-) diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c index 7857e4ed8..721baeddb 100644 --- a/wpa_supplicant/wnm_sta.c +++ b/wpa_supplicant/wnm_sta.c @@ -1380,6 +1380,54 @@ static void wnm_set_scan_freqs(struct wpa_supplicant *wpa_s) wpa_s->next_scan_freqs = freqs; } +static int wnm_parse_candidate_list(struct wpa_supplicant *wpa_s, + const u8 *pos, const u8 *end) +{ + wpa_s->wnm_neighbor_report_elements = os_calloc( + WNM_MAX_NEIGHBOR_REPORT, + sizeof(struct neighbor_report)); + if (wpa_s->wnm_neighbor_report_elements == NULL) + return -1; + + while (end - pos >= 2 && + wpa_s->wnm_num_neighbor_report < WNM_MAX_NEIGHBOR_REPORT) + { + u8 tag = *pos++; + u8 len = *pos++; + + wpa_printf(MSG_DEBUG, "WNM: Neighbor report tag %u", + tag); + if (len > end - pos) { + wpa_printf(MSG_DEBUG, "WNM: Truncated request"); + return -1; + } + if (tag == WLAN_EID_NEIGHBOR_REPORT) { + struct neighbor_report *rep; + rep = &wpa_s->wnm_neighbor_report_elements[ + wpa_s->wnm_num_neighbor_report]; + wnm_parse_neighbor_report(wpa_s, pos, len, rep); + if ((wpa_s->wnm_mode & + WNM_BSS_TM_REQ_DISASSOC_IMMINENT) && + ether_addr_equal(rep->bssid, wpa_s->bssid)) + rep->disassoc_imminent = 1; + + wpa_s->wnm_num_neighbor_report++; +#ifdef CONFIG_MBO + if (wpa_s->wnm_mbo_trans_reason_present && + wpa_s->wnm_num_neighbor_report == 1) { + rep->is_first = 1; + wpa_printf(MSG_DEBUG, + "WNM: First transition candidate is " + MACSTR, MAC2STR(rep->bssid)); + } +#endif /* CONFIG_MBO */ + } + + pos += len; + } + + return 0; +} static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s, const u8 *pos, const u8 *end, @@ -1529,48 +1577,9 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s, unsigned int valid_ms; wpa_msg(wpa_s, MSG_INFO, "WNM: Preferred List Available"); - wpa_s->wnm_neighbor_report_elements = os_calloc( - WNM_MAX_NEIGHBOR_REPORT, - sizeof(struct neighbor_report)); - if (wpa_s->wnm_neighbor_report_elements == NULL) - return; - - while (end - pos >= 2 && - wpa_s->wnm_num_neighbor_report < WNM_MAX_NEIGHBOR_REPORT) - { - u8 tag = *pos++; - u8 len = *pos++; - - wpa_printf(MSG_DEBUG, "WNM: Neighbor report tag %u", - tag); - if (len > end - pos) { - wpa_printf(MSG_DEBUG, "WNM: Truncated request"); - return; - } - if (tag == WLAN_EID_NEIGHBOR_REPORT) { - struct neighbor_report *rep; - rep = &wpa_s->wnm_neighbor_report_elements[ - wpa_s->wnm_num_neighbor_report]; - wnm_parse_neighbor_report(wpa_s, pos, len, rep); - if ((wpa_s->wnm_mode & - WNM_BSS_TM_REQ_DISASSOC_IMMINENT) && - ether_addr_equal(rep->bssid, wpa_s->bssid)) - rep->disassoc_imminent = 1; - - wpa_s->wnm_num_neighbor_report++; -#ifdef CONFIG_MBO - if (wpa_s->wnm_mbo_trans_reason_present && - wpa_s->wnm_num_neighbor_report == 1) { - rep->is_first = 1; - wpa_printf(MSG_DEBUG, - "WNM: First transition candidate is " - MACSTR, MAC2STR(rep->bssid)); - } -#endif /* CONFIG_MBO */ - } - pos += len; - } + if (wnm_parse_candidate_list(wpa_s, pos, end) < 0) + return; if (!wpa_s->wnm_num_neighbor_report) { wpa_printf(MSG_DEBUG, From patchwork Mon Apr 29 11:51:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Berg X-Patchwork-Id: 1928947 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=y3D0uL+T; 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=BvKT7fZi; 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 4VShXV6Bjkz23tZ for ; Mon, 29 Apr 2024 21:52:42 +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=ludFsx56xP+yF65b/whnEKUGGSFG/2ai9XYhjPY5jeA=; b=y3D0uL+TN24XBi mQnGccVboU0zWMibWWctsAvc2i807hQKpGzNp+M7bsEtURhgLC3DQbyI3ENKV8e6kFBVRz5m3a05f H2BFBC4cZoTmrjyZ1bbVR5bN1MYnKVO2nRhNt4wQgRdlurpZmaEPTiUKy32Z07G6HMD9usRjJfUeq /vmQpZsVWwNzU8Vdf7VTiSn3zKwURR5XqF20PHGPTfwiEiL3eADSSVD1668gPhyhLfFSsoRb34o0V mhzOGJtj7J1/heg1UL9JjsdiiIk53HWfCzxcaCS3tGBXLwaZ0MtgCGsA3+uiU9vVzDMEav6j+3YZH OPn9jLEjsmpP+cfH2uQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1PYX-00000002XGd-2CXh; Mon, 29 Apr 2024 11:52:25 +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 1s1PYK-00000002X8H-199X for hostap@lists.infradead.org; Mon, 29 Apr 2024 11:52:14 +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=gqTiOWs3RNmSYHF7tISEzbAo95Aj0Jsk+sHM7VjItMM=; t=1714391530; x=1715601130; b=BvKT7fZiiv+4LwT+nToINEv7/2MfGvEpFDZ7Kcze2E7PRNZ eDQILNTpcEnNGjOWJZiETMMyEJTU8ksQkrbX65StRe+vatvvuO2BVMLeVyzT99Z0fnd6SXyTan6fr IwQNoTdbWpCemgp0KnqsoLI2z25KqoGt+14HB/7zl/tNSPL+RHKz9AgqI8wJV0NxGxvXWx5CFsogV JSZqsy4Bwvo3DBj1kPyK9RqmCE5wtrT0FIsZTh0MCSVtQS/kDUit4H1OJxC1AXTktFrIC47omNZMb knxF1GIbaT8/zc/nn5SiucAYQMfoPyDeFr9ww0KOdBpznIhPVNaBegtRtKWSlMdA==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1s1PYG-0000000CNIg-2zr1; Mon, 29 Apr 2024 13:52:08 +0200 From: benjamin@sipsolutions.net To: hostap@lists.infradead.org Cc: Benjamin Berg Subject: [PATCH 05/16] WNM: Remove unused age parameter for neighbor comparison Date: Mon, 29 Apr 2024 13:51:46 +0200 Message-ID: <20240429115157.211073-6-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_045212_419624_E9CC65CE X-CRM114-Status: GOOD ( 12.54 ) 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 compare_scan_neighbor_results was taking an age paramter to check whether the BSS has been seen recently. This was used historically in a codepath when no new scan was done. However, the logic was cha [...] 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 compare_scan_neighbor_results was taking an age paramter to check whether the BSS has been seen recently. This was used historically in a codepath when no new scan was done. However, the logic was changed in commit 20ed289a785c ("WNM: Clean up old scan data processing") and the parameter is not used at all anymore as it is replaced by a different logic. Remove it. Signed-off-by: Benjamin Berg --- wpa_supplicant/wnm_sta.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c index 721baeddb..d3bc03202 100644 --- a/wpa_supplicant/wnm_sta.c +++ b/wpa_supplicant/wnm_sta.c @@ -740,7 +740,7 @@ static struct wpa_bss * find_better_target(struct wpa_bss *a, } static struct wpa_bss * -compare_scan_neighbor_results(struct wpa_supplicant *wpa_s, os_time_t age_secs, +compare_scan_neighbor_results(struct wpa_supplicant *wpa_s, enum mbo_transition_reject_reason *reason) { u8 i; @@ -777,19 +777,6 @@ compare_scan_neighbor_results(struct wpa_supplicant *wpa_s, os_time_t age_secs, continue; } - if (age_secs) { - struct os_reltime now; - - if (os_get_reltime(&now) == 0 && - os_reltime_expired(&now, &target->last_update, - age_secs)) { - wpa_printf(MSG_DEBUG, - "Candidate BSS is more than %ld seconds old", - age_secs); - continue; - } - } - /* * TODO: Could consider allowing transition to another ESS if * PMF was enabled for the association. @@ -1198,7 +1185,7 @@ int wnm_scan_process(struct wpa_supplicant *wpa_s, bool pre_scan_check) wpa_s->wnm_transition_scan = false; /* Compare the Neighbor Report and scan results */ - bss = compare_scan_neighbor_results(wpa_s, 0, &reason); + bss = compare_scan_neighbor_results(wpa_s, &reason); /* * If this is a pre-scan check, returning 0 will trigger a scan and From patchwork Mon Apr 29 11:51:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Berg X-Patchwork-Id: 1928951 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=mwS6s+sE; 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=AmVQqfvR; 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 4VShXV4jYZz23tY 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=kdHGwofmiuecCEdl8wFkDj5tdRKJS/WIPrUcoIkW2NQ=; b=mwS6s+sEJrxURy LvpD2fUa+m7ysPSBZ5M1sIkpisJxCGorLt5TCG7zTw+yaez2F5WGhKhs+PAQRTiIDOy8pXVuubL+f hyKmsC5CPuvRvo60P5NA1Fs888WtqN2+rL5t7A3Z9/51jTZ2R8ZEvIoOf74AD6ylZl2wNZ43lDcGQ D7sLb10pA5jVz+A2JqcdreGWKoM8a3MUmtC3xB/yvSI1lJb2xTnewH0Rb6TvZoCeSvDYC3tcgIa/t uWv1KSaF8cm874JXXDvYKBzRC4LQsR4lbUx9+MEvPACv2vy2ggZBoFsujQUSgZLRDs5ETn7eNlTnj xEMwSOAnFklPVX2eTYhQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1PYW-00000002XFv-0IuH; Mon, 29 Apr 2024 11:52:24 +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-00000002X8W-3OUX for hostap@lists.infradead.org; Mon, 29 Apr 2024 11:52:14 +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=WPXE0RH3V9sOym5ZBVg43G+VQGe542e4R/b9pnisLrA=; t=1714391531; x=1715601131; b=AmVQqfvREFlZS3tcphuGIEME2DffPmBvLTZaZGTW48lDwZB O8S1lGn+MaqrIZgXsS/Sh3JquTgs1Z1EFyhp2UbEKFp9Ad3XXM0IHwG0d5oI8h9SrQ8Vo6m6XwAfY qSQpfZOKKOun/jZ3wxggyMeyF8GsL143lsuuy2jfTs4lraSBGsKnOMpvcswQdadCCmyAT/UKj4sp6 uL4nvN0cJgA0oN/Qze5bu3T4LCUoaiEirTPcVmdFa8r7CJrlSqsKzNB+ZoVDOMYnApPVZCHU8bZwb J0S7xW9L/J7my6pMFZB2zcRukKUWkqTWaJiEigj9kltItyxk/GZhhH3tPZxFU30w==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1s1PYH-0000000CNIg-2eu3; Mon, 29 Apr 2024 13:52:09 +0200 From: benjamin@sipsolutions.net To: hostap@lists.infradead.org Cc: Benjamin Berg Subject: [PATCH 06/16] WNM: Swap logic in wnm_is_bss_excluded to allow more checks Date: Mon, 29 Apr 2024 13:51:47 +0200 Message-ID: <20240429115157.211073-7-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_045212_235387_4D4B90BF X-CRM114-Status: GOOD ( 10.40 ) 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 Following commits will move more checks into wnm_is_bss_excluded, prepare for that by changing the logical flow so that further checks can be inserted. Signed-off-by: Benjamin Berg --- wpa_supplicant/wnm_sta.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) 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 Following commits will move more checks into wnm_is_bss_excluded, prepare for that by changing the logical flow so that further checks can be inserted. Signed-off-by: Benjamin Berg --- wpa_supplicant/wnm_sta.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c index d3bc03202..7283ff47c 100644 --- a/wpa_supplicant/wnm_sta.c +++ b/wpa_supplicant/wnm_sta.c @@ -2056,19 +2056,20 @@ void wnm_clear_coloc_intf_reporting(struct wpa_supplicant *wpa_s) bool wnm_is_bss_excluded(struct wpa_supplicant *wpa_s, struct wpa_bss *bss) { - if (!(wpa_s->wnm_mode & WNM_BSS_TM_REQ_DISASSOC_IMMINENT)) - return false; - /* * In case disassociation imminent is set, do no try to use a BSS to * which we are connected. */ - if (!wpa_s->wnm_disassoc_mld) { - if (ether_addr_equal(bss->bssid, wpa_s->wnm_disassoc_addr)) - return true; - } else { - if (ether_addr_equal(bss->mld_addr, wpa_s->wnm_disassoc_addr)) - return true; + if (wpa_s->wnm_mode & WNM_BSS_TM_REQ_DISASSOC_IMMINENT) { + if (!wpa_s->wnm_disassoc_mld) { + if (ether_addr_equal(bss->bssid, + wpa_s->wnm_disassoc_addr)) + return true; + } else { + if (ether_addr_equal(bss->mld_addr, + wpa_s->wnm_disassoc_addr)) + return true; + } } return false; From patchwork Mon Apr 29 11:51:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Berg X-Patchwork-Id: 1928949 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=I5LrdWex; 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=d5pFVsMR; 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 4VShXY31jSz23tc for ; Mon, 29 Apr 2024 21:52:45 +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=S4AYbT+zla8MOwRKarupsFWAvulMXHT2Vw1l11jKvNg=; b=I5LrdWexmvV45Q Di06Gzozbf5CimlHabncXIH8wdk5Wb/ob2YPQ2dono1euN9gJHms67bx0E0nlxKUCyQAuOHG8YRtR xSJYI2+Ol2EMyvXI2NuS2nxS2jLSWFHTFjnQisHt9xYzVArXgZ21heLKqRo8bFUrOgngPGnXKw7IP ++C9B2GGKJtpKdLsCZwfp2P/ImyvRns2E1MBS3QZbu/2zAqXaEk99EA2RD+xOzg8SKjxgM/GKky1/ fodyr6rwcBtTTvnrob6jQ51vnNUdvXtn/GO9lKzsi5TKkflvQinCy5SC5TODYOFUk3WMCTDBD9Tdm rQr83a6AZrYHAjfpgzLA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1PYZ-00000002XH5-1E0f; Mon, 29 Apr 2024 11:52:27 +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 1s1PYK-00000002X9h-3LYK for hostap@lists.infradead.org; Mon, 29 Apr 2024 11:52:14 +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=RYXFtmiXy9KOIKtQK/bDIDjJ4eFyL6T0ktyaejVPCLI=; t=1714391532; x=1715601132; b=d5pFVsMRDS1oCIDTNOMmzeHkOPd0HleyZfK7JCzktpNPvGY DvSeVfa6N7MgtptFTD2qdBoRqvkX8Cai+lTmCb3XTzd8brcQ4oVBaB+TNx0hq5+xZ2IEvnvkESoIO yMgyuNplCMnsyLc3Be1ouMOka4xK/35Vn+CohRct8ed8jBjOj045+yXAonga4+t5Yw8tJknYOBsVX X0mhJZ6iLCXpI2pmoS3fXUGR+omyJDGNnTZE5zQUEjOmGaRBmnbhNd6wPo1TkMrPtVITq0tgyMakB ZZi4i54ovn+On2NUUYFjqHuQQj9OmK6XDXjIRAzDEA3pLxpQzeKqZQ7wmjE6sKfw==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1s1PYI-0000000CNIg-2iFa; Mon, 29 Apr 2024 13:52:10 +0200 From: benjamin@sipsolutions.net To: hostap@lists.infradead.org Cc: Benjamin Berg Subject: [PATCH 07/16] WNM: Move neighbor report test into wnm_is_bss_excluded Date: Mon, 29 Apr 2024 13:51:48 +0200 Message-ID: <20240429115157.211073-8-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_045212_965922_C5BA7699 X-CRM114-Status: GOOD ( 16.05 ) 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 Having it in wnm_is_bss_excluded is more generic as it works for other locations (e.g. MLD link selection). So move the test and add a check for the abridged bit while at it. Note that without the abr [...] 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 Having it in wnm_is_bss_excluded is more generic as it works for other locations (e.g. MLD link selection). So move the test and add a check for the abridged bit while at it. Note that without the abridged bit check another check would be needed (e.g. checking wnm_dialog_token) to ensure that there isn't a rejection unless a BTM is in progress. Signed-off-by: Benjamin Berg --- wpa_supplicant/wnm_sta.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c index 7283ff47c..e8776a14b 100644 --- a/wpa_supplicant/wnm_sta.c +++ b/wpa_supplicant/wnm_sta.c @@ -761,11 +761,6 @@ compare_scan_neighbor_results(struct wpa_supplicant *wpa_s, struct neighbor_report *nei; nei = &wpa_s->wnm_neighbor_report_elements[i]; - if (nei->preference_present && nei->preference == 0) { - wpa_printf(MSG_DEBUG, "Skip excluded BSS " MACSTR, - MAC2STR(nei->bssid)); - continue; - } target = wpa_bss_get_bssid(wpa_s, nei->bssid); if (!target) { @@ -2056,6 +2051,8 @@ void wnm_clear_coloc_intf_reporting(struct wpa_supplicant *wpa_s) bool wnm_is_bss_excluded(struct wpa_supplicant *wpa_s, struct wpa_bss *bss) { + int i; + /* * In case disassociation imminent is set, do no try to use a BSS to * which we are connected. @@ -2072,5 +2069,23 @@ bool wnm_is_bss_excluded(struct wpa_supplicant *wpa_s, struct wpa_bss *bss) } } + for (i = 0; i < wpa_s->wnm_num_neighbor_report; i++) { + struct neighbor_report *nei; + + nei = &wpa_s->wnm_neighbor_report_elements[i]; + if (!ether_addr_equal(nei->bssid, bss->bssid)) + continue; + + if (nei->preference_present && nei->preference == 0) + return true; + + break; + } + + /* If the abridged bit is set, then the BSS must be a known neighbor */ + if (wpa_s->wnm_mode & WNM_BSS_TM_REQ_ABRIDGED && + wpa_s->wnm_num_neighbor_report == i) + return true; + return false; } From patchwork Mon Apr 29 11:51:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Berg X-Patchwork-Id: 1928952 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=Q3lqzpvx; 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=M1SIKhCh; 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 4VShXZ2pg0z23td for ; Mon, 29 Apr 2024 21:52:46 +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=lbFE30xcKTAiCtIOtP+f5vyKA6IM8AEAqMd52qcm5sM=; b=Q3lqzpvx64ersJ jeqrwBkLcQRaxu3LimGTc3zWLSlsqgRzbZC2ZuY/auS/PlkxL63RbW9kKSZ2EFLs6a2u3JOM4bYan MdGQ9Rjc4Bknc26BBOVEdov/tVXMb6cZqNjYuRJy/kZ9HWZtzj0Ok8QMxqjDw4DZeB9ZCpuWOT5nM kMqok5smK4N2yp8QGdsDgbz2S4rf6rxCEr6aPeYFyhB61hbkk7pG4J/eqJKZ6CReSlWxVJPJXGAKq +T2GYfVu3FWzB0wr8dohP/f63McWG9lNGg/EeDNCZuE4HBf3UqWRmiL8MBgRfPuDARjpDN2r3GVtU 5cn/ueiS5SyltbDw/+fQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1PYb-00000002XHk-1jSI; Mon, 29 Apr 2024 11:52:29 +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 1s1PYL-00000002XAI-2QP0 for hostap@lists.infradead.org; Mon, 29 Apr 2024 11:52:15 +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=jGbfpozGCgHGo/3Cy9GprQK1J1+ol3cx1VkLjcmI6lo=; t=1714391533; x=1715601133; b=M1SIKhChWzZE1PlIu15JusTd0/LZX4S9m8x6n3KN6cFqRGL ldsBFroTZx/PtDLJJAP5F+Ke0GPizVQOySOce0PwdQ5VSvqmXBFf3CMBF1NOd2zOpmLDTM456IskZ FzgH1G0I7L1s2jqi3E2BPZ3tviXmYld9a9YB81tHvpFdQrEfbKVHt+4IlN9X/z+tXg9GXVEzXhJEU ziGBnR/OvBRWEGAy2KDL7GDPIPmEvhLMCVq82jpuSMOGJjJ5Yab7VHZJZF7+UcKKPTzTZTW3DkTa0 bZpUbq8ERPz2iCwYvVNw3bK6mcbKmxB8XU+7loSyKHcL3pxc1AbcuwbG45GEzIWQ==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1s1PYJ-0000000CNIg-2Y6c; Mon, 29 Apr 2024 13:52:11 +0200 From: benjamin@sipsolutions.net To: hostap@lists.infradead.org Cc: Benjamin Berg Subject: [PATCH 08/16] WNM: Move driver MBO transition rejection into wnm_is_bss_excluded Date: Mon, 29 Apr 2024 13:51:49 +0200 Message-ID: <20240429115157.211073-9-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_045213_872595_4F48D830 X-CRM114-Status: GOOD ( 27.82 ) 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 Change the logic a bit to not directly use the result of the wpa_drv_get_bss_trans_status call and instead use the same selection logic as usual but taking into account the driver rejections. 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 Change the logic a bit to not directly use the result of the wpa_drv_get_bss_trans_status call and instead use the same selection logic as usual but taking into account the driver rejections. This changes the logic in minor ways. The main change is that this aligns the ordering of BSSs to be identical in all cases. More precisely, we'll select the best BSS as found by find_better_target. Beyond that, it also means that in the case of an non-abridged BTM request we'll also consider candidates that were found through the scan and not in the neighbor report. In this case, the driver will not have a chance to reject them. Signed-off-by: Benjamin Berg --- wpa_supplicant/wnm_sta.c | 138 +++++++++++++++++++-------------------- wpa_supplicant/wnm_sta.h | 2 +- 2 files changed, 70 insertions(+), 70 deletions(-) diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c index e8776a14b..64124348f 100644 --- a/wpa_supplicant/wnm_sta.c +++ b/wpa_supplicant/wnm_sta.c @@ -615,38 +615,37 @@ static void wnm_parse_neighbor_report(struct wpa_supplicant *wpa_s, } -static void wnm_clear_acceptable(struct wpa_supplicant *wpa_s) -{ - unsigned int i; - - for (i = 0; i < wpa_s->wnm_num_neighbor_report; i++) - wpa_s->wnm_neighbor_report_elements[i].acceptable = 0; -} - #ifdef CONFIG_MBO -static struct wpa_bss * -get_mbo_transition_candidate(struct wpa_supplicant *wpa_s, +static void +fetch_drv_mbo_candidate_info(struct wpa_supplicant *wpa_s, enum mbo_transition_reject_reason *reason) { - struct wpa_bss *target = NULL; struct wpa_bss_trans_info params; struct wpa_bss_candidate_info *info = NULL; - struct neighbor_report *nei = wpa_s->wnm_neighbor_report_elements; - u8 *first_candidate_bssid = NULL, *pos; + struct neighbor_report *nei; + u8 *pos; unsigned int i; + if (!wpa_s->wnm_mbo_trans_reason_present) + return; + params.mbo_transition_reason = wpa_s->wnm_mbo_transition_reason; params.n_candidates = 0; params.bssid = os_calloc(wpa_s->wnm_num_neighbor_report, ETH_ALEN); if (!params.bssid) - return NULL; + return; pos = params.bssid; - for (i = 0; i < wpa_s->wnm_num_neighbor_report; nei++, i++) { - if (nei->is_first) - first_candidate_bssid = nei->bssid; - if (!nei->acceptable) + for (i = 0; i < wpa_s->wnm_num_neighbor_report; i++) { + nei = &wpa_s->wnm_neighbor_report_elements[i]; + + nei->drv_mbo_reject = 0; + + if (nei->preference_present && nei->preference == 0) continue; + + /* FIXME: Should we go through wpa_scan_res_match? */ + os_memcpy(pos, nei->bssid, ETH_ALEN); pos += ETH_ALEN; params.n_candidates++; @@ -656,62 +655,40 @@ get_mbo_transition_candidate(struct wpa_supplicant *wpa_s, goto end; info = wpa_drv_get_bss_trans_status(wpa_s, ¶ms); - if (!info) { - /* If failed to get candidate BSS transition status from driver, - * get the first acceptable candidate from wpa_supplicant. - */ - target = wpa_bss_get_bssid(wpa_s, params.bssid); + if (!info) goto end; - } - /* Get the first acceptable candidate from driver */ for (i = 0; i < info->num; i++) { - if (info->candidates[i].is_accept) { - target = wpa_bss_get_bssid(wpa_s, - info->candidates[i].bssid); - goto end; - } - } + int j; - /* If Disassociation Imminent is set and driver rejects all the - * candidate select first acceptable candidate which has - * rssi > disassoc_imminent_rssi_threshold - */ - if (wpa_s->wnm_mode & WNM_BSS_TM_REQ_DISASSOC_IMMINENT) { - for (i = 0; i < info->num; i++) { - target = wpa_bss_get_bssid(wpa_s, - info->candidates[i].bssid); - if (target && - (target->level < - wpa_s->conf->disassoc_imminent_rssi_threshold)) + for (j = 0; j < wpa_s->wnm_num_neighbor_report; nei++, j++) { + nei = &wpa_s->wnm_neighbor_report_elements[j]; + + if (!ether_addr_equal(info->candidates[i].bssid, + nei->bssid)) continue; - goto end; - } - } - /* While sending BTM reject use reason code of the first candidate - * received in BTM request frame - */ - if (reason) { - for (i = 0; i < info->num; i++) { - if (first_candidate_bssid && - ether_addr_equal(first_candidate_bssid, - info->candidates[i].bssid)) { + nei->drv_mbo_reject = !info->candidates[i].is_accept; + + /* Use the reject reason from "first" candidate */ + if (nei->is_first && nei->drv_mbo_reject) *reason = info->candidates[i].reject_reason; - break; - } + + break; } } - target = NULL; - end: os_free(params.bssid); if (info) { os_free(info->candidates); os_free(info); } - return target; +} +#else +static void +fetch_drv_mbo_transition_candidate_info(struct wpa_supplicant *wpa_s) +{ } #endif /* CONFIG_MBO */ @@ -755,8 +732,6 @@ compare_scan_neighbor_results(struct wpa_supplicant *wpa_s, wpa_printf(MSG_DEBUG, "WNM: Current BSS " MACSTR " RSSI %d", MAC2STR(wpa_s->bssid), bss->level); - wnm_clear_acceptable(wpa_s); - for (i = 0; i < wpa_s->wnm_num_neighbor_report; i++) { struct neighbor_report *nei; @@ -796,21 +771,12 @@ compare_scan_neighbor_results(struct wpa_supplicant *wpa_s, continue; } - nei->acceptable = 1; - best_target = find_better_target(target, best_target); if (target == bss) bss_in_list = bss; } -#ifdef CONFIG_MBO - if (wpa_s->wnm_mbo_trans_reason_present) - target = get_mbo_transition_candidate(wpa_s, reason); - else - target = best_target; -#else /* CONFIG_MBO */ target = best_target; -#endif /* CONFIG_MBO */ if (!target) return NULL; @@ -1179,8 +1145,39 @@ int wnm_scan_process(struct wpa_supplicant *wpa_s, bool pre_scan_check) wpa_s->wnm_transition_scan = false; + /* Fetch MBO transition candidate rejection information from driver */ + fetch_drv_mbo_candidate_info(wpa_s, &reason); + /* Compare the Neighbor Report and scan results */ bss = compare_scan_neighbor_results(wpa_s, &reason); +#ifdef CONFIG_MBO + if (!bss && wpa_s->wnm_mbo_trans_reason_present && + wpa_s->wnm_mode & WNM_BSS_TM_REQ_DISASSOC_IMMINENT) { + int i; + + /* + * We didn't find any candidate, the driver had a say about + * which targets to reject and disassociation is immiment. + * + * We should still try to roam, so retry after ignoring the + * driver reject for any BSS that has an RSSI better than + * disassoc_imminent_rssi_threshold. + */ + for (i = 0; i < wpa_s->wnm_num_neighbor_report; i++) { + struct neighbor_report *nei; + + nei = &wpa_s->wnm_neighbor_report_elements[i]; + + bss = wpa_bss_get_bssid(wpa_s, nei->bssid); + + if (bss->level > + wpa_s->conf->disassoc_imminent_rssi_threshold) + nei->drv_mbo_reject = 0; + } + + bss = compare_scan_neighbor_results(wpa_s, &reason); + } +#endif /* CONFIG_MBO */ /* * If this is a pre-scan check, returning 0 will trigger a scan and @@ -2079,6 +2076,9 @@ bool wnm_is_bss_excluded(struct wpa_supplicant *wpa_s, struct wpa_bss *bss) if (nei->preference_present && nei->preference == 0) return true; + if (nei->drv_mbo_reject) + return true; + break; } diff --git a/wpa_supplicant/wnm_sta.h b/wpa_supplicant/wnm_sta.h index 235a838fa..5994027a4 100644 --- a/wpa_supplicant/wnm_sta.h +++ b/wpa_supplicant/wnm_sta.h @@ -44,9 +44,9 @@ struct neighbor_report { unsigned int rm_capab_present:1; unsigned int bearing_present:1; unsigned int bss_term_present:1; - unsigned int acceptable:1; #ifdef CONFIG_MBO unsigned int is_first:1; + unsigned int drv_mbo_reject:1; #endif /* CONFIG_MBO */ struct measurement_pilot *meas_pilot; struct multiple_bssid *mul_bssid; From patchwork Mon Apr 29 11:51:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Berg X-Patchwork-Id: 1928954 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=YvbF0Itp; 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=g/dWLW5J; 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 4VShXk2K6yz23t4 for ; Mon, 29 Apr 2024 21:52:54 +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=Cgtdi1/v98hgCxd0QRu1Vj7LQKTtXWBY/4aAI5PsjyA=; b=YvbF0Itp1UZcHc IRFC8mvVGh5aFzrrKjHSHdp8PtaM+dX22HlFF2udLv3XJgbk2Q2etRNq3FEhPbhUAjX6Kd3ITW/g7 L/fPPVKUVvqgiGTIDPSAuk95enteqGGKRr0KmdC6EwM0gdq43EdHVuGT8v3eo7A1RZEU2coT84r9u /KjH0YMXE4nUjRmT4ksR5jh8gIFETdpD+0PCiHaBLeO2ws/4AFd666qJ2SKNL+cJwsva+JEtFJ2Yb Hw+WEe1OP3MGKq1R7zn40IhFrMmQDwQtUsPtmkRbLU7NSMRmRawYX1f7k0n/4i860EFKQuywOY5XA 1R39PywzTtFo28ohW1Dw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1PYf-00000002XJp-2r3D; Mon, 29 Apr 2024 11:52:33 +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 1s1PYN-00000002XBH-0Rm9 for hostap@lists.infradead.org; Mon, 29 Apr 2024 11:52:17 +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=2Ftjn+9K/XzccVJjy8UAvuRpSNnN5Yu1DRnURPqPywo=; t=1714391534; x=1715601134; b=g/dWLW5J6fgD6IDHF7bK0PyW3ADKgSarTNp0m8f4ZTb5MK7 WtWYvYLkRllRZKI1AMYqg4H0FFpRbyl65gTz5cJOq29q3o5JiFjoU8YAbhTuyl7PxUUyH8b92G+QE YP3Pwhxoc5Y42seAzDV4Yof56A14gX4lvhny7Qn3m6piI61w+WDJ9UtjjdPZn1y/m6/U7QqaSJvcV /KY/c0WmBuyAyPZGT2iibEeVpua9snYVvnhsFIUThmVSNggA/jcKAFdiS5kt6NY8GBmEa6RHlypW/ 8JXIau7qQ7EVXl8UZ18kmQS+2LamHGkXKwKjnOEhDNCEoDG3k1XF7whg6YIDJ0IQ==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1s1PYK-0000000CNIg-2ydd; Mon, 29 Apr 2024 13:52:13 +0200 From: benjamin@sipsolutions.net To: hostap@lists.infradead.org Cc: Benjamin Berg Subject: [PATCH 09/16] tests: Set the abridged bit in BTM tests Date: Mon, 29 Apr 2024 13:51:50 +0200 Message-ID: <20240429115157.211073-10-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_045215_499822_C3A6300F X-CRM114-Status: GOOD ( 10.96 ) 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 Many of the WNM tests assume that the supplicant will only select a neighbor that was included in the candidate list. However, without the abridged bit being set, the supplicant is allowed to also sel [...] 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 Many of the WNM tests assume that the supplicant will only select a neighbor that was included in the candidate list. However, without the abridged bit being set, the supplicant is allowed to also select any BSS that is not explicitly included in the list. Prepare for the supplicant handling the abridged bit by setting it in the tests where relevant. Signed-off-by: Benjamin Berg --- tests/hwsim/test_wnm.py | 66 ++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/tests/hwsim/test_wnm.py b/tests/hwsim/test_wnm.py index d1ad0a8fd..ecaf19009 100644 --- a/tests/hwsim/test_wnm.py +++ b/tests/hwsim/test_wnm.py @@ -613,7 +613,7 @@ def test_wnm_bss_tm_req(dev, apdev): # truncated BSS TM Request req = bss_tm_req(addr, apdev[0]['bssid'], - req_mode=0x08) + req_mode=0x0a) req['payload'] = struct.pack(" X-Patchwork-Id: 1928953 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=rCa92eJw; 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=rczNFvEN; 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 4VShXj3sQKz1ymX for ; Mon, 29 Apr 2024 21:52:53 +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=WvAgLxaXLO8tiSN0d1CCexKeYMZm2sY1obK9ipCKDQ8=; b=rCa92eJwqlddIN BXd25JNizKwCxGtpKiJPJeCb8+xyvjF8RIvmRIdTfxCFh0ojI2DkNY0kJx48Utq87WlkTkiVTt81h SWBQIxv0pCabwCyIl4VPSRgyukai7KhBXq2sNrtSCosLr48Azz9OWj5Yx2gF4Ohmy0RPRbiiqajcq 78Uhn40Y3x5YsEWnCTs7nQLZZS3bECmp86/qX8Mn7BWjjfGpoymyl//Dfvw4JaI7amXo0nKu/rnfV S3reKH7lRKew6LP1snNU33XF/P9Xa55y15GJUsKGdQEXmx+2UcYXlyV7QE6VsKtuR4ygq8QImN8Sp KZEPjeedZgcDJa6T+LKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1PYh-00000002XLS-3sPG; Mon, 29 Apr 2024 11:52:35 +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 1s1PYP-00000002XBz-246j for hostap@lists.infradead.org; Mon, 29 Apr 2024 11:52:19 +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=DApanPiljC1/Kg9JjOvITeN2YTjMAqAdw+mkr7ieRM8=; t=1714391537; x=1715601137; b=rczNFvENVlEBE2x9+b6yYj4UElYlpO2+GynJHsxxDUy5mkj nouom84k+eoiB9zglF6uYfcYRz9lDJgCHC7nDLfYvP85SYrbhJmHK6VYvOcdzCikD0KZhXItl1Xgr NRs5BMEa2y3XtLSSxvybd4EvfLeYldRNv1Tk91CGGAllVFueLIcIL6giYAmywdy4p/l+hdh5eI1up Hps+zPrIvooqPDMbS02swvkqKqjGgCzbhHJc22mPRR+s8Ehajh3vfK0IJMC7RWorpJ0LV2ETMWhdw 6Kn+9p8SjRKP065Y9e1yvsiabCULKd7OjRW3DZ0Sz24vzqB7Um2+f9Ww5pW9IksQ==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1s1PYL-0000000CNIg-3pbd; Mon, 29 Apr 2024 13:52:15 +0200 From: benjamin@sipsolutions.net To: hostap@lists.infradead.org Cc: Benjamin Berg Subject: [PATCH 10/16] WNM: Use standard BSS selection and enable abridged bit handling Date: Mon, 29 Apr 2024 13:51:51 +0200 Message-ID: <20240429115157.211073-11-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_045217_777970_81592B70 X-CRM114-Status: GOOD ( 21.81 ) 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 Most of the logic to reject BSSs during transition has been moved into wnm_is_bss_excluded. In addition to this, since commit 67bf89f55442 ("WNM: Choose the best available BSS, not just the first one" [...] 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 Most of the logic to reject BSSs during transition has been moved into wnm_is_bss_excluded. In addition to this, since commit 67bf89f55442 ("WNM: Choose the best available BSS, not just the first one") we will simply choose the BSS with the best throughput. Overall, this matches the behaviour that the supplicant will use anyway in wpa_supplicant_select_bss. The only bigger difference is that using this will check all known BSSs instead of only the ones in the candidate list. This means that with this change the abridged bit is handled according to spec. Another slight change is that this drops the logic to reject candidates with a very low signal level. This does not seem to very relevant anymore as we prefere stronger BSSs to begin with. Signed-off-by: Benjamin Berg --- wpa_supplicant/events.c | 2 +- wpa_supplicant/wnm_sta.c | 129 +++--------------------------- wpa_supplicant/wpa_supplicant_i.h | 5 ++ 3 files changed, 18 insertions(+), 118 deletions(-) diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 4505d9e15..31c807879 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -1709,7 +1709,7 @@ struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s, } -static struct wpa_bss * +struct wpa_bss * wpa_supplicant_select_bss(struct wpa_supplicant *wpa_s, struct wpa_ssid *group, struct wpa_ssid **selected_ssid, diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c index 64124348f..8c51b3ddb 100644 --- a/wpa_supplicant/wnm_sta.c +++ b/wpa_supplicant/wnm_sta.c @@ -693,117 +693,6 @@ fetch_drv_mbo_transition_candidate_info(struct wpa_supplicant *wpa_s) #endif /* CONFIG_MBO */ -static struct wpa_bss * find_better_target(struct wpa_bss *a, - struct wpa_bss *b) -{ - if (!a) - return b; - if (!b) - return a; - - if (a->est_throughput > b->est_throughput) { - wpa_printf(MSG_DEBUG, "WNM: A is better: " MACSTR - " est-tput: %d B: " MACSTR " est-tput: %d", - MAC2STR(a->bssid), a->est_throughput, - MAC2STR(b->bssid), b->est_throughput); - return a; - } - - wpa_printf(MSG_DEBUG, "WNM: B is better, A: " MACSTR - " est-tput: %d B: " MACSTR " est-tput: %d", - MAC2STR(a->bssid), a->est_throughput, - MAC2STR(b->bssid), b->est_throughput); - return b; -} - -static struct wpa_bss * -compare_scan_neighbor_results(struct wpa_supplicant *wpa_s, - enum mbo_transition_reject_reason *reason) -{ - u8 i; - struct wpa_bss *bss = wpa_s->current_bss; - struct wpa_bss *target; - struct wpa_bss *best_target = NULL; - struct wpa_bss *bss_in_list = NULL; - - if (!bss) - return NULL; - - wpa_printf(MSG_DEBUG, "WNM: Current BSS " MACSTR " RSSI %d", - MAC2STR(wpa_s->bssid), bss->level); - - for (i = 0; i < wpa_s->wnm_num_neighbor_report; i++) { - struct neighbor_report *nei; - - nei = &wpa_s->wnm_neighbor_report_elements[i]; - - target = wpa_bss_get_bssid(wpa_s, nei->bssid); - if (!target) { - wpa_printf(MSG_DEBUG, "Candidate BSS " MACSTR - " (pref %d) not found in scan results", - MAC2STR(nei->bssid), - nei->preference_present ? nei->preference : - -1); - continue; - } - - /* - * TODO: Could consider allowing transition to another ESS if - * PMF was enabled for the association. - */ - if (!wpa_scan_res_match(wpa_s, 0, target, wpa_s->current_ssid, - 1, 0)) { - wpa_printf(MSG_DEBUG, "Candidate BSS " MACSTR - " (pref %d) does not match the current network profile", - MAC2STR(nei->bssid), - nei->preference_present ? nei->preference : - -1); - continue; - } - - if (target->level < bss->level && target->level < -80) { - wpa_printf(MSG_DEBUG, "Candidate BSS " MACSTR - " (pref %d) does not have sufficient signal level (%d)", - MAC2STR(nei->bssid), - nei->preference_present ? nei->preference : - -1, - target->level); - continue; - } - - best_target = find_better_target(target, best_target); - if (target == bss) - bss_in_list = bss; - } - - target = best_target; - - if (!target) - return NULL; - - wpa_printf(MSG_DEBUG, - "WNM: Found an acceptable preferred transition candidate BSS " - MACSTR " (RSSI %d, tput: %d bss-tput: %d)", - MAC2STR(target->bssid), target->level, - target->est_throughput, bss->est_throughput); - - if (!bss_in_list) - return target; - - if ((!target->est_throughput && !bss_in_list->est_throughput) || - (target->est_throughput > bss_in_list->est_throughput && - target->est_throughput - bss_in_list->est_throughput > - bss_in_list->est_throughput >> 4)) { - /* It is more than 100/16 percent better, so switch. */ - return target; - } - - wpa_printf(MSG_DEBUG, - "WNM: Stay with our current BSS, not enough change in estimated throughput to switch"); - return bss_in_list; -} - - static int wpa_bss_ies_eq(struct wpa_bss *a, struct wpa_bss *b, u8 eid) { const u8 *ie_a, *ie_b; @@ -1121,11 +1010,12 @@ static void wnm_bss_tm_connect(struct wpa_supplicant *wpa_s, int wnm_scan_process(struct wpa_supplicant *wpa_s, bool pre_scan_check) { - struct wpa_bss *bss; + struct wpa_bss *bss, *current_bss = wpa_s->current_bss; struct wpa_ssid *ssid = wpa_s->current_ssid; enum bss_trans_mgmt_status_code status = WNM_BSS_TM_REJECT_UNSPECIFIED; enum mbo_transition_reject_reason reason = MBO_TRANSITION_REJECT_REASON_UNSPECIFIED; + struct wpa_ssid *selected_ssid = NULL; if (!wpa_s->wnm_dialog_token) return 0; @@ -1149,7 +1039,7 @@ int wnm_scan_process(struct wpa_supplicant *wpa_s, bool pre_scan_check) fetch_drv_mbo_candidate_info(wpa_s, &reason); /* Compare the Neighbor Report and scan results */ - bss = compare_scan_neighbor_results(wpa_s, &reason); + bss = wpa_supplicant_select_bss(wpa_s, ssid, &selected_ssid, 1); #ifdef CONFIG_MBO if (!bss && wpa_s->wnm_mbo_trans_reason_present && wpa_s->wnm_mode & WNM_BSS_TM_REQ_DISASSOC_IMMINENT) { @@ -1175,7 +1065,7 @@ int wnm_scan_process(struct wpa_supplicant *wpa_s, bool pre_scan_check) nei->drv_mbo_reject = 0; } - bss = compare_scan_neighbor_results(wpa_s, &reason); + bss = wpa_supplicant_select_bss(wpa_s, ssid, &selected_ssid, 1); } #endif /* CONFIG_MBO */ @@ -1200,9 +1090,8 @@ int wnm_scan_process(struct wpa_supplicant *wpa_s, bool pre_scan_check) return 0; #ifndef CONFIG_NO_ROAMING - if (wpa_s->current_bss && bss != wpa_s->current_bss && - wpa_supplicant_need_to_roam_within_ess(wpa_s, - wpa_s->current_bss, + if (current_bss && bss != current_bss && + wpa_supplicant_need_to_roam_within_ess(wpa_s, current_bss, bss)) return 0; #endif /* CONFIG_NO_ROAMING */ @@ -1214,6 +1103,12 @@ int wnm_scan_process(struct wpa_supplicant *wpa_s, bool pre_scan_check) goto send_bss_resp_fail; } + wpa_printf(MSG_DEBUG, + "WNM: Found an acceptable preferred transition candidate BSS " + MACSTR " (RSSI %d, tput: %d bss-tput: %d)", + MAC2STR(bss->bssid), bss->level, bss->est_throughput, + current_bss ? current_bss->est_throughput : -1); + /* Associate to the network */ wnm_bss_tm_connect(wpa_s, bss, ssid, 1); return 1; diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index d4a1284c3..64177546f 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -1950,6 +1950,11 @@ struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s, struct wpa_ssid *group, int only_first_ssid, int debug_print); +struct wpa_bss * wpa_supplicant_select_bss(struct wpa_supplicant *wpa_s, + struct wpa_ssid *group, + struct wpa_ssid **selected_ssid, + int only_first_ssid); + int wpas_ctrl_iface_get_pref_freq_list_override(struct wpa_supplicant *wpa_s, enum wpa_driver_if_type if_type, unsigned int *num, From patchwork Mon Apr 29 11:51:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Berg X-Patchwork-Id: 1928955 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=3fABvaKT; 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=H0tas8PX; 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 4VShXs3FdYz1ymX for ; Mon, 29 Apr 2024 21:53:01 +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=rm/1OBnhoBzdM2w7AJHoIaSR/LbyoX6a/UjsYdhNdzU=; b=3fABvaKT0SPn+X BN1D903Y/bXxvSVdOnyxjDovx8f7GuIrVhZ5BdfeWCxDBT64yIu354h4NeYAiC+PdDd8LSHGRxnP8 /T8wehV6hhD4YdgkiKfK7uJintfxlUH0x4wNLJTzR0exO6hX+aAo5SZ72aPJOc2E2ctyux6gXGvwd JrbOizq6KB1E3UX0ieRIeU7fuALJlRD+fxprrowCyonzup81+XNaOFEAjTKiNUFV1bkgpNzBOPdI8 Ki9vo4NyQGCE5YFB1ACbNlQynL5GVlUgY79FwIu1CQe1NFAaPplwBLUEuNUh1E8XVlL98Tf5hkzZE X9krtgUt7+9XcP//IyVw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1PYo-00000002XR2-0o1U; Mon, 29 Apr 2024 11:52:42 +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 1s1PYQ-00000002XCB-1hza for hostap@lists.infradead.org; Mon, 29 Apr 2024 11:52:20 +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=6zvmjroKMJsvsiU233819fAQetkZGm0Wut5SjM2Pz9U=; t=1714391538; x=1715601138; b=H0tas8PXrttgdEhVXJFkkk569JBsZHjgI2ZRxmcOeBMQ776 WyHKYCJaySC6yQXsoGFa93prA5ra+bnJCDgMlH7dAq+zHagGe0M/c/gOQw1ZOxUroo5100sGUeUGZ 45KZPDG1NqoblGBoYgSB9sEkF/N/fT4lAEejJWCMf935JrPbL03wH5rB36Jdn9s2pQNG8M8/VSn6a MWPffrduMrSAnjhSfPtAM3THoJPg7NFG3siAWIzBwg1RRBopsu1VsnmAv4jPtWnGVglnO9PafeKbV Y7m5lRiHYZuTpJMsAAK53zPxtwnRkUDOY9536rXO/Ki58w56v58hmm/MRXT9gUOg==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1s1PYO-0000000CNIg-1C5S; Mon, 29 Apr 2024 13:52:16 +0200 From: benjamin@sipsolutions.net To: hostap@lists.infradead.org Cc: Avraham Stern , Benjamin Berg Subject: [PATCH 11/16] MBO: Always accept BTM request with disassociation imminent bit set Date: Mon, 29 Apr 2024 13:51:52 +0200 Message-ID: <20240429115157.211073-12-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_045218_522397_07F2EC9D X-CRM114-Status: GOOD ( 12.60 ) 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: Avraham Stern According to Multiband Operation specification (r17, section 3.5.2), a BSS Transition Management Request with the disassociation imminent bit set should always be accepted. 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: Avraham Stern According to Multiband Operation specification (r17, section 3.5.2), a BSS Transition Management Request with the disassociation imminent bit set should always be accepted. This is enforced in case the request did not include a candidate list. However, in case a candidate list was included but none of the APs in the candidate list was found in the scan results, the request is rejected. Fix that by always accepting a request with the disassociation imminent bit set even if no roaming candidate was found. type=feature Signed-off-by: Avraham Stern Signed-off-by: Benjamin Berg --- wpa_supplicant/wnm_sta.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c index 8c51b3ddb..4a3fd5eb1 100644 --- a/wpa_supplicant/wnm_sta.c +++ b/wpa_supplicant/wnm_sta.c @@ -1114,11 +1114,18 @@ int wnm_scan_process(struct wpa_supplicant *wpa_s, bool pre_scan_check) return 1; send_bss_resp_fail: - /* Send reject response for all the failures */ + if (wpa_s->wnm_reply) { + /* If disassoc imminent is set, we must not reject */ + if (wpa_s->wnm_mode & WNM_BSS_TM_REQ_DISASSOC_IMMINENT || + wpa_s->wnm_mode & WNM_BSS_TM_REQ_ESS_DISASSOC_IMMINENT) { + wpa_printf(MSG_DEBUG, + "WNM: Accept BTM request because disassociation imminent bit is set"); + status = WNM_BSS_TM_ACCEPT; + } - if (wpa_s->wnm_reply) wnm_send_bss_transition_mgmt_resp(wpa_s, status, reason, 0, NULL); + } wnm_btm_reset(wpa_s); From patchwork Mon Apr 29 11:51:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Berg X-Patchwork-Id: 1928956 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=aqwWsHzc; 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=ev/u7UwB; 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 4VShY65h3Gz1ymX for ; Mon, 29 Apr 2024 21:53:14 +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=yPbLjXkxegevB4WYe98hC5pWuTuR3UsvEYDh0DBSabA=; b=aqwWsHzcQQMxdx ihTZavtJj0yhsvZYOG85xjJa0Ru3rKBGiDN9Q7t51eakDrXCazPlJPn97hplIcMtzQMkzGKgT0V3q NfcMuqVFQezUm6LdtnETd0cYygRDOXHWCt9vAM5//U7eVQ7y4V0r9y5Aemyu62JA446QrN3fiM/Ub 51T3DRSdCAbU6RZ8D2KWkfrzinvkdEmhQ9y4K9Jk9oL6yT+Sgco9oDI1ZlR2i9qvrrig6nXAab4Sa OrbhfbCzJIThlQs0Ai4A8FxJUuSJD7nUfAJxcGPh2quChMQQ5Ysndn02XPLWsynAvl9ljVtOczXlB ZRaJTAcs2gJeqnVYrdgg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1PZ0-00000002Xaf-0QPl; Mon, 29 Apr 2024 11:52:54 +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 1s1PYR-00000002XCj-15vK for hostap@lists.infradead.org; Mon, 29 Apr 2024 11:52:20 +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=1XQQpYOnzSOuKpuDtmCNt5iljnAQLo1ftTFzG43x3k4=; t=1714391539; x=1715601139; b=ev/u7UwB1ux9VAozQQVRMlbUEUI376sfk5GAPJN7wgFDL3Z cVh2CacxKMGI33/8YaCYrtD3Ko/c3TX8XABfMnCEoGooz0pkpwRfyh1m72/soz9pH0omxHZ7p6oBm M6hV1hPPNQPGxWiUpUqUWyU0wz+F4rQ4k/7vlJqkTaCZlF5ktGNLvS1V/5IX5npacY1ZjCzS6qtI/ oG8Jc21ye9SIl4JmJMmGt2oE5SmVVt6RsP0UDLajLorESq982/k5HqmzyDdC1K7/E5quph3ufM2A2 goSRM12qthCQzK92dLQDv87TrK2iRRrQHNbRGJ7YpWqE6UboZS+XSFEkTGsirY2Q==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1s1PYP-0000000CNIg-0seM; Mon, 29 Apr 2024 13:52:17 +0200 From: benjamin@sipsolutions.net To: hostap@lists.infradead.org Cc: Benjamin Berg Subject: [PATCH 12/16] WNM: Reject requests with an invalid dialog token Date: Mon, 29 Apr 2024 13:51:53 +0200 Message-ID: <20240429115157.211073-13-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_045219_422507_A72BBF73 X-CRM114-Status: UNSURE ( 8.64 ) X-CRM114-Notice: Please train this message. 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 The dialog token must be non-zero. We are using this fact internally to track the state in some cases, so ensure that the assumption is valid. Signed-off-by: Benjamin Berg --- wpa_supplicant/wnm_sta.c | 6 ++++++ 1 file changed, 6 insertions(+) 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 The dialog token must be non-zero. We are using this fact internally to track the state in some cases, so ensure that the assumption is valid. Signed-off-by: Benjamin Berg --- wpa_supplicant/wnm_sta.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c index 4a3fd5eb1..f0cbf914c 100644 --- a/wpa_supplicant/wnm_sta.c +++ b/wpa_supplicant/wnm_sta.c @@ -1347,6 +1347,12 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s, wpa_s->wnm_dialog_token, wpa_s->wnm_mode, wpa_s->wnm_dissoc_timer, valid_int); + if (!wpa_s->wnm_dialog_token) { + wpa_printf(MSG_DEBUG, "WNM: invalid dialog token"); + wnm_btm_reset(wpa_s); + return; + } + #if defined(CONFIG_MBO) && defined(CONFIG_TESTING_OPTIONS) if (wpa_s->reject_btm_req_reason) { wpa_printf(MSG_INFO, From patchwork Mon Apr 29 11:51:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Berg X-Patchwork-Id: 1928957 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=rzWX6rf/; 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=T90QzTiL; 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 4VShYP56j5z1ymX for ; Mon, 29 Apr 2024 21:53:29 +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=cgGQ89tBS0F2ydaLTnKIRg5Y9JWuke0u8MI3FgLR35k=; b=rzWX6rf/dBY/Q/ qJPzsqKUQvC17X8GDV3ZGAFBy171QpAQb5IoN78EnyoZA22aGMGoiMzaml4bu1x7SDrqjkal7gNhN TwfZhAu7cQGLzYy+y2bWBjxbHO8RHAwUv2ji1ixqbd78rTrsuUi7SnbXQh0IBnGjwRjzh4uJ5qjrl ofyrswuELC2wdaSp8S+JGYwDmlzhYGFji7l2hZ85WwCyXdvORAvtI2pmmoAfRVdB6habDIegkTAo1 /LAP1Ctw0yOtjuEY5dqrrar9y3DYENmaCHTU0xcg5MlNWROevBhZTDowgEWyjFMCBFU0Rno81DOHd NMoyNu2PIZdkDIMOrxBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1PZH-00000002Xse-1LJw; Mon, 29 Apr 2024 11:53:11 +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 1s1PYR-00000002XD2-3sk9 for hostap@lists.infradead.org; Mon, 29 Apr 2024 11:52:21 +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=xedUFH/4VMhmUwr29jAOHfGOJlktAmvERV+GwAlP164=; t=1714391539; x=1715601139; b=T90QzTiLbVcNci5Fgg7b2RIkDEFA8JrPP8QcyvAB809Pr2F LI3NZAoQ9Ikd64wEvaDFjAeAOkCFb1lFWVoCYINTXzS5zobRJw5VdgAKukjlGufy7rpHY8vS2a6CZ edMMTAzSsU3rWvppfRCUn1fZPvT6jf59oUXZOCkp08jhIjNAwGwj66JNuc/TRx8wxgTaRceDePOnn 2XE9WWLyqMDPrmy2CXjKFgcqgyUsdmpHLdyqiT0OwCjbfy4eHp5TxMDs697+55DpmK4AO3aBzqe7W 5v3PIeeMutWNNqk4Yj4qsbHleTBFoM2sotBQ2LYjEH/9BVRRKT4PL0yR+fgSuCiQ==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1s1PYQ-0000000CNIg-0Xb7; Mon, 29 Apr 2024 13:52:18 +0200 From: benjamin@sipsolutions.net To: hostap@lists.infradead.org Cc: Benjamin Berg Subject: [PATCH 13/16] WNM: Consolidate the scanning paths for BTM requests Date: Mon, 29 Apr 2024 13:51:54 +0200 Message-ID: <20240429115157.211073-14-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_045220_201565_0972D68C X-CRM114-Status: GOOD ( 24.46 ) 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 There was an ancient code path to trigger a scan that was apparently forgotten when the code was extended over time. It does not make any sense to trigger a scan twice, so remove the earlier scan. 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 There was an ancient code path to trigger a scan that was apparently forgotten when the code was extended over time. It does not make any sense to trigger a scan twice, so remove the earlier scan. The earlier scan call was avoiding to trigger a new scan if a fixed BSSID is configured. This seems like a reasonable restriction to do, so add this check before starting a scan. Consolidate everything so that scanning happens at the end of the functions unless we bail out before. Add a "reset" label for all other cases to ensure that we don't leave things in the a bad state. Signed-off-by: Benjamin Berg --- tests/hwsim/test_ap_hs20.py | 1 + tests/hwsim/test_hapd_ctrl.py | 1 + tests/hwsim/test_wnm.py | 2 + wpa_supplicant/wnm_sta.c | 129 +++++++++++++++++++--------------- 4 files changed, 75 insertions(+), 58 deletions(-) diff --git a/tests/hwsim/test_ap_hs20.py b/tests/hwsim/test_ap_hs20.py index 9cf2d9040..bfdbee1c5 100644 --- a/tests/hwsim/test_ap_hs20.py +++ b/tests/hwsim/test_ap_hs20.py @@ -2813,6 +2813,7 @@ def _test_ap_hs20_session_info(dev, apdev): 'password': "password"}) interworking_select(dev[0], bssid, freq="2412") interworking_connect(dev[0], bssid, "TTLS") + dev[0].flush_scan_cache() ev = dev[0].wait_event(["ESS-DISASSOC-IMMINENT"], timeout=10) if ev is None: raise Exception("Timeout on ESS disassociation imminent notice") diff --git a/tests/hwsim/test_hapd_ctrl.py b/tests/hwsim/test_hapd_ctrl.py index 9cf8ac73c..5b8361f9f 100644 --- a/tests/hwsim/test_hapd_ctrl.py +++ b/tests/hwsim/test_hapd_ctrl.py @@ -249,6 +249,7 @@ def test_hapd_ctrl_disassoc_imminent(dev, apdev): raise Exception("Unexpected DISASSOC_IMMINENT success") if "FAIL" not in hapd.request("DISASSOC_IMMINENT 00:11:22:33:44:55 2"): raise Exception("Unexpected DISASSOC_IMMINENT success") + dev[0].flush_scan_cache() dev[0].connect(ssid, key_mgmt="NONE", scan_freq="2412") addr = dev[0].p2p_interface_addr() if "OK" not in hapd.request("DISASSOC_IMMINENT " + addr + " 2"): diff --git a/tests/hwsim/test_wnm.py b/tests/hwsim/test_wnm.py index ecaf19009..4df9d77f3 100644 --- a/tests/hwsim/test_wnm.py +++ b/tests/hwsim/test_wnm.py @@ -120,6 +120,7 @@ def test_wnm_disassoc_imminent(dev, apdev): """WNM Disassociation Imminent""" hapd = start_wnm_ap(apdev[0], time_adv=True, wnm_sleep_mode=True) dev[0].connect("test-wnm", key_mgmt="NONE", scan_freq="2412") + dev[0].flush_scan_cache() addr = dev[0].p2p_interface_addr() hapd.request("DISASSOC_IMMINENT " + addr + " 10") ev = dev[0].wait_event(["WNM: Disassociation Imminent"]) @@ -137,6 +138,7 @@ def test_wnm_disassoc_imminent_bssid_set(dev, apdev): hapd2 = start_wnm_ap(apdev[1], time_adv=True, wnm_sleep_mode=True) dev[0].connect("test-wnm", key_mgmt="NONE", bssid=hapd.own_addr(), scan_freq="2412") + dev[0].flush_scan_cache() addr = dev[0].own_addr() cmd = "BSS_TM_REQ " + addr + " pref=1 disassoc_imminent=1 disassoc_timer=100 neighbor=" + apdev[1]['bssid'] + ",0x0000," + "81,1,7,0301ff" if "OK" not in hapd.request(cmd): diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c index f0cbf914c..f4986a3bc 100644 --- a/wpa_supplicant/wnm_sta.c +++ b/wpa_supplicant/wnm_sta.c @@ -1349,8 +1349,7 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s, if (!wpa_s->wnm_dialog_token) { wpa_printf(MSG_DEBUG, "WNM: invalid dialog token"); - wnm_btm_reset(wpa_s); - return; + goto reset; } #if defined(CONFIG_MBO) && defined(CONFIG_TESTING_OPTIONS) @@ -1361,7 +1360,7 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s, wnm_send_bss_transition_mgmt_resp( wpa_s, wpa_s->reject_btm_req_reason, MBO_TRANSITION_REJECT_REASON_UNSPECIFIED, 0, NULL); - return; + goto reset; } #endif /* CONFIG_MBO && CONFIG_TESTING_OPTIONS */ @@ -1370,7 +1369,7 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s, if (wpa_s->wnm_mode & WNM_BSS_TM_REQ_BSS_TERMINATION_INCLUDED) { if (end - pos < 12) { wpa_printf(MSG_DEBUG, "WNM: Too short BSS TM Request"); - return; + goto reset; } os_memcpy(wpa_s->wnm_bss_termination_duration, pos, 12); pos += 12; /* BSS Termination Duration */ @@ -1383,13 +1382,13 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s, if (end - pos < 1) { wpa_printf(MSG_DEBUG, "WNM: Invalid BSS Transition " "Management Request (URL)"); - return; + goto reset; } url_len = *pos++; if (url_len > end - pos) { wpa_printf(MSG_DEBUG, "WNM: Invalid BSS Transition Management Request (URL truncated)"); - return; + goto reset; } os_memcpy(url, pos, url_len); url[url_len] = '\0'; @@ -1424,7 +1423,7 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s, wnm_send_bss_transition_mgmt_resp( wpa_s, WNM_BSS_TM_ACCEPT, 0, 0, NULL); - return; + goto reset; } /* The last link is being removed (which must be the assoc link) @@ -1443,16 +1442,9 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s, os_memcpy(wpa_s->wnm_disassoc_addr, wpa_s->bssid, ETH_ALEN); } - if (disassoc_imminent) { + if (disassoc_imminent) wpa_msg(wpa_s, MSG_INFO, "WNM: Disassociation Imminent - " "Disassociation Timer %u", wpa_s->wnm_dissoc_timer); - 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); - } - } #ifdef CONFIG_MBO vendor = get_ie(pos, end - pos, WLAN_EID_VENDOR_SPECIFIC); @@ -1466,7 +1458,7 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s, wpa_msg(wpa_s, MSG_INFO, "WNM: Preferred List Available"); if (wnm_parse_candidate_list(wpa_s, pos, end) < 0) - return; + goto reset; if (!wpa_s->wnm_num_neighbor_report) { wpa_printf(MSG_DEBUG, @@ -1475,17 +1467,7 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s, wpa_s, WNM_BSS_TM_REJECT_NO_SUITABLE_CANDIDATES, MBO_TRANSITION_REJECT_REASON_UNSPECIFIED, 0, NULL); - return; - } - - if (wpa_s->current_ssid && wpa_s->current_ssid->bssid_set) { - wpa_printf(MSG_DEBUG, - "WNM: Configuration prevents roaming (BSSID set)"); - wnm_send_bss_transition_mgmt_resp( - wpa_s, WNM_BSS_TM_REJECT_NO_SUITABLE_CANDIDATES, - MBO_TRANSITION_REJECT_REASON_UNSPECIFIED, 0, - NULL); - return; + goto reset; } wnm_sort_cand_list(wpa_s); @@ -1495,36 +1477,11 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s, valid_ms); os_get_reltime(&wpa_s->wnm_cand_valid_until); os_reltime_add_ms(&wpa_s->wnm_cand_valid_until, valid_ms); - - /* - * Try fetching the latest scan results from the kernel. - * This can help in finding more up-to-date information should - * the driver have done some internal scanning operations after - * the last scan result update in wpa_supplicant. - * - * It is not a new scan, this does not update the last_scan - * timestamp nor will it expire old BSSs. - */ - wpa_supplicant_update_scan_results(wpa_s, NULL); - if (wnm_scan_process(wpa_s, true) > 0) - return; - wpa_printf(MSG_DEBUG, - "WNM: No valid match in previous scan results - try a new scan"); - - wnm_set_scan_freqs(wpa_s); - if (wpa_s->wnm_num_neighbor_report == 1) { - os_memcpy(wpa_s->next_scan_bssid, - wpa_s->wnm_neighbor_report_elements[0].bssid, - ETH_ALEN); - wpa_printf(MSG_DEBUG, - "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) { + } else if (!disassoc_imminent) { enum bss_trans_mgmt_status_code status; + /* No candidate list and disassociation is not imminent */ + if ((wpa_s->wnm_mode & WNM_BSS_TM_REQ_ESS_DISASSOC_IMMINENT) || wpa_s->wnm_link_removal) status = WNM_BSS_TM_ACCEPT; @@ -1532,10 +1489,66 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s, wpa_msg(wpa_s, MSG_INFO, "WNM: BSS Transition Management Request did not include candidates"); status = WNM_BSS_TM_REJECT_UNSPECIFIED; } - wnm_send_bss_transition_mgmt_resp( - wpa_s, status, - MBO_TRANSITION_REJECT_REASON_UNSPECIFIED, 0, NULL); + + if (reply) + wnm_send_bss_transition_mgmt_resp( + wpa_s, status, + MBO_TRANSITION_REJECT_REASON_UNSPECIFIED, 0, + NULL); + + goto reset; } + + /* + * Try fetching the latest scan results from the kernel. + * This can help in finding more up-to-date information should + * the driver have done some internal scanning operations after + * the last scan result update in wpa_supplicant. + * + * It is not a new scan, this does not update the last_scan + * timestamp nor will it expire old BSSs. + */ + wpa_supplicant_update_scan_results(wpa_s, NULL); + if (wnm_scan_process(wpa_s, true) > 0) + return; + wpa_printf(MSG_DEBUG, + "WNM: No valid match in previous scan results - try a new scan"); + + /* + * If we have a fixed BSSID configured, just reject at this point. + * NOTE: We could actually check if we are allowed to stay (and we do + * above if we have scan results available). + */ + if (wpa_s->current_ssid && wpa_s->current_ssid->bssid_set) { + wpa_printf(MSG_DEBUG, "WNM: Fixed BSSID, rejecting request"); + + if (reply) + wnm_send_bss_transition_mgmt_resp( + wpa_s, + WNM_BSS_TM_REJECT_NO_SUITABLE_CANDIDATES, + 0, 0, NULL); + + goto reset; + } + + wnm_set_scan_freqs(wpa_s); + if (wpa_s->wnm_num_neighbor_report == 1) { + os_memcpy(wpa_s->next_scan_bssid, + wpa_s->wnm_neighbor_report_elements[0].bssid, + ETH_ALEN); + wpa_printf(MSG_DEBUG, + "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); + + /* Continue from scan handler */ + return; + +reset: + wnm_btm_reset(wpa_s); + return; } From patchwork Mon Apr 29 11:51:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Berg X-Patchwork-Id: 1928958 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=tho7ADds; 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=D4Ka3tEX; 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 4VShYg5VFXz1ymX for ; Mon, 29 Apr 2024 21:53:43 +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=y14U/Om2xvf2KLFmIVq2ElZ3d0fJOMBh61WD0zU7xz4=; b=tho7ADdshukHAp cXgAq4ME6/Gcy/6/xhU+VFqkpD+v1VYMK700fhvsHJyJ+615YidKySftBKcFNlmw/qxUykDZ06SbH DeCjDG83ZKQeBH0YFg1SUoYrw4BC9W7czq18uVd1JTIOpBY38ut16XVqcrmtYrs2fqtv5SLWyqCj8 2xbamHhVIcQ/uqnsGz451V7fvy0hE87mWmeB3aa0yiDJcuH4QsPKWtr85z3zp/we8yNBWWZbTcqK/ OkdG743BtKxvZLEmKuL4pIX7aNoF34WfH7SU6LD413+0o7iXQWt+OghAcBqOp0dyC6nRmw1iOvyAG Me6Xx8uN9T7xkBHR6WLg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1PZS-00000002Y2l-3dQR; Mon, 29 Apr 2024 11:53:22 +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 1s1PYT-00000002XDr-1Mts for hostap@lists.infradead.org; Mon, 29 Apr 2024 11:52:22 +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=6KyHfj+8wDMFzCqgyyD7PRvgMTFaHWWdewWxNzsw7ac=; t=1714391541; x=1715601141; b=D4Ka3tEXOR3Y9FNdAG7vRD1zjxrZXmOfpGeXOR5w+jxg33V dFN5Yy105Y/wNjgq6jMms0PEe3eFpKz+OO2hgdR1PwEZ0Lx8i5CCEhXz8v3Ybd79hmEZos4yfeXns Sl54SGSNKkhzyfs3CuD9rwX74hzB7MpH0OKxzxadqNtSFXPmb4OVhX5bR62qGuHxHCPMz78SG1msc cbZhuDe24WHsJ29TbOVmp6LWdBYMjM2h04PqGqvofG7enDpka0cP3t4rshhCxdutdG/p7Xo/OIn+W HOUT/ewKdN1yqBHRi9tVkxIfuTCt46Wyu1ELI/q4H4tCMeLC61l5IzoKR5mGR1aQ==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1s1PYR-0000000CNIg-0krG; Mon, 29 Apr 2024 13:52:19 +0200 From: benjamin@sipsolutions.net To: hostap@lists.infradead.org Cc: Benjamin Berg Subject: [PATCH 14/16] WNM: Always parse candidate list Date: Mon, 29 Apr 2024 13:51:55 +0200 Message-ID: <20240429115157.211073-15-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_045221_454567_784A95AE 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 The candidate list included bit just makes parsing the list mandatory. The AP may still include a candidate list which we should use to be able to optimize scanning. As such, always parse out the list [...] 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 The candidate list included bit just makes parsing the list mandatory. The AP may still include a candidate list which we should use to be able to optimize scanning. As such, always parse out the list but still verify that if the list is not empty if the bit is set. Signed-off-by: Benjamin Berg --- wpa_supplicant/wnm_sta.c | 48 ++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c index f4986a3bc..b365fc4d3 100644 --- a/wpa_supplicant/wnm_sta.c +++ b/wpa_supplicant/wnm_sta.c @@ -1264,12 +1264,6 @@ static void wnm_set_scan_freqs(struct wpa_supplicant *wpa_s) static int wnm_parse_candidate_list(struct wpa_supplicant *wpa_s, const u8 *pos, const u8 *end) { - wpa_s->wnm_neighbor_report_elements = os_calloc( - WNM_MAX_NEIGHBOR_REPORT, - sizeof(struct neighbor_report)); - if (wpa_s->wnm_neighbor_report_elements == NULL) - return -1; - while (end - pos >= 2 && wpa_s->wnm_num_neighbor_report < WNM_MAX_NEIGHBOR_REPORT) { @@ -1284,6 +1278,15 @@ static int wnm_parse_candidate_list(struct wpa_supplicant *wpa_s, } if (tag == WLAN_EID_NEIGHBOR_REPORT) { struct neighbor_report *rep; + + if (!wpa_s->wnm_num_neighbor_report) { + wpa_s->wnm_neighbor_report_elements = os_calloc( + WNM_MAX_NEIGHBOR_REPORT, + sizeof(struct neighbor_report)); + if (wpa_s->wnm_neighbor_report_elements == NULL) + return -1; + } + rep = &wpa_s->wnm_neighbor_report_elements[ wpa_s->wnm_num_neighbor_report]; wnm_parse_neighbor_report(wpa_s, pos, len, rep); @@ -1452,23 +1455,22 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s, wpas_mbo_ie_trans_req(wpa_s, vendor + 2, vendor[1]); #endif /* CONFIG_MBO */ - if (wpa_s->wnm_mode & WNM_BSS_TM_REQ_PREF_CAND_LIST_INCLUDED) { - unsigned int valid_ms; - - wpa_msg(wpa_s, MSG_INFO, "WNM: Preferred List Available"); + if (wnm_parse_candidate_list(wpa_s, pos, end) < 0) + goto reset; - if (wnm_parse_candidate_list(wpa_s, pos, end) < 0) - goto reset; + if (wpa_s->wnm_mode & WNM_BSS_TM_REQ_PREF_CAND_LIST_INCLUDED && + !wpa_s->wnm_num_neighbor_report) { + wpa_printf(MSG_DEBUG, + "WNM: Candidate list included bit is set, but no candidates found"); + wnm_send_bss_transition_mgmt_resp( + wpa_s, WNM_BSS_TM_REJECT_NO_SUITABLE_CANDIDATES, + MBO_TRANSITION_REJECT_REASON_UNSPECIFIED, 0, + NULL); + goto reset; + } - if (!wpa_s->wnm_num_neighbor_report) { - wpa_printf(MSG_DEBUG, - "WNM: Candidate list included bit is set, but no candidates found"); - wnm_send_bss_transition_mgmt_resp( - wpa_s, WNM_BSS_TM_REJECT_NO_SUITABLE_CANDIDATES, - MBO_TRANSITION_REJECT_REASON_UNSPECIFIED, 0, - NULL); - goto reset; - } + if (wpa_s->wnm_num_neighbor_report) { + unsigned int valid_ms; wnm_sort_cand_list(wpa_s); wnm_dump_cand_list(wpa_s); @@ -1477,7 +1479,9 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s, valid_ms); os_get_reltime(&wpa_s->wnm_cand_valid_until); os_reltime_add_ms(&wpa_s->wnm_cand_valid_until, valid_ms); - } else if (!disassoc_imminent) { + } + + if (!wpa_s->wnm_num_neighbor_report && !disassoc_imminent) { enum bss_trans_mgmt_status_code status; /* No candidate list and disassociation is not imminent */ From patchwork Mon Apr 29 11:51:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Berg X-Patchwork-Id: 1928963 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=GTZy+n4c; 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=u/cx/ZNn; 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 4VShZ96W2xz1ymX for ; Mon, 29 Apr 2024 21:54:09 +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=W3QJ6UXMKTSFFf6QgVMi2Ab1SupD4hEAIm1dYkkVs04=; b=GTZy+n4coGFNVN WvK/T+TvT/OjMHcZm8Hg+ZGSQtu4ISwoex+bUOBLxlkSE5TnicLSrG255ZGQ6spJw9uw0fxv7IBYj UHwuWvNk01FU9XDmP7sMDkHN8t6I375oLwGEPbIJrpZcx2A0M8b3vgpKh9IwAYZSaPWQhoIDwN6FK FKQqPYq/f7nswZks4x+Vf/k8K+3ElA+XkheI5bB+A/OCkk624bXHgWZp9y1mH+Xft3QdEOzJSyDRs CkPFLsAwMTVrJhAMgUnIa0XWrEcbPjbnF/SG+ALuDqcRcs2ObkDeGxg3Ep8QcCCbmU+elKPxjWO6P WXih4Qxc9zB7YXGgTfCw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1PZu-00000002YOO-2Dng; Mon, 29 Apr 2024 11:53:50 +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 1s1PYU-00000002XE8-16mt for hostap@lists.infradead.org; Mon, 29 Apr 2024 11:52:23 +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=QOQ6hvktA0nRQY7iqWWFTSsZUefsHAFwwQTQLIrb4VI=; t=1714391542; x=1715601142; b=u/cx/ZNnqi/kxsw0Sz2W+I1vqxChucGAPtz9dJrx4osZ4hr zBpPVZ7YRs3FCJAIFnvwSTdJ/+tRnsVjDZQYYkkyssFxwk0/HN7HjBkMrBBkRBx6IQV1cNem6/xTn BH7lMsn7r4JEsaNOc0S7rQj2cLS/cXOd/4cgmXrudKA1fYMFXRjxsik9aHAKDc3z/mmFJHvyD5Rkm IayO0ADQFghydfxVlf7EoDVvYGYVCtTpefZ56GQE78qEv5oWB/l/1Ox4kA+qeT0jSLHypseBQNh7J 4lGxDLl1kme2fpLD2jGLd6QPmXiZE0LM+X+easIm1/PG8teKBbhH4G4v49yXkZ4A==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1s1PYS-0000000CNIg-0mTo; Mon, 29 Apr 2024 13:52:20 +0200 From: benjamin@sipsolutions.net To: hostap@lists.infradead.org Cc: Benjamin Berg Subject: [PATCH 15/16] tests: Add a WNM tests to check candidate list is used if not required Date: Mon, 29 Apr 2024 13:51:56 +0200 Message-ID: <20240429115157.211073-16-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_045222_440719_6486AEE0 X-CRM114-Status: UNSURE ( 9.69 ) X-CRM114-Notice: Please train this message. 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 This tests that the candidate list is used even if it is not required because the abridged and preferred candidate list included bits are not set. Signed-off-by: Benjamin Berg --- tests/hwsim/test_wnm.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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 This tests that the candidate list is used even if it is not required because the abridged and preferred candidate list included bits are not set. Signed-off-by: Benjamin Berg --- tests/hwsim/test_wnm.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/hwsim/test_wnm.py b/tests/hwsim/test_wnm.py index 4df9d77f3..fe3417dc3 100644 --- a/tests/hwsim/test_wnm.py +++ b/tests/hwsim/test_wnm.py @@ -911,6 +911,29 @@ def test_wnm_bss_tm(dev, apdev): ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED"], timeout=0.5) if ev is not None: raise Exception("Unexpected reassociation") + + dev[0].flush_scan_cache() + logger.info("Candidate list is used even if not required by spec (pref=0, abridged=0)") + if "OK" not in hapd2.request("BSS_TM_REQ " + addr + " pref=0 abridged=0 valid_int=255 neighbor=" + apdev[0]['bssid'] + ",0x0000,81,1,7,0301ff" + ' neighbor=' + apdev[1]['bssid'] + ",0x0000,115,36,7,030100"): + raise Exception("BSS_TM_REQ command failed") + ev = hapd2.wait_event(['BSS-TM-RESP'], timeout=10) + if ev is None: + raise Exception("No BSS Transition Management Response") + if "status_code=0" not in ev: + raise Exception("BSS transition request was not accepted: " + ev) + if "target_bssid=" + apdev[0]['bssid'] not in ev: + raise Exception("Unexpected target BSS: " + ev) + # This scans only one frequency + scan_ev = dev[0].wait_event(["CTRL-EVENT-SCAN-STARTED"], timeout=0) + if scan_ev is None: + raise Exception("Expected scan started") + dev[0].wait_connected(timeout=15, error="No reassociation seen") + if apdev[0]['bssid'] not in ev: + raise Exception("Unexpected reassociation target: " + ev) + ev = dev[0].wait_event(["CTRL-EVENT-SCAN-STARTED"], timeout=0.1) + if ev is not None: + raise Exception("Unexpected scan started") + finally: clear_regdom_state(dev, hapd, hapd2) From patchwork Mon Apr 29 11:51:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Berg X-Patchwork-Id: 1929012 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=XBQ8aDFo; 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=my0CfhxD; 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 4VSk3B0KwLz23jG for ; Mon, 29 Apr 2024 23:00:51 +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=CjtIty8C1gliRu0/2BEDpZeC2WaKbTJXCl512HelV0Y=; b=XBQ8aDFoYi30Mp wusQXiuut/cYISJnShMSy193kc1/dSdJRB+ci+ZmB9NB6qbZ+g1nXviUAMfSZMSyEAjowiT6SI6la aaxFunjXNTpUL5aK5KYC5o4mFFai+/FahKCDvjy/OBhMEO/pcKTzQwzFVC8eL4NrRZZBlSCDtgMCR b+ohVCZBPHswXndzResxYnw+OrMpzGNAOx5dTYd8V5fv0DTlt8FTHYdowqzGLZJ1bP5LVMD3ljcKn foaOZhIXssX+A2Hr3kIZDtvwgBD+71sh0vQz1NXLntBEZZYnx1ekp6YV6/uRW/OkD+4Kp0Z5WmCuZ 93hpSP9g0V4zcKndH3hg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1QcH-00000002oqM-2FkP; Mon, 29 Apr 2024 13:00:21 +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 1s1PYU-00000002XEm-3eo4 for hostap@lists.infradead.org; Mon, 29 Apr 2024 11:52:24 +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=LG8S0HgpZMq9IyEMh2cvNdbWPKBmM/oRea55m8tCVWE=; t=1714391542; x=1715601142; b=my0CfhxDOD3jA/ZQ8UkdkFC8iiqXYDDFYRXcyR1w8llKkvQ kAJN6uJuzVCUvP++7j8lVrJ1iM0uWpiawh1Nmk38xDkloEUN/JnLP+KbNo8gOsGnZ+ZAtk5rGVHYh U3oBu8q8IP5mlAaVVPhcKnvVmdwvtBkpn2L185dl6thCoyNd1onpMc74AyZCBOX6Mlz5QEoThVyL5 lyKSrhRS2UiOAFU8sRRi2UjMvm6UdmurgitLynIkIOSUsg3v47q7KCNkJqGb+OjPBhli+6Wa0kbvm 7EwDk1Ocg5RupGsPs7mH2jTg5AqHZ/HDMEkFGjQ9ycAKj4vXqFQvPyKfz4Zoqu9A==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1s1PYT-0000000CNIg-0RBO; Mon, 29 Apr 2024 13:52:21 +0200 From: benjamin@sipsolutions.net To: hostap@lists.infradead.org Cc: Benjamin Berg Subject: [PATCH 16/16] WNM: Scan for BSSID if there are forbidden neighbors Date: Mon, 29 Apr 2024 13:51:57 +0200 Message-ID: <20240429115157.211073-17-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_045223_146486_A167E0FD X-CRM114-Status: GOOD ( 12.24 ) 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 The test to scan for a single BSSID assumed that there is only a single neighbor in the candidate list. Also do this optimization if there are multiple neighbors but only one of them is valid. 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 The test to scan for a single BSSID assumed that there is only a single neighbor in the candidate list. Also do this optimization if there are multiple neighbors but only one of them is valid. Signed-off-by: Benjamin Berg --- wpa_supplicant/wnm_sta.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c index b365fc4d3..f6443682b 100644 --- a/wpa_supplicant/wnm_sta.c +++ b/wpa_supplicant/wnm_sta.c @@ -1262,8 +1262,11 @@ static void wnm_set_scan_freqs(struct wpa_supplicant *wpa_s) } static int wnm_parse_candidate_list(struct wpa_supplicant *wpa_s, - const u8 *pos, const u8 *end) + const u8 *pos, const u8 *end, + int *num_valid_candidates) { + *num_valid_candidates = 0; + while (end - pos >= 2 && wpa_s->wnm_num_neighbor_report < WNM_MAX_NEIGHBOR_REPORT) { @@ -1295,6 +1298,9 @@ static int wnm_parse_candidate_list(struct wpa_supplicant *wpa_s, ether_addr_equal(rep->bssid, wpa_s->bssid)) rep->disassoc_imminent = 1; + if (rep->preference_present && rep->preference) + *num_valid_candidates += 1; + wpa_s->wnm_num_neighbor_report++; #ifdef CONFIG_MBO if (wpa_s->wnm_mbo_trans_reason_present && @@ -1323,6 +1329,7 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s, const u8 *vendor; #endif /* CONFIG_MBO */ bool disassoc_imminent; + int num_valid_candidates; if (wpa_s->disable_mbo_oce || wpa_s->conf->disable_btm) return; @@ -1455,7 +1462,8 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s, wpas_mbo_ie_trans_req(wpa_s, vendor + 2, vendor[1]); #endif /* CONFIG_MBO */ - if (wnm_parse_candidate_list(wpa_s, pos, end) < 0) + if (wnm_parse_candidate_list(wpa_s, pos, end, + &num_valid_candidates) < 0) goto reset; if (wpa_s->wnm_mode & WNM_BSS_TM_REQ_PREF_CAND_LIST_INCLUDED && @@ -1536,7 +1544,8 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s, } wnm_set_scan_freqs(wpa_s); - if (wpa_s->wnm_num_neighbor_report == 1) { + if (num_valid_candidates == 1) { + /* Any invalid candidate was sorted to the end */ os_memcpy(wpa_s->next_scan_bssid, wpa_s->wnm_neighbor_report_elements[0].bssid, ETH_ALEN);