From patchwork Wed May 13 06:59:01 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 2237509 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=2mVggJqH; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=EdHj0RzX; 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 4gFks72JN2z1yJ5 for ; Wed, 13 May 2026 17:01:31 +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: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=dRuYApIUp3jXMOFr5Hu7ZaYmstTtOu8kDcMvbWnIbbM=; b=2mVggJqHFyDHvJ QVRNEl9Ch8gmMYSbviAB8P8DpeVh9kRn9lT1eDRu4j+NarI0S51GBzZjJVx/VO8/6eGY0+LEi1GCS yWNED+VoN9tL9ID2RKRoD5Ek11e7fQqcxiSfaUzjHa8P+aCUXHJzIPOGYoz/gevsybPHFmSGCjskQ IBSRbNk+3GgOfS3sGKnSEJMjdiT0hQ//ryFHvYB7ylMYyMKfVwaoXJKPl6LFVs0ppusSQ85VclC8I JwKlpeQt04KDunkZdKxM7VXGvgRuHymIo7jASNDdP9hrAks5WfWxBhB9XTcG/nwf4HkqcenLh8WNf uMVej/s8bFy0G8Hu23xQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wN3Z6-00000001UZ3-2Bu6; Wed, 13 May 2026 06:59:32 +0000 Received: from mgamail.intel.com ([198.175.65.10]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wN3Z2-00000001UWf-2Dlg for hostap@lists.infradead.org; Wed, 13 May 2026 06:59:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1778655569; x=1810191569; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=0c9YF+dYAWjJSnGMlEoHk6igcDWG42rFxSSP1S6u5eA=; b=EdHj0RzX3jHYACOeyVuyZgxu8iRl9KhRhoGpPdAvblCcvEO3N/RaH20i Y/SiaJAlKfnElznTKwsuQFr00EByBiyZ3oXstoDUsNESerfNodrPs8ca9 9hqzQQiSIZXH2bGHlmySI2rvxfZCx++C8aJZ7StDXo1Fs657SAffTfF4r vOJ9iAuba9lTyR1SIZHwLQLXoPCRh0uFqU7hm3IezjqVSRe8J5yuzLe1b B5dwcLKzLSpW7yPd5mst+KzuIHg/7wLeX9l2XEGJ0xcugSkU583Dr7SRt SkOrIxPNYPVgIVSqC2si4lCuvuBseK4iBXwBOOV6nyEEtc5KNeRf1twrL Q==; X-CSE-ConnectionGUID: utBDNIpqQm6DRzGlh3v86Q== X-CSE-MsgGUID: DZ1w7YgRSrmba8jOcS5hGw== X-IronPort-AV: E=McAfee;i="6800,10657,11784"; a="97001292" X-IronPort-AV: E=Sophos;i="6.23,232,1770624000"; d="scan'208";a="97001292" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2026 23:59:29 -0700 X-CSE-ConnectionGUID: RoMEswAnR0SWhI3ZUHIRTg== X-CSE-MsgGUID: KRBHLj+2TI2F7g6F77xPwg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,232,1770624000"; d="scan'208";a="233721882" Received: from iapp347.iil.intel.com (HELO 87c02287900a.iil.intel.com) ([10.167.28.6]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2026 23:59:26 -0700 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: maheshkkv@google.com, vamsin@qti.qualcomm.com, Ilan Peer Subject: [PATCH 1/5] NAN: Refactor NAN module cleanup functions Date: Wed, 13 May 2026 09:59:01 +0300 Message-ID: <20260513065909.12048-3-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260512_235928_619130_7B0AE92B X-CRM114-Status: GOOD ( 11.51 ) X-Spam-Score: -4.8 (----) 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: Ilan Peer - When NAN is de-initialized also flush the state. - As the NAN module maintains state even when it is not started, do not condition the flush flow with NAN being started. For example, NAN peers can b [...] Content analysis details: (-4.8 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [198.175.65.10 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_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 -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.4 DKIMWL_WL_HIGH DKIMwl.org - High trust sender -0.0 DMARC_PASS DMARC pass policy 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: Ilan Peer - When NAN is de-initialized also flush the state. - As the NAN module maintains state even when it is not started, do not condition the flush flow with NAN being started. For example, NAN peers can be added while NAN is not started etc. - As wpas_nan_stop() might not be called, i.e., only wpas_nan_deinit() is called, clear the NAN DE cluster ID in the nan_stop() callback (which is always called). Signed-off-by: Ilan Peer --- src/nan/nan.c | 13 ++++++------- wpa_supplicant/nan_supplicant.c | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/nan/nan.c b/src/nan/nan.c index e3fe12e84e..29c6eed457 100644 --- a/src/nan/nan.c +++ b/src/nan/nan.c @@ -273,7 +273,10 @@ static void nan_peer_clear_all(struct nan_data *nan) void nan_deinit(struct nan_data *nan) { wpa_printf(MSG_DEBUG, "NAN: Deinit"); - nan_peer_clear_all(nan); + + nan_stop(nan); + nan_flush(nan); + #ifdef CONFIG_PASN pasn_initiator_pmksa_cache_deinit(nan->initiator_pmksa); pasn_responder_pmksa_cache_deinit(nan->responder_pmksa); @@ -414,12 +417,6 @@ void nan_flush(struct nan_data *nan) { wpa_printf(MSG_DEBUG, "NAN: Reset internal state"); - if (!nan->nan_started) { - wpa_printf(MSG_DEBUG, "NAN: Already stopped"); - return; - } - - nan->nan_started = 0; nan_peer_clear_all(nan); wpabuf_free(nan->sched.elems); os_memset(&nan->sched, 0, sizeof(nan->sched)); @@ -457,7 +454,9 @@ void nan_stop(struct nan_data *nan) nan->bigtk_id = 0; } + /* Even though NAN is stopping, flush internal state */ nan_flush(nan); + nan->nan_started = 0; nan->cfg->stop(nan->cfg->cb_ctx); } diff --git a/wpa_supplicant/nan_supplicant.c b/wpa_supplicant/nan_supplicant.c index 5d80489411..9ffd0ff946 100644 --- a/wpa_supplicant/nan_supplicant.c +++ b/wpa_supplicant/nan_supplicant.c @@ -194,6 +194,7 @@ static void wpas_nan_stop_cb(void *ctx) } wpa_drv_nan_stop(wpa_s); + nan_de_set_cluster_id(wpa_s->nan_de, NULL); } @@ -1535,7 +1536,6 @@ int wpas_nan_stop(struct wpa_supplicant *wpa_s) return -1; nan_stop(wpa_s->nan); - nan_de_set_cluster_id(wpa_s->nan_de, NULL); return 0; } From patchwork Wed May 13 06:59:03 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 2237502 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=d7ztVZqw; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=RC+LwwiJ; 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 4gFkrp64xQz1yLV for ; Wed, 13 May 2026 17:01: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: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=dLkv7qYQVN9ykHEOQipXCyGxAsKw8/wSBkgRorV2J64=; b=d7ztVZqwiApEGg deHjnqssae7qK0SXMgcuXrtQLRDRqYnElokGT1Cll+doetI/XamhsFSGhLMw8+K71lMJoFc2i1FIg mSISJTCJ1fBMHbqVimDfvcIxj8zQBX9D02+VmvgjCxB9sdF97ekvmwTms23v+Pc8InZj58pCGhlce ijmNjtRa4zsRL/tLGsKjJdJtPr96f2CmfRQbphfZOJDdcOHLQUT9AilpuISaSBL9ARDfVwwt5RYRx ovNyEpcAZ3UieATfCWvznU5IIYuLv3XBdzrNxPYSJQJ4eDp3KSuhuoXqFxwBX1wGhKiJzOh1lG6wn rGn+rjj8uCYPv/xkrDBg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wN3Z8-00000001Uaq-3rxA; Wed, 13 May 2026 06:59:34 +0000 Received: from mgamail.intel.com ([198.175.65.10]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wN3Z5-00000001UWf-1sBS for hostap@lists.infradead.org; Wed, 13 May 2026 06:59:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1778655572; x=1810191572; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=SINljL//RG2pf40nq39Dw5x1XaeZe9qpnKTd67qdIN0=; b=RC+LwwiJjocFybSAmhqXd5YMp3W90+qP7Ct+damAopWbYioevIvTCpD9 5VBBKZVSERTIGAjw5GYRBHcQI0qKRZU8a3IaXQJJYIRA/dMYLVYIZZ383 QhZrE7V0CyCxWznrH8A0JyF6tEIJNPZZrqhV7SltgndtRqubIUPT28I5/ qwuYBqlckbRrpsLvmHY4COUUDdBHeQOBRujx2liAecP2vlcEvitt6PUOC JswP0BQ3ZdrueCtQ6XQcUCW8YsiEX4Km/uO/3ljPXMphhVD1VoL+swXzH SLEcqQ+prOrNT+tVZX5slg9RojIMF9nUOuKJ620LXBTctETjCdcSALQHl g==; X-CSE-ConnectionGUID: I5bJGjmBRW2YBEX7fdZS5A== X-CSE-MsgGUID: jcWn51BiQvykJABqztjE9w== X-IronPort-AV: E=McAfee;i="6800,10657,11784"; a="97001305" X-IronPort-AV: E=Sophos;i="6.23,232,1770624000"; d="scan'208";a="97001305" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2026 23:59:32 -0700 X-CSE-ConnectionGUID: 5RsHXwGDQsme9fHQwZRjkw== X-CSE-MsgGUID: z/sOLDQGQnyz9vRgIK48RA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,232,1770624000"; d="scan'208";a="233721912" Received: from iapp347.iil.intel.com (HELO 87c02287900a.iil.intel.com) ([10.167.28.6]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2026 23:59:29 -0700 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: maheshkkv@google.com, vamsin@qti.qualcomm.com, Ilan Peer Subject: [PATCH 2/5] wpa_supplicant: Stop NAN when interface is removed or disabled Date: Wed, 13 May 2026 09:59:03 +0300 Message-ID: <20260513065909.12048-5-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260512_235931_532368_2020CA8B X-CRM114-Status: GOOD ( 11.41 ) X-Spam-Score: -4.8 (----) 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: Ilan Peer - Stop and de-initialize NAN functionality when the associated interface is removed or disabled. - Add a control interface notification indicating that NAN functionality has stopped. Content analysis details: (-4.8 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [198.175.65.10 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_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 -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.4 DKIMWL_WL_HIGH DKIMwl.org - High trust sender -0.0 DMARC_PASS DMARC pass policy 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: Ilan Peer - Stop and de-initialize NAN functionality when the associated interface is removed or disabled. - Add a control interface notification indicating that NAN functionality has stopped. Signed-off-by: Ilan Peer --- src/common/wpa_ctrl.h | 1 + wpa_supplicant/nan_supplicant.c | 1 + wpa_supplicant/notify.c | 7 +++++++ wpa_supplicant/notify.h | 1 + wpa_supplicant/wpa_supplicant.c | 9 +++++++++ 5 files changed, 19 insertions(+) diff --git a/src/common/wpa_ctrl.h b/src/common/wpa_ctrl.h index 1472553d9c..90597aa7aa 100644 --- a/src/common/wpa_ctrl.h +++ b/src/common/wpa_ctrl.h @@ -270,6 +270,7 @@ extern "C" { * parameters: map_id= freq= */ #define NAN_CHAN_EVACUATION "NAN-CHAN-EVACUATION " +#define NAN_STOPPED "NAN-STOPPED " /* MESH events */ #define MESH_GROUP_STARTED "MESH-GROUP-STARTED " diff --git a/wpa_supplicant/nan_supplicant.c b/wpa_supplicant/nan_supplicant.c index 9ffd0ff946..bc9baa4b7f 100644 --- a/wpa_supplicant/nan_supplicant.c +++ b/wpa_supplicant/nan_supplicant.c @@ -195,6 +195,7 @@ static void wpas_nan_stop_cb(void *ctx) wpa_drv_nan_stop(wpa_s); nan_de_set_cluster_id(wpa_s->nan_de, NULL); + wpas_notify_nan_stopped(wpa_s); } diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c index 171508d12f..b816b71597 100644 --- a/wpa_supplicant/notify.c +++ b/wpa_supplicant/notify.c @@ -1531,6 +1531,13 @@ void wpas_notify_nan_chan_evacuation(struct wpa_supplicant *wpa_s, map_id, freq); } + +void wpas_notify_nan_stopped(struct wpa_supplicant *wpa_s) +{ + wpa_msg_global(wpa_s, MSG_INFO, NAN_STOPPED "ifname=%s", + wpa_s->ifname); +} + #endif /* CONFIG_NAN || CONFIG_NAN_USD */ diff --git a/wpa_supplicant/notify.h b/wpa_supplicant/notify.h index f8ce563cd7..fafa7d80e4 100644 --- a/wpa_supplicant/notify.h +++ b/wpa_supplicant/notify.h @@ -259,5 +259,6 @@ void wpas_notify_nan_pairing_status(struct wpa_supplicant *wpa_s, u16 status, const u8 *nd_pmk); void wpas_notify_nan_chan_evacuation(struct wpa_supplicant *wpa_s, u8 map_id, int freq); +void wpas_notify_nan_stopped(struct wpa_supplicant *wpa_s); #endif /* NOTIFY_H */ diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 5414eab0fb..3c50ba368a 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -1167,6 +1167,15 @@ void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s, if (state == WPA_INTERFACE_DISABLED) { /* Assure normal scan when interface is restored */ wpa_s->normal_scans = 0; + + /* + * A NAN management interface is not expected to be disabled. If + * it disabled, it means that NAN functionality is no longer + * possible so deinit (which would also stop any ongoing NAN + * operations) + */ + if (wpa_s->nan_mgmt) + wpas_nan_deinit(wpa_s); } if (state == WPA_COMPLETED) { From patchwork Wed May 13 06:59:05 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 2237505 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=EB+5algA; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=YdFKtr31; 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 4gFkrp2L7Cz1yJ5 for ; Wed, 13 May 2026 17:01:12 +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: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=nhiZslhOS9wJKxblytQzHplgIYAYkYiwpFhBgIwTywc=; b=EB+5algArfsUn0 5JWe9apPr7QJcSYI1rQSnkRRebd5XJYHe41I7b64LTP2let0MTjd0cwPxqvxkasIP6aEa1tpNDQlC Gh1LSQdBVYj5VJVoS0ClBgtB/mZKI+rGMXX8U9KAEzpMOKz3G4uZ6RgWzvuSoFz/VXECLXhpg8RwS awjwOUIthcysMpqcVdBQ6pLaYFKou7FzZmRFn74x7QfFj52VA89q8h9OuSPGx7AXYGH3M5W1IlgWf uZIJ/9r+GU1biN5K2++zYqrjyPoC/+NsY/7iFP9196mvNPGsOaIJ5feT1Is2BsH2S94I01VMbb4+H Q18IdKQ4O2fpf/TpzP3A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wN3ZB-00000001Ucj-1FIs; Wed, 13 May 2026 06:59:37 +0000 Received: from mgamail.intel.com ([198.175.65.10]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wN3Z8-00000001UZY-2Adq for hostap@lists.infradead.org; Wed, 13 May 2026 06:59:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1778655575; x=1810191575; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=OJ32asj88RoK8yb4/5HgaIK5a+dD9KHCes7pA72Wbkg=; b=YdFKtr31gOoIRh9ZiH+5eUb+LbNFj9plGi0h4m8ZvnYlmR25nO7Xzt6T fkJP/jKhagsDyTi7TIJqzebPcBvXotuQICWcIa0rv/d9JpvE4tvTB+OiP jrYaHoV59j82YT5D+LK7KPHHPy7mQLxQ6TwDZWUMOl73UG+FrAC/7RuwV noGqNBY8+6cpLAnZg9ZpZgqtrJrmc1rmUMnbMNk3IF2dFUwWjfmfp6aHt 7gUGHwObFor2GYsWbLwCpYGHVOjRxCQ/V6aM82K8YmSrRPHjEfRb/Nmlq b83iXA1zlRJm7VgKV7Mt6l1gxMG0yO9Wsm6klWJOhgVGOtM/YZw6q71ce g==; X-CSE-ConnectionGUID: abBkL0n5TMenPNO6uu4WbQ== X-CSE-MsgGUID: yRk/ws+5S4CGCJLukkS39w== X-IronPort-AV: E=McAfee;i="6800,10657,11784"; a="97001315" X-IronPort-AV: E=Sophos;i="6.23,232,1770624000"; d="scan'208";a="97001315" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2026 23:59:35 -0700 X-CSE-ConnectionGUID: Ar701G3LTOyjqBtm9tUiow== X-CSE-MsgGUID: 13aNqoa/RNKaY3J/DCNNpw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,232,1770624000"; d="scan'208";a="233721923" Received: from iapp347.iil.intel.com (HELO 87c02287900a.iil.intel.com) ([10.167.28.6]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2026 23:59:32 -0700 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: maheshkkv@google.com, vamsin@qti.qualcomm.com, Ilan Peer Subject: [PATCH 3/5] NAN: Handle removal of NAN interfaces Date: Wed, 13 May 2026 09:59:05 +0300 Message-ID: <20260513065909.12048-7-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260512_235934_598001_CAF0FFB9 X-CRM114-Status: GOOD ( 14.82 ) X-Spam-Score: -4.8 (----) 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: Ilan Peer When the driver notifies that a NAN Data interface is removed, terminate all the NDPs which are associated with the interface. If the interface was dynamically added by upper layers, remove it. Content analysis details: (-4.8 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [198.175.65.10 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_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 -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.4 DKIMWL_WL_HIGH DKIMwl.org - High trust sender -0.0 DMARC_PASS DMARC pass policy 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: Ilan Peer When the driver notifies that a NAN Data interface is removed, terminate all the NDPs which are associated with the interface. If the interface was dynamically added by upper layers, remove it. If a NAN management interface that was dynamically added is removed, remove it (NAN functionality is stopped when the interface is disabled). Signed-off-by: Ilan Peer --- src/nan/nan.c | 28 ++++++++++++++++++++++++++++ src/nan/nan.h | 2 ++ wpa_supplicant/events.c | 24 ++++++++++++++++++++++++ wpa_supplicant/nan_supplicant.c | 15 +++++++++++++++ wpa_supplicant/nan_supplicant.h | 1 + 5 files changed, 70 insertions(+) diff --git a/src/nan/nan.c b/src/nan/nan.c index 29c6eed457..cacbb2c869 100644 --- a/src/nan/nan.c +++ b/src/nan/nan.c @@ -3622,3 +3622,31 @@ int nan_peer_dump_ndps_to_buf(struct nan_data *nan, const u8 *addr, return pos - buf; } + + +/** + * nan_terminate_ndi_ndps - Terminate all NDPs with a given NDI address + * @nan: NAN module context from nan_init() + * @ndi_addr: NDI address for which all NDPs should be terminated + * + * This function terminates all NDPs that have the given NDI address as either + * initiator or responder NDI. + */ +void nan_terminate_ndi_ndps(struct nan_data *nan, const u8 *ndi_addr) +{ + struct nan_peer *peer; + + if (!nan) + return; + + dl_list_for_each(peer, &nan->peer_list, struct nan_peer, list) { + /* + * It is possible that an NDP setup in progress + * is not on the NDI that is being removed. However, + * to simplify things, stop the setup, so the other + * NDPs could be cleanly removed. + */ + nan_ndp_setup_stop(nan, peer); + nan_terminate_ndps_for_ndi(nan, peer, ndi_addr); + } +} diff --git a/src/nan/nan.h b/src/nan/nan.h index 4d5f6fc0ef..ae3c3032ab 100644 --- a/src/nan/nan.h +++ b/src/nan/nan.h @@ -876,6 +876,8 @@ bool nan_has_active_ndp(struct nan_data *nan); int nan_get_status(struct nan_data *nan, char *buf, size_t buflen); int nan_peer_dump_ndps_to_buf(struct nan_data *nan, const u8 *addr, char *buf, size_t buflen); +void nan_terminate_ndi_ndps(struct nan_data *nan, const u8 *ndi_addr); + #ifdef CONFIG_PASN int nan_pairing_add_attrs(struct nan_data *nan_data, struct wpabuf *buf); int nan_pairing_initiate_pasn_auth(struct nan_data *nan_data, const u8 *addr, diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 0684ada719..4bac52dc01 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -5344,6 +5344,30 @@ wpa_supplicant_event_interface_status(struct wpa_supplicant *wpa_s, } #endif /* CONFIG_P2P */ +#ifdef CONFIG_NAN + if (wpa_s->nan_data) { + wpa_printf(MSG_DEBUG, "%s: NAN data interface removed", + wpa_s->ifname); + + wpas_nan_data_interface_removed(wpa_s); + wpa_supplicant_remove_iface(wpa_s->global, wpa_s, 0); + break; + } + + if (wpa_s->nan_mgmt) { + wpa_printf(MSG_DEBUG, + "%s: NAN management interface removed", + wpa_s->ifname); + + /* + * Note: NAN is stopped when the interface is + * disabled + */ + wpa_supplicant_remove_iface(wpa_s->global, wpa_s, 0); + break; + } + +#endif /* CONFIG_NAN */ #ifdef CONFIG_MATCH_IFACE if (wpa_s->matched) { wpa_supplicant_remove_iface(wpa_s->global, wpa_s, 0); diff --git a/wpa_supplicant/nan_supplicant.c b/wpa_supplicant/nan_supplicant.c index bc9baa4b7f..1f0de12e1b 100644 --- a/wpa_supplicant/nan_supplicant.c +++ b/wpa_supplicant/nan_supplicant.c @@ -4916,3 +4916,18 @@ void wpas_nan_rx_naf(struct wpa_supplicant *wpa_s, nan_action_rx(wpa_s->nan, mgmt, len); } #endif /* CONFIG_NAN */ + + +void wpas_nan_data_interface_removed(struct wpa_supplicant *wpa_s) +{ + struct wpa_supplicant *nan_dev_wpas = wpas_nan_get_mgmt_iface(wpa_s); + + wpa_printf(MSG_DEBUG, + "NAN: Data interface removed (%s) terminate NDPs on " MACSTR, + wpa_s->ifname, MAC2STR(wpa_s->own_addr)); + + if (!nan_dev_wpas) + return; + + nan_terminate_ndi_ndps(nan_dev_wpas->nan, wpa_s->own_addr); +} diff --git a/wpa_supplicant/nan_supplicant.h b/wpa_supplicant/nan_supplicant.h index b8676a86c1..492ac7f58f 100644 --- a/wpa_supplicant/nan_supplicant.h +++ b/wpa_supplicant/nan_supplicant.h @@ -43,6 +43,7 @@ int wpas_nan_status(struct wpa_supplicant *wpa_s, char *reply, int wpas_nan_bootstrap_request(struct wpa_supplicant *wpa_s, char *cmd); int wpas_nan_bootstrap_reset(struct wpa_supplicant *wpa_s, char *cmd); bool wpas_nan_is_peer_paired(struct wpa_supplicant *wpa_s, const u8 *peer_addr); +void wpas_nan_data_interface_removed(struct wpa_supplicant *wpa_s); int wpas_nan_pair(struct wpa_supplicant *wpa_s, const u8 *peer_addr, u8 auth_mode, int cipher, int handle, u8 peer_instance_id, From patchwork Wed May 13 06:59:07 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 2237506 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=d80sHhN/; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=WwMOsPcG; 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 4gFkrq2Khmz1yLZ for ; Wed, 13 May 2026 17:01:12 +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: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=gKvlLyvnlha2Du+oT990jVp9JEF9icQsUOwb/tmYs1k=; b=d80sHhN/z04uJu Ik3x6v9qUJobt3f5EPxyEIwH7KnCatM2DvT/kGEyPOC22GARH++U9QrOmY8hybuBA5m+fQ2CGotm7 I4GwFpk/kstGqYGlkkyJk+ENV/4FxClUnqY8izyS3QWv23OHK16JxVUwDyGOHST5dFaiiJE3NRrXO Kro5TeggOdYN0tvyYvuPo9757djqkTYv40eSJeikn7td0fIMeZfhxNqmAxt8LbUw+bpV+7t/YpfsC u/Nrs3piEq3JRgUbpbvY/sYAaGIpfOsQzG9s3p7b3jHd2jCXnFOY0rYYgWDi0Ldz5UpwyX+xj5koq 87MbJKWkwsIceekrPKkA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wN3ZE-00000001UeG-00S1; Wed, 13 May 2026 06:59:40 +0000 Received: from mgamail.intel.com ([198.175.65.10]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wN3ZB-00000001UZY-2e2q for hostap@lists.infradead.org; Wed, 13 May 2026 06:59:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1778655578; x=1810191578; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=2yKXRpXlwHjwTMg4gonEJtifonNxfpWifnA3Xsj2nqw=; b=WwMOsPcGj9XBLUibiA8ktQBUEK/fPZJW9X8RllSVoC3ZknRKE+Dd3/S0 ruzSrotn+0rK67Xi4H2BbPPTwwutKweOpO7t3fKV5Iai1AVyLOEH89wsT v9YuEWzlCVKjNpZrqkLgE5jY0f6fZFk01u+i0SD4UIs7RFthePEdKIP/s 2HOgAQJZz3E0BkynEcT5b14ub+YiCqPk6ad4NJcYjd/8GjzriWtoJJPdQ JlWJge5du834ZrLQlqb+1MFtRG0TkZf5d8QEkByC7i5ffXJAW17kttkA9 NyrJTLYI0aeWWaN+QmCKnRSw9bz00fNyoJTGml59VMdBCAjUwE6Q9WDeg w==; X-CSE-ConnectionGUID: UK7IXgduS8OQa2fXrmdfOg== X-CSE-MsgGUID: tJfFHf6tQEmo0TZBp+dn6w== X-IronPort-AV: E=McAfee;i="6800,10657,11784"; a="97001328" X-IronPort-AV: E=Sophos;i="6.23,232,1770624000"; d="scan'208";a="97001328" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2026 23:59:38 -0700 X-CSE-ConnectionGUID: qKvG91RDTc25HdLefjen1g== X-CSE-MsgGUID: GngxCFdiS6qqgIZkFXuc4g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,232,1770624000"; d="scan'208";a="233721938" Received: from iapp347.iil.intel.com (HELO 87c02287900a.iil.intel.com) ([10.167.28.6]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2026 23:59:36 -0700 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: maheshkkv@google.com, vamsin@qti.qualcomm.com, Ilan Peer Subject: [PATCH 4/5] nl80211: Handle removal of a NAN management interface Date: Wed, 13 May 2026 09:59:07 +0300 Message-ID: <20260513065909.12048-9-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260512_235937_714260_2957E006 X-CRM114-Status: GOOD ( 11.75 ) X-Spam-Score: -4.8 (----) 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: Ilan Peer While a netdev interface removal is handled by the nl80211 driver, removal of a NAN Device interface is not. To handle NAN Device interface removal, register for receiving nl80211 configuration events, and when a NAN device interface is removed, propagate this event to the wpa_supplicant, so it could properl [...] Content analysis details: (-4.8 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [198.175.65.10 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_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 -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.4 DKIMWL_WL_HIGH DKIMwl.org - High trust sender -0.0 DMARC_PASS DMARC pass policy 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: Ilan Peer While a netdev interface removal is handled by the nl80211 driver, removal of a NAN Device interface is not. To handle NAN Device interface removal, register for receiving nl80211 configuration events, and when a NAN device interface is removed, propagate this event to the wpa_supplicant, so it could properly cleanup its state. Signed-off-by: Ilan Peer --- src/drivers/driver_nl80211.c | 10 ++++++++++ src/drivers/driver_nl80211_event.c | 26 ++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index ea89bcd8cc..2c2ea72abc 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -2199,6 +2199,16 @@ static int wpa_driver_nl80211_init_nl_global(struct nl80211_global *global) nl_cb_set(global->nl_cb, NL_CB_VALID, NL_CB_CUSTOM, process_global_event, global); + ret = nl_get_multicast_id(global, "nl80211", "config"); + if (ret >= 0) + ret = nl_socket_add_membership(global->nl_event, ret); + if (ret < 0) { + wpa_printf(MSG_ERROR, "nl80211: Could not add multicast " + "membership for config events: %d (%s)", + ret, nl_geterror(ret)); + goto err; + } + ret = nl_get_multicast_id(global, "nl80211", "scan"); if (ret >= 0) ret = nl_socket_add_membership(global->nl_event, ret); diff --git a/src/drivers/driver_nl80211_event.c b/src/drivers/driver_nl80211_event.c index a281f59536..87f90aa6ce 100644 --- a/src/drivers/driver_nl80211_event.c +++ b/src/drivers/driver_nl80211_event.c @@ -4406,6 +4406,28 @@ nl80211_nan_channel_evacuate_event(struct wpa_driver_nl80211_data *drv, wpa_supplicant_event(drv->ctx, EVENT_NAN_CHAN_EVACUATION, &data); } + +static void +nl80211_nan_del_interface_event(struct i802_bss *bss, struct nlattr **tb) +{ + union wpa_event_data event; + + os_memset(&event, 0, sizeof(event)); + + wpa_printf(MSG_DEBUG, "nl80211: NAN interface removed event for %s", + bss->ifname); + + os_strlcpy(event.interface_status.ifname, bss->ifname, + sizeof(event.interface_status.ifname)); + + event.interface_status.ievent = EVENT_INTERFACE_REMOVED; + + bss->drv->nan_started = false; + + wpa_supplicant_event(bss->ctx, EVENT_INTERFACE_STATUS, &event); +} + + #endif /* CONFIG_NAN */ @@ -4786,6 +4808,10 @@ static void do_process_drv_event(struct i802_bss *bss, int cmd, case NL80211_CMD_NAN_CHANNEL_EVAC: nl80211_nan_channel_evacuate_event(drv, tb); break; + case NL80211_CMD_DEL_INTERFACE: + if (drv->nlmode == NL80211_IFTYPE_NAN) + nl80211_nan_del_interface_event(bss, tb); + break; #endif /* CONFIG_NAN */ case NL80211_CMD_INCUMBENT_SIGNAL_DETECT: nl80211_incumbt_sig_intf_event(bss, tb); From patchwork Wed May 13 06:59:08 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 2237510 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=37lhX68p; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=lKxZmqZ0; 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 4gFks72vvDz1yLT for ; Wed, 13 May 2026 17:01:31 +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: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=U2hT2T0eN9ScHg9aQxLvvLL3BIYRBepRGUwQ81IT6JE=; b=37lhX68prhQsyd +jP77hCAVEJYNy+e/yn2T1mh9ozgnF0qg/U8C0mAn3ML2h1F342YmLDUPlrROZp5msqnyCsPjSXA6 5hDKqemDg8KIQM07AS4k+5aFzAl3eMxrSNDHzNhpZwY1WaabXowSpf7v7iohBmH2+BmjblrUofrwz y1hTMkjq8CSqIrcIAkhxxrY6+l3ogYWAQGj7hemcO4CBXaqnGc2s8XjK9WaLRRNzwUih8ZvTDeKYu /Z/NK8AVmA/Hg9cRx7dhoZ4Bi22DBoHGMBRsD8Y7420arTSyyE0KXr3G8IRGxUqSCr5FnTZJUYoD4 7qzeICq549722JWnvQ0A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wN3ZF-00000001Ueo-0XrG; Wed, 13 May 2026 06:59:41 +0000 Received: from mgamail.intel.com ([198.175.65.10]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wN3ZD-00000001UdZ-1pFX for hostap@lists.infradead.org; Wed, 13 May 2026 06:59:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1778655580; x=1810191580; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=C9h4bCKmnAIggG91Q3v3GtNjCwSGfgh+oJfRbJLuthc=; b=lKxZmqZ0ub2zrdULrNpnVzAJZeKqHQiEu/W3VTh+iiOVnJkM38MF9Tcv l5BKoAgR2kW7nvLRKm3FrR2FZPencVeGUDWb1wARN5Wv0CnJWN2ZWWgeo qhEeONvw7rQPL3benydluRN8epD8PNWqMyPE1GydIs1WroSMP2JpVhJm1 yMmaevyGbkk3CB7gQ5ftaqh1xc3wWNbLZcnL+9Mkm/c8XSirh0MgN6zQt ze//Dtd9x/ZhwDFyrBDHJio/PaUmwBv4fwj77e2R2cXggs+lTNtiKfGDt 0sWwQacQOhQaauMChUog4hSQTbRT5Nw653UPG6shrkICL1SV/j3boUUU3 Q==; X-CSE-ConnectionGUID: d9kOh0JARg+nNsLcOoLZVQ== X-CSE-MsgGUID: XtrqhLuBShy7M2VXdHQGsA== X-IronPort-AV: E=McAfee;i="6800,10657,11784"; a="97001333" X-IronPort-AV: E=Sophos;i="6.23,232,1770624000"; d="scan'208";a="97001333" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2026 23:59:39 -0700 X-CSE-ConnectionGUID: 2czMTAmnTn6tT1uyW553sg== X-CSE-MsgGUID: wCP3QkGQTwqSF/thBI8wGA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,232,1770624000"; d="scan'208";a="233721946" Received: from iapp347.iil.intel.com (HELO 87c02287900a.iil.intel.com) ([10.167.28.6]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2026 23:59:37 -0700 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: maheshkkv@google.com, vamsin@qti.qualcomm.com, Ilan Peer Subject: [PATCH 5/5] tests: Add NAN-STOPPED event tests on radio destruction Date: Wed, 13 May 2026 09:59:08 +0300 Message-ID: <20260513065909.12048-10-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260512_235939_521010_DEB149FC X-CRM114-Status: GOOD ( 10.53 ) X-Spam-Score: -4.8 (----) 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: Ilan Peer Add tests to verify that NAN-STOPPED is reported when the underlying radio is destroyed while NAN is active: - test_nan_stopped_on_iface_removal: Verifies NAN-STOPPED after radio destruction during se [...] Content analysis details: (-4.8 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [198.175.65.10 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_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 -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.4 DKIMWL_WL_HIGH DKIMwl.org - High trust sender -0.0 DMARC_PASS DMARC pass policy 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: Ilan Peer Add tests to verify that NAN-STOPPED is reported when the underlying radio is destroyed while NAN is active: - test_nan_stopped_on_iface_removal: Verifies NAN-STOPPED after radio destruction during service discovery, then recovers NAN on a new radio. - test_nan_stopped_on_iface_removal_with_ndp: Same scenario but with an active NDP (NAN Data Path) including connectivity verification. Signed-off-by: Ilan Peer --- tests/hwsim/test_nan.py | 144 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 143 insertions(+), 1 deletion(-) diff --git a/tests/hwsim/test_nan.py b/tests/hwsim/test_nan.py index 691da50032..c2905c9933 100644 --- a/tests/hwsim/test_nan.py +++ b/tests/hwsim/test_nan.py @@ -10,9 +10,10 @@ logger = logging.getLogger() from utils import * import string import hwsim_utils -from hwsim import HWSimRadio +from hwsim import HWSimRadio, HWSimController from contextlib import contextmanager, ExitStack from test_p2p_channel import set_country +import time @contextmanager def hwsim_nan_radios(count=2, n_channels=3): @@ -2125,3 +2126,144 @@ def test_nan_override_potential_availability(dev, apdev, params): # expect any changes during the test execution. if potential != old_potential: raise Exception("Potential availability did not revert to original after clearing override") + +def test_nan_stopped_on_iface_removal(dev, apdev, params): + """NAN cluster and discovery followed by radio destruction reports NAN-STOPPED""" + controller = HWSimController() + radio1 = HWSimRadio(n_channels=3, use_nan=True) + radio1_id, ifname1 = radio1.__enter__() + radio1_destroyed = False + + try: + with HWSimRadio(n_channels=3, use_nan=True) as (radio2_id, ifname2): + wpas1 = WpaSupplicant(global_iface="/tmp/wpas-wlan5") + wpas1.interface_add(ifname1) + wpas2 = WpaSupplicant(global_iface="/tmp/wpas-wlan6") + wpas2.interface_add(ifname2) + + nan_ifname = "nan0" + + logger.info("Starting NAN on publisher") + pub = NanDevice(wpas1, nan_ifname) + pub.start() + + with NanDevice(wpas2, "nan1") as sub: + logger.info("Verifying service discovery") + nan_sync_discovery(pub, sub, "test_service", + pssi="aabbccdd", sssi="ddbbccaa") + + logger.info("Destroying publisher radio") + wpas1.dump_monitor() + controller.destroy_radio(radio1_id) + radio1_destroyed = True + + logger.info("Waiting for NAN-STOPPED event on publisher") + ev = wpas1.wait_global_event(["NAN-STOPPED"], timeout=5) + if ev is None: + raise Exception("NAN-STOPPED event not received after radio destruction") + if f"ifname={nan_ifname}" not in ev: + raise Exception(f"Unexpected NAN-STOPPED event content: {ev}") + + logger.info("Removing old interface and adding new radio") + sub.wpas.dump_monitor() + wpas1.interface_remove(ifname1) + + radio1 = HWSimRadio(n_channels=3, use_nan=True) + radio1_id, ifname1_new = radio1.__enter__() + radio1_destroyed = False + wpas1.interface_add(ifname1_new) + + logger.info("Starting NAN on re-added radio") + pub = NanDevice(wpas1, nan_ifname) + pub.start() + + logger.info("Verifying service discovery on re-added radio") + nan_sync_discovery(pub, sub, "test_service2", + pssi="11223344", sssi="44332211") + finally: + if not radio1_destroyed: + radio1.__exit__(None, None, None) + +def test_nan_stopped_on_iface_removal_with_ndp(dev, apdev, params): + """NAN cluster, NDP establishment, then radio destruction reports NAN-STOPPED""" + set_country("US") + controller = HWSimController() + radio1 = HWSimRadio(n_channels=3, use_nan=True) + radio1_id, ifname1 = radio1.__enter__() + radio1_destroyed = False + + try: + with HWSimRadio(n_channels=3, use_nan=True) as (radio2_id, ifname2): + wpas1 = WpaSupplicant(global_iface="/tmp/wpas-wlan5") + wpas1.interface_add(ifname1) + wpas2 = WpaSupplicant(global_iface="/tmp/wpas-wlan6") + wpas2.interface_add(ifname2) + + nan_ifname = "nan0" + ndi_name = "ndi0" + + logger.info("Starting NAN on publisher with NDI") + pub = NanDevice(wpas1, nan_ifname, ndi_name) + pub.start() + + with NanDevice(wpas2, "nan1", "ndi1") as sub: + logger.info("Establishing NDP between publisher and subscriber") + pid, sid, paddr, saddr = _nan_discover_service( + pub, sub, "test_service", "aabbccdd", "ddbbccaa", + data_path=True) + ndp_id, init_ndi = _nan_ndp_request_and_accept( + pub, sub, pid, sid, paddr, saddr, + req_ssi="aabbcc", resp_ssi="ddeeff") + + logger.info("Verifying connectivity over NDP") + _nan_test_connectivity(pub, sub) + + logger.info("Destroying publisher radio while NDP is active") + wpas1.dump_monitor() + sub.wpas.dump_monitor() + controller.destroy_radio(radio1_id) + radio1_destroyed = True + + logger.info("Waiting for NAN-STOPPED event on publisher") + ev = wpas1.wait_global_event(["NAN-STOPPED"], timeout=5) + if ev is None: + raise Exception("NAN-STOPPED event not received after radio destruction") + if f"ifname={nan_ifname}" not in ev: + raise Exception(f"Unexpected NAN-STOPPED event content: {ev}") + + logger.info("Terminating NDP on subscriber") + sub.ndp_terminate(paddr, init_ndi, ndp_id) + ev = sub.wpas.wait_event(["NAN-NDP-DISCONNECTED"], timeout=5) + if ev is None: + raise Exception("NAN-NDP-DISCONNECTED not received on subscriber") + + logger.info("Removing old interface and adding new radio") + sub.wpas.dump_monitor() + wpas1.interface_remove(ifname1) + + radio1 = HWSimRadio(n_channels=3, use_nan=True) + radio1_id, ifname1_new = radio1.__enter__() + radio1_destroyed = False + + wpas1.interface_add(ifname1_new) + + logger.info("Starting NAN on re-added radio with NDI") + pub = NanDevice(wpas1, nan_ifname, ndi_name) + pub.start() + + logger.info("Establishing NDP on re-added radio") + pid, sid, paddr, saddr = _nan_discover_service( + pub, sub, "test_service2", "11223344", "44332211", + data_path=True) + ndp_id, init_ndi = _nan_ndp_request_and_accept( + pub, sub, pid, sid, paddr, saddr, + req_ssi="aabbcc", resp_ssi="ddeeff") + + logger.info("Verifying connectivity on re-added radio") + _nan_test_connectivity(pub, sub) + + logger.info("NDP recovery after radio destruction verified successfully") + finally: + if not radio1_destroyed: + radio1.__exit__(None, None, None) + set_country("00")