From patchwork Tue Mar 12 23:00:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arowa Suliman X-Patchwork-Id: 1911456 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=IdQPxp2G; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=BUwHr49Y; 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 4TvTx75t3Mz1yWt for ; Wed, 13 Mar 2024 10:14:19 +1100 (AEDT) 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=L0bIB2jMnkH++4m1uq+tfrB26SnwGMdAVrUebw51JqM=; b=IdQPxp2G+vVkp6 7O1ZRcXJPo+Xv3Jr+bdCq3FHT2F4pKGDGMPYNh7q4fqD1AeeX/M7eiZzBEDqVH6hTK+hSAcj2ltT7 8biBo1z+AlGBE125j6vQmcxK4q07eGOoMN6B1Wk1ntX0YyLPKTE9+ApS1Vf9Ubr1wyYFba9KtNEQg hae+oB/zhqBO9phqIxOofUW5e8V7URMr/GYlFO2JvD0BmUeFVZ4tnm73R5MkUl/2CcS96bLkbpAtc 3zJIg+KsMbBUGi/WvdRZ4DDoPf9EMFyqX8hWP5KMfbm1DJQiMUQN7BjYvmeixhlMlCTKoGk38Hmno IpGD95XvLPQ2KLrhufZQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkBJa-00000007wnG-1uDN; Tue, 12 Mar 2024 23:13:46 +0000 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkBJW-00000007wlZ-00VS for hostap@lists.infradead.org; Tue, 12 Mar 2024 23:13:43 +0000 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-5dca1efad59so400820a12.2 for ; Tue, 12 Mar 2024 16:13:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1710285218; x=1710890018; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LBO0K++a5A6gxu7SL1VsiD7YSI4AFE04Tn0+4SFyoDE=; b=BUwHr49Yh98gD1m9bQ1Bo/sIPhIFhvTeXrlZwWBdGAomyqEFUA36gkkPVI9Stcytiu YviNddpFibKycQaEPIrjQzSw5+6y6JR7EdW+OYHK1ZlNa3orU5Rvild2DWvplf6RKewj faJlNmv1nF669ckBO8A7CQDQZ6EemTm6HQNEc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710285218; x=1710890018; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LBO0K++a5A6gxu7SL1VsiD7YSI4AFE04Tn0+4SFyoDE=; b=v1eakrTvSVnWZAcVuTHMzKViBfyAxy35q9gzft4ISCQzGGl21xraJyWsInxKrEQ4dC uY9KttxfFnmNbnded0EZDliX/TPTBqVA7ClI1h7Iz4Lfe+6lI82RdlR3bcdRfJSx7umn otix6cLtivf//BFTUrpKmayqxcnDPdggtVm2I5yFu2aLvJpW4k4zuz+3mKrSbcCKTzNl 7PvxM4ktlsxRlrK4P8WFdkYcJlLQEcRhFOOmAfjZFG71z7t0E5B6+EOAil+J4Kbkc9TN eYU6MAFeypDh4WfuiPDQjvhXrmRqdke+0/6crF1X1emBZw5Y91fowj0sPgwyGrUkL8S/ bktA== X-Gm-Message-State: AOJu0Yy7JV6C62fxl9PkTy9sqGIsqZtPPNy+BY9Iy53oEIsJrqILebez hxdbMRe4cpY0UAjp5QwrBiWmzX+6ksXi5CBa2YYe3o7A47Piq7dF07cJgYjfUMUqZ8CoocEmrOw = X-Google-Smtp-Source: AGHT+IEbUSKBxl+jZwdsUK5kagV2frGtShA+2fO7vQV0p4o6modr3FBzx2vdchRytrOF0zhIrCunmA== X-Received: by 2002:a17:90b:3b46:b0:29b:cf87:b81e with SMTP id ot6-20020a17090b3b4600b0029bcf87b81emr1712872pjb.43.1710285218465; Tue, 12 Mar 2024 16:13:38 -0700 (PDT) Received: from arowa.mtv.corp.google.com ([2620:15c:9d:4:d8f9:aec2:e3b1:a1f1]) by smtp.gmail.com with ESMTPSA id a2-20020a17090abe0200b0029c2e0b7412sm116872pjs.5.2024.03.12.16.13.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 16:13:38 -0700 (PDT) From: Arowa Suliman X-Google-Original-From: Arowa Suliman To: hostap@lists.infradead.org Cc: Arowa Suliman , Arowa Suliman Subject: [PATCH v2] wpa_supplicant: dBus: Flush Sate Property Change Date: Tue, 12 Mar 2024 16:00:06 -0700 Message-ID: <20240312231328.934201-1-arowa@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240312_161342_510221_BE2CA453 X-CRM114-Status: GOOD ( 15.97 ) X-Spam-Score: -0.9 (/) 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: The "State" property in wpa_supplicant helps track important WiFi connection events (like when the security key is being updated). Currently, updates to this property aren't always sent right away. Th [...] Content analysis details: (-0.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:530 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an 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_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.0 T_SCC_BODY_TEXT_LINE No description available. -0.7 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 The "State" property in wpa_supplicant helps track important WiFi connection events (like when the security key is being updated). Currently, updates to this property aren't always sent right away. This delay can make it difficult to accurately track the different stages of the connection process. Some of the state property changes can be missed if the property changes more than once within the WPA_DBUS_SEND_PROP_CHANGED_TIMEOUT. This change ensures that any updates to the "State" property are sent immediately. This will provide a more accurate and real-time view of the WiFi connection process. The hwsim tests dbus_roam and dbus_remove_connected assume that the currentBSS and state properties are always sent together which is not accurate. The state property can be sent first without the currentBSS if the WPA_DBUS_SEND_PROP_CHANGED_TIMEOUT is reached before currentBSS has changed. Updated the hwsim tests to wait for the two properties separately. Change-Id: I92a1fa089a87cc45cf32a6c35189e6843e65f665 Signed-off-by: Arowa Suliman --- tests/hwsim/test_dbus.py | 75 +++++++++++++++++++++++----------- wpa_supplicant/dbus/dbus_new.c | 1 + 2 files changed, 52 insertions(+), 24 deletions(-) diff --git a/tests/hwsim/test_dbus.py b/tests/hwsim/test_dbus.py index 3ff911364..ba310ebed 100644 --- a/tests/hwsim/test_dbus.py +++ b/tests/hwsim/test_dbus.py @@ -1462,8 +1462,13 @@ def test_dbus_remove_connected(dev, apdev): self.state = 7 iface.Reconnect() elif self.state == 8: + if 'CurrentBSS' in properties: + self.state = 10 + self.loop.quit() self.state = 9 - self.loop.quit() + if 'CurrentBSS' in properties and self.state == 9: + self.state = 10 + self.loop.quit() def run_connect(self, *args): logger.debug("run_connect") @@ -1476,11 +1481,16 @@ def test_dbus_remove_connected(dev, apdev): return False def success(self): - if not self.network_added or \ - not self.network_removed or \ - not self.network_selected: - return False - return self.state == 9 + if not self.network_added: + logger.debug("network not added") + return False + if not self.network_selected: + logger.debug("network not Selected") + return False + if not self.network_removed: + logger.debug("network not Removed") + return False + return self.state == 10 with TestDbusConnect(bus) as t: if not t.success(): @@ -6044,6 +6054,10 @@ def test_dbus_roam(dev, apdev): def __init__(self, bus): TestDbus.__init__(self, bus) self.state = 0 + self.state_complete = False + self.current_bss = False + self.roam_complete = False + self.dst = "" def __enter__(self): gobject.timeout_add(1, self.run_connect) @@ -6055,25 +6069,38 @@ def test_dbus_roam(dev, apdev): def propertiesChanged(self, properties): logger.debug("propertiesChanged: %s" % str(properties)) - if 'State' in properties and properties['State'] == "completed": - if self.state == 0: + if self.state == 0 : + # Wait for connected and current BSS change. + if self.state_complete and self.current_bss: + # Trigger roam event. + iface.Roam(self.dst) self.state = 1 - cur = properties["CurrentBSS"] - bss_obj = bus.get_object(WPAS_DBUS_SERVICE, cur) - res = bss_obj.Get(WPAS_DBUS_BSS, 'BSSID', - dbus_interface=dbus.PROPERTIES_IFACE) - bssid_str = '' - for item in res: - if len(bssid_str) > 0: - bssid_str += ':' - bssid_str += '%02x' % item - dst = bssid if bssid_str == bssid2 else bssid2 - iface.Roam(dst) - elif self.state == 1: - if "RoamComplete" in properties and \ - properties["RoamComplete"]: - self.state = 2 - self.loop.quit() + self.state_complete = False + else: + if 'State' in properties and properties['State'] == "completed": + self.state_complete = True + if 'CurrentBSS' in properties: + cur = properties["CurrentBSS"] + bss_obj = bus.get_object(WPAS_DBUS_SERVICE, cur) + res = bss_obj.Get(WPAS_DBUS_BSS, 'BSSID', + dbus_interface=dbus.PROPERTIES_IFACE) + bssid_str = '' + for item in res: + if len(bssid_str) > 0: + bssid_str += ':' + bssid_str += '%02x' % item + self.dst = bssid if bssid_str == bssid2 else bssid2 + self.current_bss = True + elif self.state == 1: + # Wait for roam event. + if self.state_complete and self.roam_complete: + self.state = 2 + self.loop.quit() + else: + if 'State' in properties and properties['State'] == "completed": + self.state_complete = True + if 'RoamComplete' in properties and properties['RoamComplete']: + self.roam_complete = True def run_connect(self, *args): logger.debug("run_connect") diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c index 00b38edf5..8db3407e9 100644 --- a/wpa_supplicant/dbus/dbus_new.c +++ b/wpa_supplicant/dbus/dbus_new.c @@ -2327,6 +2327,7 @@ void wpas_dbus_signal_prop_changed(struct wpa_supplicant *wpa_s, break; case WPAS_DBUS_PROP_STATE: prop = "State"; + flush = TRUE; break; case WPAS_DBUS_PROP_CURRENT_BSS: prop = "CurrentBSS";