From patchwork Wed Apr 17 12:45:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1924629 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=pHdYFt3b; 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=LxZPCJiw; 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 4VKLKM3PB6z1yPv for ; Wed, 17 Apr 2024 22:47:35 +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=ZIQHRYmDri1//W8X4FoZZ1zIIkRl+lZSedibIKsUB2k=; b=pHdYFt3bGNhqoJ BdcaD4QnsPJzuY2UkZWFzpNUFB36akzLgAIUaL3v64ZJCjvjKqsyrWZkgEBmze084BTjWbkQ/597F XHkckoSNxQ9PcV/1UkzuAXzEjNcdgq3pLKaD9yAKuvRAFKl63KUmF5yhVWTx/Om+HfOQ23CA+nMzZ oHcvlRYZ9Gv23yjCmtjOBSqJrLNYlU6AQsVeVLpNG/MYsik2+n9+VMzeVQqQlHzwbIMmfC+ZgMVrU Tf43Jh4wMjnlz2W0NNerE4l1GPqgxYRqg2eoAb/hEbSgJzwQPtOij60HmvXSUmSMLr/6etnO3X4L5 i2Nf32gCfPAvRbs0cBIw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rx4gy-0000000Fyeg-3z38; Wed, 17 Apr 2024 12:47:12 +0000 Received: from mgamail.intel.com ([198.175.65.13]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rx4gu-0000000Fyde-3Vbk for hostap@lists.infradead.org; Wed, 17 Apr 2024 12:47:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713358029; x=1744894029; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=sdji3raFPTMEaD6JFdvC7JBcxblvrfh+ulHeIdXZ8TI=; b=LxZPCJiwFoNk9IbEZP5NNbRCVmPyl/533i/MQDgVhgTXUnGZd/kfNtgY mjVOV4iGMaQeUI/ji9hEYigBEes7cCjnBx5xVkyZZTVqYx2A9/GyUzknn 7WE0XmZRM/GvyTAo+enhTv6pL3gb5EhjdgY6n8TWkRpVBUpADGP1T0yRW OKie2Qk8Ex1BMdmnUF1Mf7Lo11uNC1LyVpFrJgIpuPifSB3HgJx1OYQPY sqY8YSiLyTBMZE78blkQnGFC1y4MmPyQT6WLlm6MzpThPs6Y1RqtN+z/Q 88FiPTUjSS2RpHA7wnIeSCSMi8MEvmgH2gRvBcFgMPcScbmcfLb3k0I2O g==; X-CSE-ConnectionGUID: 3H+DGOwWT82TbH5B0x0WFg== X-CSE-MsgGUID: vAsWJ3yeQduj5tJ+k6ecDg== X-IronPort-AV: E=McAfee;i="6600,9927,11046"; a="19993597" X-IronPort-AV: E=Sophos;i="6.07,209,1708416000"; d="scan'208";a="19993597" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2024 05:47:01 -0700 X-CSE-ConnectionGUID: PIa6b3snS6yeIsdlch5AAA== X-CSE-MsgGUID: X46WeZLuQTGmDX3R1ZnO6A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,209,1708416000"; d="scan'208";a="23033435" Received: from unknown (HELO WEIS0042.iil.intel.com) ([10.12.217.211]) by orviesa006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2024 05:47:00 -0700 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Benjamin Berg Subject: [PATCH] p2p: call normal SD query callback on RX/TX race Date: Wed, 17 Apr 2024 15:45:24 +0300 Message-ID: <20240417124524.2027615-1-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240417_054709_072529_6A6F2B0C X-CRM114-Status: GOOD ( 12.37 ) X-Spam-Score: -2.6 (--) 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 If the TX success response races with the RX frame then the state machine was simply move to P2P_SD_DURING_FIND to continue the operation. However, this does not take into account broadcast queries wh [...] Content analysis details: (-2.6 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [198.175.65.13 listed in list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an 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.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 From: Benjamin Berg If the TX success response races with the RX frame then the state machine was simply move to P2P_SD_DURING_FIND to continue the operation. However, this does not take into account broadcast queries where the callback handler updates the peer's sd_pending_bcast_queries. Fix this by exporting the callback and calling it directly. This is fine, as the operation is cancelled immediately afterwards, ensuring that the callback is not called a second time. Signed-off-by: Benjamin Berg --- src/p2p/p2p.c | 4 ++-- src/p2p/p2p_i.h | 3 +++ src/p2p/p2p_sd.c | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index bb1938dc31..8e0fc35dfb 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -3332,7 +3332,7 @@ skip_sd: } -static void p2p_sd_cb(struct p2p_data *p2p, int success) +void p2p_sd_query_cb(struct p2p_data *p2p, int success) { p2p_dbg(p2p, "Service Discovery Query TX callback: success=%d", success); @@ -3835,7 +3835,7 @@ void p2p_send_action_cb(struct p2p_data *p2p, unsigned int freq, const u8 *dst, p2p_go_neg_conf_cb(p2p, result); break; case P2P_PENDING_SD: - p2p_sd_cb(p2p, success); + p2p_sd_query_cb(p2p, success); break; case P2P_PENDING_PD: p2p_prov_disc_cb(p2p, success); diff --git a/src/p2p/p2p_i.h b/src/p2p/p2p_i.h index 2612be5ad3..0a487e0316 100644 --- a/src/p2p/p2p_i.h +++ b/src/p2p/p2p_i.h @@ -899,6 +899,9 @@ void p2p_pref_channel_filter(const struct p2p_channels *a, const struct weighted_pcl *freq_list, unsigned int num_channels, struct p2p_channels *res, bool go); + +void p2p_sd_query_cb(struct p2p_data *p2p, int success); + void p2p_dbg(struct p2p_data *p2p, const char *fmt, ...) PRINTF_FORMAT(2, 3); void p2p_info(struct p2p_data *p2p, const char *fmt, ...) diff --git a/src/p2p/p2p_sd.c b/src/p2p/p2p_sd.c index d6882e4a32..5537a6eaaf 100644 --- a/src/p2p/p2p_sd.c +++ b/src/p2p/p2p_sd.c @@ -502,7 +502,7 @@ void p2p_rx_gas_initial_resp(struct p2p_data *p2p, const u8 *sa, * received. */ p2p_dbg(p2p, "GAS Initial Request had not yet received TX status - process the response anyway"); - p2p_set_state(p2p, P2P_SD_DURING_FIND); + p2p_sd_query_cb(p2p, 1); } p2p->cfg->send_action_done(p2p->cfg->cb_ctx); p2p_clear_timeout(p2p);