From patchwork Thu Jul 6 08:19:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13303338 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 1CAF51FBF for ; Thu, 6 Jul 2023 08:20:33 +0000 (UTC) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2088.outbound.protection.outlook.com [40.107.8.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31261130 for ; Thu, 6 Jul 2023 01:20:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T5Mihk6AwsAXISsdAgO41osS+lsYa9MlZHYWPvE+QWKxNgXeoePO0wFP5dcXIR0rONTXg2QpOtEZNXfwN6rbYmfexLJAmNuRdw7dqWjOMzdxX4wDC1k3iCaU6P35bKLckjKGFW1ctsZoDBLddrEIlvIyU+UCDOYWI19LZyjdex5fR4FIhLDN7x8the4ctyBlmgTt+qstRFmovfldo3LGHoy/cIyQUs+mI9wbcaZ54ch1jBSwAuVtHugLtawsEmACakB6G1OdDm/obDfRR597QwwiuLOmdEHgHEnoNgMXSu/MQGxSiLpkGObLLRXlMThFTTMo/h5OfRmSxlqSr+HsNw== 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=02iyHHjkQUGelZcQ1iDaZ+J0TmCKyxhCWbnucp6bY4w=; b=NzID4LfvkVOcdRHC6j4qWFHPHTCZOQAdpNHzRFHPitr2xLviZz9Zsd2QTfEK0pTEgOGCil3rz/L1ba5GNA3hv4lJB8l2I/MWPd0Df0QtBRBQDn8fHJpaWGMR1wm1Nc5l6Q5C1v4u3REh+gQUwamDEGkF8E3up/O0kht+waOYq5H1NZXb8egwfN2sXoEN8wLVnUspSBxADgnxDBxODsc4zV4zoHca8KGsT0tILrGuaH187ftIv0rUzY7f3FUFWvEaIzEDp7bv6TYpQxq67F0NfUgpmFZ4TtLJWMDX/3p/9vxXgIR2fCLiePWDZtXXMbEOdivpVAPd7EwaniA8dvF0kw== 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=02iyHHjkQUGelZcQ1iDaZ+J0TmCKyxhCWbnucp6bY4w=; b=RyWoVuU48TCUzkW5Sk+OqedM3wi0ovR//XF7Kn8ECC1S/Lq54BrOwEITwBHmn4fh+1eXDazYoSexTm4FukuInYOdAc9V2dI/XkpTbQzpWiNUsYklcYe0J75CIG4ihbW9rwlqQzPS/A45XO17lowVF6kcaDRrGzU0esJ7EatSaRPJr1/+sw/RybiaUSBvmw47SuUSd96NJ6aEdrWEYNDFa3EEAcJ3hOxq4UrL2HcodRpK03r994hd21EOXbz098kNNhTWxaCLNIDrw/mgGoxroi+uLRiLFbj4HHQeXRdxyrPfJX210ZroIP0PEeZVNhI49ZzterBCQjBq9uDhm87O0g== 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 DB9PR04MB10066.eurprd04.prod.outlook.com (2603:10a6:10:4c1::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.24; Thu, 6 Jul 2023 08:20:27 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::423a:a30f:5342:9d35]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::423a:a30f:5342:9d35%6]) with mapi id 15.20.6565.016; Thu, 6 Jul 2023 08:20:27 +0000 From: Geliang Tang To: Alexei Starovoitov , Daniel Borkmann , John Fastabend , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa Cc: Geliang Tang , bpf@vger.kernel.org, mptcp@lists.linux.dev, Matthieu Baerts Subject: [RFC bpf-next v3 6/8] selftests/bpf: use random netns name for mptcp Date: Thu, 6 Jul 2023 16:19:45 +0800 Message-Id: X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0021.apcprd02.prod.outlook.com (2603:1096:4:1f4::14) 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_|DB9PR04MB10066:EE_ X-MS-Office365-Filtering-Correlation-Id: 51594e7f-0d28-4cc3-dc55-08db7df9dae2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xEsGdsMrLYQmWaLlWnaPAz7YKl5KklSTE1n/fOk/klw21rlvBRF+ntCUiDqZPaFtTibnMkWzoAYW7SCEk0IzIdWXilr5k+7oX7tNS0xonGzYP05LdJL7Br9Bo1aykj8ZxNrUadFurwilYpwqYtf/LEjp4FkCLNdrDLXN6ob7xbIQD+qB1Fdxc78ej/Zi1PnYg0ocFDyotCW20+lhR7qO+VMi/CbJ0ZyYKRkCXbjiK9yeRQbZLF5EQXMYQz+hEl0dKfMUOdSIrHQiTl89VSiLJmWCAvIYKNmSvzbKoTFjmmkMsDejoQ/TU8Jndf+JpBq245x7RLcCDcBS6j7ach7zNj1rQ42YW+zPjyVmyzPfWiuVmK8USmfyMN610PyjtA91L4pHXzE3ZWshbI19AyGYkvl4CXk+RB+8UNhLCFYq/hqiNMA1k3bH+Sm3JfE4Mqm4MXfij02JbD5I6yh7NjB3JvK2aYd+8BoMgGIV09DNN8UDqrm3dWaMlEXx43cwUn09CfCe2ef/x6edA/zmh89PojextbR6H4eW7a69kyOqrk8mYzklMS9ag+rquKGnB/JXZHOgv+ChfwpC3CDolgfXI7M7r4iGc+NooDv0cL0eaWKc8sh4EvSagzzC7Rl/2hKLjxQo4xX2zwygxgt7gaMOYayDwLKuPIHSWkI4p2eCc6k= 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)(366004)(39860400002)(346002)(376002)(136003)(451199021)(2906002)(41300700001)(7416002)(44832011)(8936002)(36756003)(8676002)(2616005)(186003)(6506007)(478600001)(5660300002)(26005)(6512007)(6666004)(86362001)(6486002)(316002)(4326008)(66946007)(66556008)(38100700002)(66476007)(54906003)(83380400001)(921005)(110136005)(13296009)(17423001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VkMukqPkW+hxXcxkNp6vYxBFY0D+8IlK+YMhhWdV43RYNEEgwo8W4C+zW6/syQIqPzfJoQxvRcqzIqPcjSjHwRUtxdxKtbfeZcxiRu9ltHkM0J5Z4TSEfEPxCp+pRjSQPcYPTVJPIvPcjBT1qHlbBzM49UEXNSjiW6baalt5NIWyjvfl+RteZyNkPSx+skU5mRYF41v2Xk3LXgI3MJZAXnwQDpJ7qkvG2U/jklbHo6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NVAeMlAasV0i2sRyAGt0qAYghViu1kaF7L/Qbr77ec8LFT2SgaFMCC+R5BDydwNiSdGv5ywXH1hM/hTLDv1hZfVX3hFE3ZdqR6RaoJ9D5KIhIgW/r7n0oXoYnBj9Pz5XRPifWxoImJhlWIo0/ITwxUkgMWWLRdPquNUFxEuQX9VVOysII3vO8FGZ0lHQMWrl7ghbhAdsTPcQNnzZlb0UfQ21PsJlK9Tdk+2+wfp6kKnWkaXEmAXqZKfBymin6J+fRsy0+c+DXg6kvfzIbP4AidBYa X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 51594e7f-0d28-4cc3-dc55-08db7df9dae2 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2023 08:20:27.6973 (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: 5sTPok3AC3m9O4Arp08ock2z2o3kJjMPARGuASfi4/sDx0IvhMHXSvGcY2R4iBHwLRNEpyVHDivM/OGP2dZxfQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB10066 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no 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 X-Patchwork-State: RFC 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. Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts --- 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);