Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp32187636rwd; Fri, 7 Jul 2023 09:53:22 -0700 (PDT) X-Google-Smtp-Source: APBJJlHleot7Q0MtKyPLFhqSkUCZNv7au/KBgUDoc+uJs86+o+ve07g6vUHUYq3RhwtV+klBjLWW X-Received: by 2002:a05:6808:23cd:b0:3a3:69e0:5c03 with SMTP id bq13-20020a05680823cd00b003a369e05c03mr6509293oib.26.1688748802622; Fri, 07 Jul 2023 09:53:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688748802; cv=none; d=google.com; s=arc-20160816; b=EEtAmouNCpV7pB7vwmuMssumY4Pn2Po8xU88LkWSaum9NYMCwVFttRsiitegkKAfd8 DLm6poGcatksIjKs1DPwn5+9lH9oYu9hgUComFnbxktci2aCtryKmYfPLq2bTX1N6f1+ ALh2eimM7RBNLBehF2qdHcpEKHCU2xti4hFONFwPz5CDSt+5pJPvRKUBy9kEhGahneN7 +lr1SNA5ML9vCOq/evTbZCufn5gHPRHuGS/RUx0z/rgNFCrtTr/c/gtpVDs6XBb+6Ri+ HlQoxdSVIzjIGtPUMgLcdUC7eu9Bz7BjA5ZW7QJS8zUKHyxmqGG4os2B8JW2CbXf5Slk 0H+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=C5gTyD3ZK69kBeMGtv3ULDgMyW30wlIrQqdN4DdpOCA=; fh=xP84MhPv2QMWGtxKCG0l2g+AwbN8g2oybIamq23n1sM=; b=Z+amt3WQ73y6W0+762eXkjpLxtIP0iw++3InnxedMQjZFUt0j2JXdXr+lPlHilACGj 88Ry4HOxNuUpEgRMcAFSn0X66H+AWW13Rd4mIDE6DWNIh3ObuzPgV4qmbZml9b3nku6Q zkROgIUSW6UDoiMRt0UhoQxFjVK1XpA8GN4VnXvJ1ouIQipoUamgZ7DdA/CShR4irGOf YJCFk5FfvLekv5cWsc+Csux92y1TtrmTS12msxO+GXiKLUueZ5uZWRTAPyqu/oTw7ESf j4aNWolKzx+tJE8yGAxcTENA3q6sn4BM+fj+oTiH56phbHra6wxVbdtw+mDcefCpAI9u i19A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dxuuu.xyz header.s=fm1 header.b=5ylpP1mi; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=HnXsQ06F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c5-20020a631c05000000b0053f6910ccc8si4091124pgc.747.2023.07.07.09.53.10; Fri, 07 Jul 2023 09:53:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@dxuuu.xyz header.s=fm1 header.b=5ylpP1mi; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=HnXsQ06F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233016AbjGGQv3 (ORCPT + 99 others); Fri, 7 Jul 2023 12:51:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232966AbjGGQvU (ORCPT ); Fri, 7 Jul 2023 12:51:20 -0400 Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEF37210C; Fri, 7 Jul 2023 09:51:17 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 917CA32001C6; Fri, 7 Jul 2023 12:51:15 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 07 Jul 2023 12:51:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dxuuu.xyz; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1688748675; x= 1688835075; bh=C5gTyD3ZK69kBeMGtv3ULDgMyW30wlIrQqdN4DdpOCA=; b=5 ylpP1mihx5lXocGkIaxYB+bGqJJHwKqe7lrUm0DM3dz0325bRPnGOlrMbrjunV+j kRxmY6oIcKVm7XJxLfpkMDJ4cw3TgLPkRzHA7K7/E+jUUqKVle/1azUQCm/JsW7n ngTwgXCnjMZfBjc/Io1G0s3v7f5fcd4MPB3vfAmc35vTDUGwK4twBynQ7+aanMSn xVG7UfE9hdJjuaTGw0Sqn8WVeslJm+YDJUyORKnh7isop8wMnR0goCL6AZGXZN6n IrAaA9eL5mGgbOeAc7dcjRH3HXrYe+e6kzysFPXz5EJJKreNwjM+d3FGu9Yk1a5h Zg0RmhbsRiouBSozbxt+A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1688748675; x= 1688835075; bh=C5gTyD3ZK69kBeMGtv3ULDgMyW30wlIrQqdN4DdpOCA=; b=H nXsQ06F1OlTkwF5knu1BATNQ2EvkjoaKmw7+FWGTZaUl1DqI2ZgN7+pDrAdYYR+u OL1FNP+KwKrFY/s2/s8e+2sfUsWV8HsVllYWRLlTf9BUNyL4jDpOXgG/9uJMZQ/2 ZGzbcVhe2CB8Tm0sbkoLQslU5BsdPMiXSxFoU/xXPkcm0rEMYlGiWRnVohFmVBeZ jXiaRkO3B4PJFf0WqmQDZimKae4HSvTKRkqPUVKCo86A+XhR3p4R+QpjNhJ0Hj7g d357PowSsyokFHbgk9gEQDIEz3PetLyQaNcmCdF9gwIQ0B68K4vfYfSeWEmbCdxj kkLZWpsa9yY4HChSAM6Zw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrvddugddutdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpefhvf evufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeffrghnihgvlhcuighuuceo ugiguhesugiguhhuuhdrgiihiieqnecuggftrfgrthhtvghrnhepgfefgfegjefhudeike dvueetffelieefuedvhfehjeeljeejkefgffeghfdttdetnecuvehluhhsthgvrhfuihii vgeptdenucfrrghrrghmpehmrghilhhfrhhomhepugiguhesugiguhhuuhdrgiihii X-ME-Proxy: Feedback-ID: i6a694271:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 7 Jul 2023 12:51:13 -0400 (EDT) From: Daniel Xu To: andrii@kernel.org, shuah@kernel.org, daniel@iogearbox.net, ast@kernel.org, fw@strlen.de Cc: martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, mykolal@fb.com, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, netfilter-devel@vger.kernel.org, dsahern@kernel.org Subject: [PATCH bpf-next v3 4/6] bpf: selftests: Support not connecting client socket Date: Fri, 7 Jul 2023 10:50:19 -0600 Message-ID: <6d4095f283a6aace70ec325ad62e1dd3fc4a5287.1688748455.git.dxu@dxuuu.xyz> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For connectionless protocols or raw sockets we do not want to actually connect() to the server. Signed-off-by: Daniel Xu --- tools/testing/selftests/bpf/network_helpers.c | 5 +++-- tools/testing/selftests/bpf/network_helpers.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/bpf/network_helpers.c b/tools/testing/selftests/bpf/network_helpers.c index a105c0cd008a..d5c78c08903b 100644 --- a/tools/testing/selftests/bpf/network_helpers.c +++ b/tools/testing/selftests/bpf/network_helpers.c @@ -301,8 +301,9 @@ int connect_to_fd_opts(int server_fd, const struct network_helper_opts *opts) strlen(opts->cc) + 1)) goto error_close; - if (connect_fd_to_addr(fd, &addr, addrlen, opts->must_fail)) - goto error_close; + if (!opts->noconnect) + if (connect_fd_to_addr(fd, &addr, addrlen, opts->must_fail)) + goto error_close; return fd; diff --git a/tools/testing/selftests/bpf/network_helpers.h b/tools/testing/selftests/bpf/network_helpers.h index 694185644da6..87894dc984dd 100644 --- a/tools/testing/selftests/bpf/network_helpers.h +++ b/tools/testing/selftests/bpf/network_helpers.h @@ -21,6 +21,7 @@ struct network_helper_opts { const char *cc; int timeout_ms; bool must_fail; + bool noconnect; }; /* ipv4 test vector */ -- 2.41.0