From patchwork Sat Apr 27 08:19:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chien Wong X-Patchwork-Id: 1928459 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=eSiwZhmm; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=xv97.com header.i=m@xv97.com header.a=rsa-sha256 header.s=zmail header.b=iSvN3hyt; 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 4VRMwZ1zqRz23s0 for ; Sat, 27 Apr 2024 18:20:30 +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:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bZJ7BYfzSl/88dU4ubdnd3BEPEYckOUdXKLHnf8bqt8=; b=eSiwZhmme64AzQ Q4IkrAJHCB1BMLbYY+NlLPusx0asl+xUgRozeXamdur1pdByCaauuCZEth5ZF2thxKxHodB8XKTRp roj+8diHbbx8XibPbLjFHbMDK9Gmbz2WeKXehatznHk/tPSjz4jV07DNWcAfnMLeo0/TNshQ9pOxr uPYVWz0sq4MRa1prd2Y2WYrHepzvsGPNgZUKD5S7jDnQvYkFWibLQruOnmrtLUK5DvKNHivaUvi8k jXE+WGjLSr3sRZ2+ISZpEzoVUcw5PPvGVebOq/Ju0Gx1s+su9hsb7afMChph2qRSpVVKdpGrwDmhM NHgt3O/WRYVOPq7682Ig==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0dI2-0000000F8MF-171j; Sat, 27 Apr 2024 08:20:10 +0000 Received: from sender4-op-o15.zoho.com ([136.143.188.15]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0dHv-0000000F8I9-0KMA for hostap@lists.infradead.org; Sat, 27 Apr 2024 08:20:06 +0000 ARC-Seal: i=1; a=rsa-sha256; t=1714205995; cv=none; d=zohomail.com; s=zohoarc; b=IiZTPlbhwvr50yHMk3mhaLs+/U1ycB5l+x1x4KPhrpvgfANP7BbbzuqWYKjfGJVI+GaHWuzwBX0h2oZ90/N+aDgrkM5zQ0Y1d3Bz5llRgp+LXkjhN7/yRqetSYlQq7SGBJesPJYvn1409WD758KMT52V4CLPndaHRW97ot8p6Oo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1714205995; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=g1ClwU3Rkw9COYy+HIjXrTqFCh+durcdyhfl/dvoZo4=; b=lQgoIEuUckeqQxk9LeuGuGyZDsDhCGQqtH5lp6rFKroL2DgxAwMM3nCvPRfRucFlPiuwZIi/BNnMuGGnGZoAqKXpXFZY2ah9b0h1voiEvLn2qZyDj1yMSQ7vkHOhnS1loRliYVYc2eP9LNErUpzfBTx9nN4iIDnYIokqCkfkF10= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=xv97.com; spf=pass smtp.mailfrom=m@xv97.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1714205995; s=zmail; d=xv97.com; i=m@xv97.com; h=From:From:To:To:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To:Cc; bh=g1ClwU3Rkw9COYy+HIjXrTqFCh+durcdyhfl/dvoZo4=; b=iSvN3hytl5SCXrBRfiZ0FgofqF7psZGpAEumtPXJSIWwQpOPXzutC0Kkx4BlJsZW bP5QBc49bFdsp9w1qSWn5BveX6Y2WWCtf8gQPj4mFUim+a4Ii/URkbiEDjJwtMKYil+ sOT6YUEByu50L0FOWNpyBn++jDWMlEA/MRGvgLdE= Received: by mx.zohomail.com with SMTPS id 1714205994232782.1906410018648; Sat, 27 Apr 2024 01:19:54 -0700 (PDT) From: Chien Wong To: hostap@lists.infradead.org Subject: [PATCH 4/4] NAN: Register multicast action frames if possible Date: Sat, 27 Apr 2024 16:19:46 +0800 Message-ID: <20240427081946.147826-4-m@xv97.com> In-Reply-To: <20240427081946.147826-1-m@xv97.com> References: <20240427081946.147826-1-m@xv97.com> MIME-Version: 1.0 X-ZohoMailClient: External X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240427_012003_700329_C0C96053 X-CRM114-Status: GOOD ( 12.79 ) X-Spam-Score: -0.1 (/) 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 USD passive subscriber and solicited transmission only publisher require receiving multicast NAN action frames in order to work. Currently, we are not requesting to receive multicast when register [...] Content analysis details: (-0.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [136.143.188.15 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [136.143.188.15 listed in list.dnswl.org] 0.1 URIBL_SBL_A Contains URL's A record listed in the Spamhaus SBL blocklist [URI: xv97.com/185.199.109.153] [URI: xv97.com/185.199.108.153] [URI: xv97.com/185.199.110.153] [URI: xv97.com/185.199.111.153] 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.0 ARC_SIGNED Message has a ARC signature -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 ARC_VALID Message has a valid ARC signature 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 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 USD passive subscriber and solicited transmission only publisher require receiving multicast NAN action frames in order to work. Currently, we are not requesting to receive multicast when registering NAN action frames. As a result, USD passive subscribe or solicited only publish may not work. The NL80211_ATTR_RECEIVE_MULTICAST attribute corresponds to wiphy ext feature NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS, which requires driver support and only a few drivers in the kernel tree support it. Namely ath9k, ath9k_htc, ath10k and hwsim. We should fall back to register non multicast action frames if the driver has no support. It was confirmed that ath9k_htc starts to work after the patch. Note that even without requesting to receive multicast action frames, some drivers would still upload them. For example, rtl8192cu and hwsim. This is why test cases like test_nan_usd_match would not fail. Tested-on: TP-LINK TL-WN821N v3(AR7010+AR9287, ath9k_htc) Signed-off-by: Chien Wong --- src/drivers/driver_nl80211.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 149f51a74..5be0268c6 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -2476,12 +2476,20 @@ static void nl80211_mgmt_handle_register_eloop(struct i802_bss *bss) } -static int nl80211_register_action_frame(struct i802_bss *bss, - const u8 *match, size_t match_len) +static int nl80211_register_action_frame2(struct i802_bss *bss, + const u8 *match, size_t match_len, + bool multicast) { u16 type = (WLAN_FC_TYPE_MGMT << 2) | (WLAN_FC_STYPE_ACTION << 4); return nl80211_register_frame(bss, bss->nl_mgmt, - type, match, match_len, false); + type, match, match_len, multicast); +} + + +static int nl80211_register_action_frame(struct i802_bss *bss, + const u8 *match, size_t match_len) +{ + return nl80211_register_action_frame2(bss, match, match_len, false); } @@ -2557,11 +2565,14 @@ static int nl80211_mgmt_subscribe_non_ap(struct i802_bss *bss) ret = -1; #endif /* CONFIG_P2P */ #ifdef CONFIG_NAN_USD +#define NAN_PUB_ACTION ((u8 *) "\x04\x09\x50\x6f\x9a\x13") /* NAN SDF Public Action */ - if (nl80211_register_action_frame(bss, - (u8 *) "\x04\x09\x50\x6f\x9a\x13", - 6) < 0) - ret = -1; + if (nl80211_register_action_frame2(bss, NAN_PUB_ACTION, 6, true) < 0) { + /* fallback to non multicast */ + if (nl80211_register_action_frame2(bss, NAN_PUB_ACTION, 6, false) < 0) + ret = -1; + } +#undef NAN_PUB_ACTION #endif /* CONFIG_NAN_USD */ #ifdef CONFIG_DPP /* DPP Public Action */