From patchwork Thu Jul 6 23:25:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Xu X-Patchwork-Id: 116881 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp2896531vqx; Thu, 6 Jul 2023 16:28:05 -0700 (PDT) X-Google-Smtp-Source: APBJJlE8wYWHk346aj3TH+5MXiZqtnSdfnrp8SHeCr8bf6JyQVEzKINXDtZb/fuiFE6M0G03ssSR X-Received: by 2002:a05:620a:284b:b0:765:6dd3:3c5f with SMTP id h11-20020a05620a284b00b007656dd33c5fmr3006010qkp.63.1688686085415; Thu, 06 Jul 2023 16:28:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688686085; cv=none; d=google.com; s=arc-20160816; b=uMsxYhIN7Cb3e1zP20XFTaw4YkIVfeoBg60eLRe/X2m6+k5dRGf+Kv6dzu6Mk7Tr9u jT5FYK/2vmpeKzyj59k5mmHool7djtjM8HbColDv+6aChCSBkZS/JnTIZ9pNWdtuxD9R +JaIYL1qyA/iNAo+iOjkquX5rD/1fVBQsLv+aD2I40EVpPiOVYVfHQPMqRgqdZIj8RST VgS9L+a4aKhPtR9J1XY680oAf2e/r8YQgXBICwu9rqqnSKy4AAY/MrgpPtfHN3bvJdYj hPEkIzhW4ebRTOIs3JSAD5w+llPaOz/a7Jogw6c4DQUHGEz6y6phOVMd3Od/zjLTHKqZ ekzA== 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=qjS4HIzfqhYDhSFPKtyLd28knRFGxbVPMXSnr1A9VMU=; b=Q1CNGp3xLAv98wF9vaY2dNMR5VEj+6WiAPXHuriGElirmU5oesK/zIa9mIzdGOfEJn ZMXtudGJp/+snH51Xhuca2lyjGnDzO18u9lvzOai1GOT1Dr928y/5YBBNpzCmN1uZENH Fb9MuzudJR4PSrmBNV96ZDescGVEtCwWmtKH7tswuw99Jy/KYKAOgCobea/YqfPnCzhi PFZkuzD8Weow104KHedhVA8/uR5vqNu90y/RQj0KFR79uju3CJEyqPGzVIjIgL1X9WUu fjT1cEvR6CvtY9aXsVx2uXfz/AfQSnA1dzQ6S8oPqzjalRWGPAS7j8jKLpOMOiU1LFpO z0qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dxuuu.xyz header.s=fm1 header.b=Bc+H2ztT; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=BJ7nPJop; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 16-20020a631150000000b0055acfb661casi2364836pgr.894.2023.07.06.16.27.51; Thu, 06 Jul 2023 16:28:05 -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=Bc+H2ztT; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=BJ7nPJop; 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 S232077AbjGFX0d (ORCPT + 99 others); Thu, 6 Jul 2023 19:26:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231912AbjGFX0Y (ORCPT ); Thu, 6 Jul 2023 19:26:24 -0400 Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11D881BC3; Thu, 6 Jul 2023 16:26:24 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 813BD5C00BC; Thu, 6 Jul 2023 19:26:23 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Thu, 06 Jul 2023 19:26:23 -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=1688685983; x= 1688772383; bh=C5gTyD3ZK69kBeMGtv3ULDgMyW30wlIrQqdN4DdpOCA=; b=B c+H2ztTaE7ptsCMni+nenlvV7jKQHsFh4Ji0Eu/Adb/s/zyiRtqz+eHz5wt1vCvZ KCtuZq6qeNMoTnAGs5RI2nN2ikp4bhqMKLaEZ/pOyoY/mKyn8AdtGBvsRl8N+Wav rbuSlSkaEBPkC5UMEHPAAH+smg+MUwoHVk5yiM8D4pjtxMWpJcDaDt9QzXbtHs8k kX00fiuJS4iRtnwVMhZPRuu2cosWbI7MAsK46No9TWMksauqkeUbu2VCjFFMfzYh pwHxwc2hvD/zc6h869YwBAt6KYKa9UKDMjmO0Ui+/N3Sw4LnfxDL1pWEql1LmM1O 4ws3BFiFughd3puZ29PJw== 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=1688685983; x= 1688772383; bh=C5gTyD3ZK69kBeMGtv3ULDgMyW30wlIrQqdN4DdpOCA=; b=B J7nPJopT2ail/G1jh6hTswuDk5YFCdeJDozGn+LRbe3OBXAsLCmcpZDv0c3U4WMm UPNtgADIbvQVviYFK3YgbZxg+gOF+zRL3lw6QNYDKQvahvL5zQZNvRoMneYcdteE wHkhBn4dFNcV0KhaKbDX26PcxG8MrIv2N5exnqStS+5bTzwdGil88FL54WRWjvQO hoNYslh3Pch1tpf8VoJt8AjT976VcKgusK3ThJbinvyw2rXsKV3IatT6MiYpYS7J c0KzN/Bgv9PuPdYkoa3bO4tbOHE1UpCZZuWgzuIO1M2vmFMQQ/cOHppvgsxCP/qC R2UeqaZfVNd+4xiPAbcPg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrvddtgddvudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecufghrlhcuvffnffculdejtddmnecujfgurhephffvve fufffkofgjfhgggfestdekredtredttdenucfhrhhomhepffgrnhhivghlucgiuhcuoegu gihusegugihuuhhurdighiiiqeenucggtffrrghtthgvrhhnpefgfefggeejhfduieekvd euteffleeifeeuvdfhheejleejjeekgfffgefhtddtteenucevlhhushhtvghrufhiiigv pedunecurfgrrhgrmhepmhgrihhlfhhrohhmpegugihusegugihuuhhurdighiii X-ME-Proxy: Feedback-ID: i6a694271:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 6 Jul 2023 19:26:22 -0400 (EDT) From: Daniel Xu To: andrii@kernel.org, ast@kernel.org, shuah@kernel.org, daniel@iogearbox.net, fw@strlen.de Cc: mykolal@fb.com, 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, 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 v2 4/6] bpf: selftests: Support not connecting client socket Date: Thu, 6 Jul 2023 17:25:51 -0600 Message-ID: <2ca086a7122d7a5a65090b4b90da6037c6ad3ff2.1688685338.git.dxu@dxuuu.xyz> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 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,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770715700549615456?= X-GMAIL-MSGID: =?utf-8?q?1770715700549615456?= 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 */