From patchwork Mon Apr 1 18:06:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ruth Mekonnen X-Patchwork-Id: 1918535 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=zboVE/TS; 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=nxjgF2tO; 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 4V7fCj0mq8z1yWv for ; Tue, 2 Apr 2024 05:09:02 +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: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:In-Reply-To:References: List-Owner; bh=zM6ocL5gvFboFRUcPrg+Z2CJtarljmYUGzR9d1ICp9I=; b=zboVE/TSkxn/3A AkFkEcUuoIABltquRj27cNVk9E7LI9i/TOnQMOdiZ7eK7vsf6XqLbrjoj8553DMJ/633SeeaAOeZQ X9+Xv8BYlTzRkl8QWTr7TidlMJT/GfKRkAYfnEKt92Y1swd8r2i0HzVFJUtq/EPP1CwtPAGm5VIFf GYk4O8t+JCbxLzoWkX1OdvExc5EcdlFWy1UgSWRExkiJUfcJr8AB8utntDEHx4i/xTjgAXITl18ut /a0sT3M3BJW0xJKO1EnpTVZqwpOH84xIDbYYB4cXzkcbqb2qTTL89LyY70e6PjE78DWJryGvmdsfj +XJX3I7JmFssNeIfB7Tw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrM4x-00000008Wne-0oPn; Mon, 01 Apr 2024 18:08:19 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrM4u-00000008WnI-2QFM for hostap@lists.infradead.org; Mon, 01 Apr 2024 18:08:18 +0000 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1e034607879so34473045ad.0 for ; Mon, 01 Apr 2024 11:08:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1711994894; x=1712599694; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=iN7yAjc/5CdfzpGN8EZirj96HmNNL+INIWBbUBRfCgA=; b=nxjgF2tOcEIuSW/Y19BzhmjRQwl8pUfCO9h0hytJ4waoWqdmS8HlBEwCSjBwOiubOJ KwDuEC4ek+KtA6qbeKkGm6FfwgaZG7PzyFerNCa3TuCaHe9chSB9Gs+qU+MxiI79XkTa 9XRvdZUfy9qAaRf2JKoYH9LJQjbvHxDJLN2E4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711994894; x=1712599694; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=iN7yAjc/5CdfzpGN8EZirj96HmNNL+INIWBbUBRfCgA=; b=NLLFRJhkrJBstZ/sg3b+vidCJvI+s4ZSeIlAh3f3rPPL3cu4xJrwbmSqlSPmxG32ey gsJ8X4aFX4gFiQG3FwWBXkCiEHTY+DoKZMi8KTmOeKL59Dpr/xsEV4Cqipit6y65VXFx X0Bgd6RWsICo3JQIPrCpyD27nu8Ww5EwIL9NK/pLzfC3PNlie7Hg5QVGPGR3tHqBfhPP 5tpzedbeJiYA6JxaIS5PCCI0dn2Z7PBbvixfn9nVkA2muEAjC/buWakQYXocKhMR+x8D Q98L/6pNiNgjrbKYmF/ciOAsqI77aTfOitsNvUwOknTQGTW1jTWcdepDRKWIZ9NZ0C2k ewhg== X-Gm-Message-State: AOJu0Yxe4ApMHke2BuHt0HmHiQ8Y0co1MSIUDUBIdpFhcZIsZ0ChDH9k g0ttbH6L+RFZPiwFpA+FR4fH/J6ASvtGoPlP6ptLMvRREVM3YwBOT2egX8WEgrpP5Eabf2bm/SM = X-Google-Smtp-Source: AGHT+IFlnwPyJ/ZKSj1kMhr7dC81qEtDTyYEIRxWobgk0XBwoXX5rLU69aIG7F4DnVj3o8LEal/mjw== X-Received: by 2002:a17:902:cf0d:b0:1e2:3cbe:adcc with SMTP id i13-20020a170902cf0d00b001e23cbeadccmr11890236plg.49.1711994894244; Mon, 01 Apr 2024 11:08:14 -0700 (PDT) Received: from localhost (155.248.125.34.bc.googleusercontent.com. [34.125.248.155]) by smtp.gmail.com with UTF8SMTPSA id x15-20020a170902ec8f00b001dc9422891esm9170982plg.30.2024.04.01.11.08.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 01 Apr 2024 11:08:13 -0700 (PDT) From: Ruth Mekonnen To: hostap@lists.infradead.org Cc: Ruth Mekonnen Subject: [PATCH] Emit AuthBSS property Date: Mon, 1 Apr 2024 18:06:58 +0000 Message-ID: <20240401180747.1635441-1-rmekonnen@chromium.org> X-Mailer: git-send-email 2.44.0.478.gd926399ef9-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240401_110816_690402_E97DB039 X-CRM114-Status: GOOD ( 18.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: This CL adds wpa_s->auth_bss and the getter AuthBSS to expose the BSS the STA is trying to connect to at the AUTHENTICATING state for SME devices and at the ASSOCIATING state for non-SME devices. When [...] Content analysis details: (-0.2 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:636 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.0 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 This CL adds wpa_s->auth_bss and the getter AuthBSS to expose the BSS the STA is trying to connect to at the AUTHENTICATING state for SME devices and at the ASSOCIATING state for non-SME devices. When the state is set to ASSOCIATED or DISCONNECTED wpa_s->auth_bss set to null and emitted. The AuthBSS property can be used by platforms to track connection attempt success rates against APs. Signed-off-by: Ruth Mekonnen --- wpa_supplicant/dbus/dbus_new.c | 8 ++++++++ wpa_supplicant/dbus/dbus_new.h | 1 + wpa_supplicant/dbus/dbus_new_handlers.c | 27 +++++++++++++++++++++++++ wpa_supplicant/dbus/dbus_new_handlers.h | 1 + wpa_supplicant/notify.c | 8 ++++++++ wpa_supplicant/notify.h | 1 + wpa_supplicant/sme.c | 2 ++ wpa_supplicant/wpa_supplicant.c | 7 +++++++ wpa_supplicant/wpa_supplicant_i.h | 1 + 9 files changed, 56 insertions(+) diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c index 8bd6a9a43..2ed62350d 100644 --- a/wpa_supplicant/dbus/dbus_new.c +++ b/wpa_supplicant/dbus/dbus_new.c @@ -2362,6 +2362,9 @@ void wpas_dbus_signal_prop_changed(struct wpa_supplicant *wpa_s, case WPAS_DBUS_PROP_STATE: prop = "State"; break; + case WPAS_DBUS_PROP_AUTH_BSS: + prop = "AuthBSS"; + break; case WPAS_DBUS_PROP_CURRENT_BSS: prop = "CurrentBSS"; break; @@ -3830,6 +3833,11 @@ static const struct wpa_dbus_property_desc wpas_dbus_interface_properties[] = { NULL, NULL }, + { "AuthBSS", WPAS_DBUS_NEW_IFACE_INTERFACE, "o", + wpas_dbus_getter_auth_bss, + NULL, + NULL + }, { "CurrentNetwork", WPAS_DBUS_NEW_IFACE_INTERFACE, "o", wpas_dbus_getter_current_network, NULL, diff --git a/wpa_supplicant/dbus/dbus_new.h b/wpa_supplicant/dbus/dbus_new.h index 952bb422a..0eaefade9 100644 --- a/wpa_supplicant/dbus/dbus_new.h +++ b/wpa_supplicant/dbus/dbus_new.h @@ -27,6 +27,7 @@ enum wpas_dbus_prop { WPAS_DBUS_PROP_SCANNING, WPAS_DBUS_PROP_STATE, WPAS_DBUS_PROP_CURRENT_BSS, + WPAS_DBUS_PROP_AUTH_BSS, WPAS_DBUS_PROP_CURRENT_NETWORK, WPAS_DBUS_PROP_CURRENT_AUTH_MODE, WPAS_DBUS_PROP_BSSS, diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c index 3897d98f4..2052ccef4 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers.c +++ b/wpa_supplicant/dbus/dbus_new_handlers.c @@ -4170,6 +4170,33 @@ dbus_bool_t wpas_dbus_getter_current_bss( &bss_obj_path, error); } +/** + * wpas_dbus_getter_auth_bss - Get auth bss object path + * @iter: Pointer to incoming dbus message iter + * @error: Location to store error on failure + * @user_data: Function specific data + * Returns: TRUE on success, FALSE on failure + * + * Getter for "AuthBSS" property. + */ +dbus_bool_t wpas_dbus_getter_auth_bss( + const struct wpa_dbus_property_desc *property_desc, + DBusMessageIter *iter, DBusError *error, void *user_data) +{ + struct wpa_supplicant *wpa_s = user_data; + char path_buf[WPAS_DBUS_OBJECT_PATH_MAX], *bss_obj_path = path_buf; + + if (wpa_s->auth_bss && wpa_s->dbus_new_path) + os_snprintf(bss_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, + "%s/" WPAS_DBUS_NEW_BSSIDS_PART "/%u", + wpa_s->dbus_new_path, wpa_s->auth_bss->id); + else + os_snprintf(bss_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, "/"); + + return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_OBJECT_PATH, + &bss_obj_path, error); +} + /** * wpas_dbus_getter_current_network - Get current network object path diff --git a/wpa_supplicant/dbus/dbus_new_handlers.h b/wpa_supplicant/dbus/dbus_new_handlers.h index acd6af7ff..642697091 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers.h +++ b/wpa_supplicant/dbus/dbus_new_handlers.h @@ -189,6 +189,7 @@ DECLARE_ACCESSOR(wpas_dbus_getter_bridge_ifname); DECLARE_ACCESSOR(wpas_dbus_setter_bridge_ifname); DECLARE_ACCESSOR(wpas_dbus_getter_config_file); DECLARE_ACCESSOR(wpas_dbus_getter_current_bss); +DECLARE_ACCESSOR(wpas_dbus_getter_auth_bss); DECLARE_ACCESSOR(wpas_dbus_getter_current_network); DECLARE_ACCESSOR(wpas_dbus_getter_current_auth_mode); DECLARE_ACCESSOR(wpas_dbus_getter_bsss); diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c index 3ea1cbfaf..f3fbc8530 100644 --- a/wpa_supplicant/notify.c +++ b/wpa_supplicant/notify.c @@ -212,6 +212,14 @@ void wpas_notify_bssid_changed(struct wpa_supplicant *wpa_s) wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_BSS); } +void wpas_notify_auth_bssid_changed(struct wpa_supplicant *wpa_s) +{ + if (wpa_s->p2p_mgmt) + return; + + wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AUTH_BSS); +} + void wpas_notify_mac_address_changed(struct wpa_supplicant *wpa_s) { diff --git a/wpa_supplicant/notify.h b/wpa_supplicant/notify.h index d560d0b9b..1faefa982 100644 --- a/wpa_supplicant/notify.h +++ b/wpa_supplicant/notify.h @@ -35,6 +35,7 @@ void wpas_notify_bss_tm_status(struct wpa_supplicant *wpa_s); void wpas_notify_network_changed(struct wpa_supplicant *wpa_s); void wpas_notify_ap_scan_changed(struct wpa_supplicant *wpa_s); void wpas_notify_bssid_changed(struct wpa_supplicant *wpa_s); +void wpas_notify_auth_bssid_changed(struct wpa_supplicant *wpa_s); void wpas_notify_mac_address_changed(struct wpa_supplicant *wpa_s); void wpas_notify_auth_changed(struct wpa_supplicant *wpa_s); void wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s, diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index a7ad5ecf4..8fb4e7b99 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -1142,6 +1142,8 @@ no_fils: eapol_sm_notify_portValid(wpa_s->eapol, false); wpa_clear_keys(wpa_s, bss->bssid); wpa_supplicant_set_state(wpa_s, WPA_AUTHENTICATING); + wpa_s->auth_bss = bss; + wpas_notify_auth_bssid_changed(wpa_s); if (old_ssid != wpa_s->current_ssid) wpas_notify_network_changed(wpa_s); diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index b9938d8dd..106f73286 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -1083,6 +1083,11 @@ void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s, if (wpa_s->wpa_state != old_state) { wpas_notify_state_changed(wpa_s, wpa_s->wpa_state, old_state); + if (wpa_s->auth_bss && (wpa_s->wpa_state == WPA_DISCONNECTED || + wpa_s->wpa_state == WPA_ASSOCIATED)) { + wpa_s->auth_bss = NULL; + wpas_notify_auth_bssid_changed(wpa_s); + } /* * Notify the P2P Device interface about a state change in one @@ -4195,6 +4200,8 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit) wpa_s->current_ssid = ssid; wpa_supplicant_set_state(wpa_s, WPA_ASSOCIATING); + wpa_s->auth_bss = bss; + wpas_notify_auth_bssid_changed(wpa_s); if (bss) { params.ssid = bss->ssid; params.ssid_len = bss->ssid_len; diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index b90d92a69..8ff6e2a07 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -725,6 +725,7 @@ struct wpa_supplicant { * before this has been cleared */ struct wpa_ssid *current_ssid; struct wpa_ssid *last_ssid; + struct wpa_bss *auth_bss; struct wpa_bss *current_bss; int ap_ies_from_associnfo; unsigned int assoc_freq;