From patchwork Fri Aug 4 05:07:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13341255 X-Patchwork-Delegate: bpf@iogearbox.net Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 36E03538D; Fri, 4 Aug 2023 05:07:50 +0000 (UTC) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2087.outbound.protection.outlook.com [40.107.6.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B8C42D5F; Thu, 3 Aug 2023 22:07:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B3gd2y1usb3YXK7gICPMAlQ7DTsi00yexxbTyNKTKSxH0sqTv6bhsJfUrJe1qo78RIRaKU5cnVkpJkemDwiWqMND3FLK49n12P3/nr+8y9XEQQjf2RrdsNbZiWRkazyJBaopSorhrxevNb0KJmRy1w2va6slRo04WS/wa25LezwIGuRO0EVMphcKE4hbsMTME3nkBOgExvGQ+AGXNwD8caNgoLizkRlMh82t+TlNqPiisjR028cyFTjLiR+deT8oPaw4C2yhyKlNfRMm1F+Z6OyL1FK2Qo5g4DT18q/IW19uPWI1PKMSxBvPh3SZydnGacsx8TeA1ilPuEL5V8+J5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vHTWD5WwibfCNfatfe/o1L4JL9TuE7410T4Cf3XxDWM=; b=VlIYxWbDawp7wVlfzFNkOnb6FbZVo4RI36w0sqqA7ivS8VQh7P7GFmka3qCQCJjfIngDZPgUcOYSULXKrbr2iKeAt6uIl5Vv652swz15CnqKdaWdtzJn5H3kqix2ic9DJq4Nlz29kafBmYewMoPtAEZa0dleDFjAfZNpmPROm6g1nO3iMUBK15OvDNvz+OodpdfzOOgvYFbHvfygv8URCURYjbMq+jgdwXGiWVU2L3GHFnNuTqMbalNs87A2hcUdfYg4LdHGefDlBCA2Xbe6wDmVodDBLPYejh6OCRjV7yO1Y/EvH+05dWOE9cXBh35HfNIYDMYqIJmESF7pzG13FA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vHTWD5WwibfCNfatfe/o1L4JL9TuE7410T4Cf3XxDWM=; b=4BPVTGACN+f7H+gcmaL8EY71sVKIy8Qj7HJQDJ9jsz1qAG1gjPjDaAuV6RR6GirNxxubXTvNE5yyOGdVHsGjOs4I+IsMtN0KFuoppIoaYMpxqsz7eigv6lG+JnaLUCG5qiQku+o0CUNJEaDtvW+iPKiEstD+gDp6l3fZGGuydc194LMLW7y6OeoJ6Q+rQ91eD6cThbeMcYGTzbkKChUa2ZJT7RAGpakyXKPxsZZnq/rDOYcwprVelVcaSQbT09+qbdfic1xIemqT/tCeSZ86ujETJRglLHP6w5XIhTvRbqExkmqjaxWWbx9ZXjyEM+cBa6K5hOYS9KrPFGIZWivnhA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by DUZPR04MB10061.eurprd04.prod.outlook.com (2603:10a6:10:4df::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.47; Fri, 4 Aug 2023 05:07:46 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::2867:7a72:20ac:5f71]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::2867:7a72:20ac:5f71%3]) with mapi id 15.20.6652.020; Fri, 4 Aug 2023 05:07:46 +0000 From: Geliang Tang To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Florent Revest , Brendan Jackman , Matthieu Baerts , Mat Martineau , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Stephen Smalley , Eric Paris , Mykola Lysenko , Shuah Khan , Simon Horman Cc: Geliang Tang , bpf@vger.kernel.org, netdev@vger.kernel.org, mptcp@lists.linux.dev, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org, selinux@vger.kernel.org, linux-kselftest@vger.kernel.org, Yonghong Song Subject: [PATCH bpf-next v11 2/5] selftests/bpf: Use random netns name for mptcp Date: Fri, 4 Aug 2023 13:07:40 +0800 Message-Id: <15d7646940fcbb8477b1be1aa11a5d5485d10b48.1691125344.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0053.apcprd02.prod.outlook.com (2603:1096:4:1f5::8) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|DUZPR04MB10061:EE_ X-MS-Office365-Filtering-Correlation-Id: 6457fef6-5076-43df-2ca3-08db94a8bd85 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pSbN7Bb/c2CcQBz9mNCGpAzVJOwL/jv8Obp3ue+/xqSaTazURwomoMmYBoMj5XryW/fqyvpqoVzG7cxDJXysr4JScyyXIeLKSYhOWCZMSas5QmSXq7LLOJC6taUCG4oy57+Ewts5HQOmhl1FO/h5v5OoPQkCo9bM8kl3tfqQRkeS2IHdyh4w6+KrO1q0s9OtuULWHC87BiCTS7XK40dqxcNy4D9jpklHzOAf8Zn50rm5HiV4i0j71JLtq8dJz3CrQCiSVChn3HEYdB6QEDBnKc6yZZNm1NCTEGd0YHrsmoUcDd/2MPlHS5SpIaJJzERITGsJGw9Y7cLQ/4CU2Yi3SphGllnUlFteE9alxx44UKH1NK+mJHddM8h1Ji5UWG5Xm4M2KSXbINX8IobQS9WCqjdRubdcf7l8UlsLnDG/lttqqFn3CknpyvfhUpZFB3OWXICFpVu2rBqWcmpzGnqgUWeZzBC3K+b8QCaysgA8sgQLUb7yFEFYgE70lKOZnHfTlld7ivajkGCS5aRmChr7BrkLWKRz/3RfhH9BvdvpQnpBpjwYmB7LkDg/lIJLGyV8U8UJ02HLT86p8opT/k4eBqf0AXATF35GCMSZ7rxtVdoWmjtu5ObfXlM9ReyTSRjPgTsmWtqyR39FOolWfjeH4vB1lVMhMHASjemVUB2mDvc= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(136003)(366004)(39860400002)(346002)(376002)(1800799003)(186006)(451199021)(86362001)(36756003)(54906003)(478600001)(110136005)(38100700002)(921005)(2616005)(83380400001)(6506007)(26005)(6666004)(6486002)(41300700001)(8936002)(8676002)(6512007)(4326008)(66476007)(7406005)(66556008)(44832011)(316002)(7416002)(5660300002)(66946007)(2906002)(13296009)(17423001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-Message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GJ7lrM2eUzGrwAJIlIzLlIasqx5ecOddvBbISLneWFid4U+wi1FdMN8B/PRVmIs+/0LpxXryf9rgmrOQIu+L2n6Rht8pwwRaYLssd5sPgOTI0n6Bf8eD5Fk5IvQnWNGgqNYz0TvQSMWtePs8kF586RgGE8A3UKfuCHJkigsTMmqt7ZtCFOo7EkDvKY9j/JEqQTJNEE4ImW6KNQD5QVG3NWurdSjAoRVWtLKd2e/dHmYPrLXXIfzZtxbt2EIIVL016fKdL6+5439juCCzM3COeeommYW3Hw3wAo/78r84yyKd5a+qXGXSXc8qTTaVnyMscpuUaQDdPMKYVxjezTcxIUj1ZAsDp5wGBvE48F+S7jT6EZ5jxw/qL4FHneRHkIMyaBNwC9V0XuUDV3qUKsZ8mpMklDnDsxk6m2ruqSxyA6NW0nPmGqvjaf/gF/r9m7gvrPrYMfpKYVeYKM2y8T3FML/crpl7+N+UTdDKWZSIC3BM+4BJ0e7CVtP402R1Ne8gsql9Y1QJSGK377GWd9OzIiiOGjjU/Oi3G7G1vEVPFV4PVBwViViSIQtBXr X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6457fef6-5076-43df-2ca3-08db94a8bd85 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2023 05:07:45.9074 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: HmnQABBxMK1bA+PdiJkaP/PpAp90HghE3WaOvZ1NaTROCC18dgzFWo+FQJ8vluo81Jt3ECTmW0BcVJx1lOUlBw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DUZPR04MB10061 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,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 X-Patchwork-Delegate: bpf@iogearbox.net Use rand() to generate a random netns name instead of using the fixed name "mptcp_ns" for every test. By doing that, we can re-launch the test even if there was an issue removing the previous netns or if by accident, a netns with this generic name already existed on the system. Note that using a different name each will also help adding more subtests in future commits. Acked-by: Yonghong Song Reviewed-by: Matthieu Baerts Signed-off-by: Geliang Tang --- tools/testing/selftests/bpf/prog_tests/mptcp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c index cd0c42fff7c0..4ccca3d39a8f 100644 --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c @@ -7,7 +7,7 @@ #include "network_helpers.h" #include "mptcp_sock.skel.h" -#define NS_TEST "mptcp_ns" +char NS_TEST[32]; #ifndef TCP_CA_NAME_MAX #define TCP_CA_NAME_MAX 16 @@ -147,6 +147,8 @@ static void test_base(void) if (!ASSERT_GE(cgroup_fd, 0, "test__join_cgroup")) return; + srand(time(NULL)); + snprintf(NS_TEST, sizeof(NS_TEST), "mptcp_ns_%d", rand()); SYS(fail, "ip netns add %s", NS_TEST); SYS(fail, "ip -net %s link set dev lo up", NS_TEST);