From patchwork Thu Jul 6 04:08:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13303167 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 AB77C110E for ; Thu, 6 Jul 2023 04:09:42 +0000 (UTC) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2055.outbound.protection.outlook.com [40.107.21.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5E9A1BC0 for ; Wed, 5 Jul 2023 21:09:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QYx/X2LnS12lPuuvDz2p2iRIgv00rauLhLaQ8qvrjqaINHmGOSS8PA5CJWQsSSKLmzM3Cutxc1dV1POF2ch6FJ5wwyfDp96bScUAtKOWZMfPW/l2EpmkIfdlwFMTmsV9s7/e23zljrgXnyNpOo7aLREufC53pVrQxbY8MR+oQ9mhj6SumCxA9+LWGZP+RUchoVocQdNQQYh1aHiOevvA8GPSsdiD0PtM09gvSntKQc87OS3GrKV4ZEUwcjlyzIXBGdtHfcNwRPCvsM4IRF+chC2x+9SfXjjRHEb/YF0WCENM3nYxVFhBnXTS4UFPUj6IxVVUWfln1MivxKCSkV+qfA== 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=QvzA3KwHDvAcuP82OSZ5O3vhPHtVwan/UUbHKEI3Yeqm0qOLQ2bzJ92ekEDMuFw0t43AQMff8OmtwgSMuhmJpxLLHoBtEgUlexm5DcXbrXMFfbP+nAaUxsi8TNW5OXRdpc93MfYc1ciFg0dE8y90U/WCJ1pCG1Cf4XmIAajEkS9Yy67h01I1tKVLhsdr/6u+H77Bzs6prONeZZHNDtq2Nw3QLpz9S9whSaPiYKgRaRn9ll4TD0SR7xgAWfMSyISU+lEVs4Nmn4nB48ji8GPQSfS9WmnVoRhamdydkr0eI7HiodS91A5O7w3jeykJ8rUOVWBhVoumXUThUrLofpmX3g== 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=VIsmd9nH+8y5X7881Isj916d2FdGyfFGhKkKuhRJnGmi6Ysv04MEt+JXHh5svohXAXqfPvfdQL2BXBN+ydeub+FD66o46xq0cGpg95M9TcAntkGiW3CFfptCZeI7vorhofb5H2fciCYhG94+xgtMXtQerNHERkNjYKOrLcY2GkIC9fnjftSzDvzh6g3Gk2BfrNCH/wlAKiEwbB/9qKViFam4qGOmOvRaGQqexOATaKDNx1Yk+yU9SIxNKSFGey+HT2PnkuNco4qsRm31zz+Z+yU4cbkxaykIOXdoow832ZMrlT/Sc4ZoRdeM/R0YAOfKLBf3bnjylP4/8zLttWgpGw== 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 AM9PR04MB8828.eurprd04.prod.outlook.com (2603:10a6:20b:40b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.17; Thu, 6 Jul 2023 04:09:39 +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 04:09:39 +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 Cc: Geliang Tang , bpf@vger.kernel.org, mptcp@lists.linux.dev, Matthieu Baerts Subject: [RFC bpf-next 6/8] selftests/bpf: use random netns name for mptcp Date: Thu, 6 Jul 2023 12:08:50 +0800 Message-Id: X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SGAP274CA0022.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b6::34) 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_|AM9PR04MB8828:EE_ X-MS-Office365-Filtering-Correlation-Id: e71a5b59-fcdd-4a48-5d7f-08db7dd6d13c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wFG8gWdRYI8JS5TTN9xHIs3FsvYoMgafJzaorzToszSoaLrupNWL1CLOLP036LSQYdODnw+sT8sK95ghxakRTDxb2JbFQ9Mlf3pMFMmbMYIA0VO0h6Xin1Lo4IQ18+oxhisO8vZdYzmP5UlJdg8BBsyalNaHQHoPTupast1AEYs+mOrEDaAgPYhV0DS1SL0YKEj1cwT1x/vdqpDCPJA+rjuYGLKrD5rmH7Acy33Wwjs9SJ83edw5pymC2rd9PNjP70WXIcBNedAOL1t8UV3iVdmn1n+qIa/k1vKeo+TSU/Wm2bG4k9kcPJLIh9v+OUSoJxeFE6MKJ1O6jU/wY1LGph/K/G0QXhQmITz1MN1i2k+V7QwQlloxjWOGhMkMb8DmyHYuWQDFfS+bxtFNrtQ4g4Uz8nXZ9vlz9gFBEIYwveXvVzIbinxqAcjS2ozoQ6fKUzaV8E8FymSoKjfP84oh4/yi1zHqgLe/0LBEMEaJZD1fuKpXyLQU7DoGQU4qK2S+RteQOeIWZXjfTtEChhAkt8wh+52Ft3jNf4n8a9BXmlarFmENoqmCFtTGRZ9SyBYTE5ZJEPU/9V1bEuj5JE9g9X3bLLBW6Fvw6ogvRSqqoE2slonm+TkEiZXOpZKmjB2aaeESEVV7Ihme0U245l6OjU80VVOHpc3+u28u1ax0FaY= 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)(136003)(396003)(366004)(376002)(346002)(39860400002)(451199021)(2616005)(54906003)(38100700002)(66556008)(66946007)(66476007)(4326008)(921005)(186003)(36756003)(6486002)(6512007)(6666004)(110136005)(6506007)(26005)(478600001)(86362001)(41300700001)(8936002)(8676002)(44832011)(5660300002)(7416002)(316002)(2906002)(83380400001)(13296009)(17423001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ggDc2/nP74jXq9XLtgu4IEy9YgnxAJCo0HKhDagYwsU/teUijc9kuLvMpr5ZtB8UUyZGFxTHigu/ZG5rsejlz6SJc7n9Tg6ej4bPp7rSrAHX+yzJ/fLLK6+WL84Zvbss1T8DGSjXS5WdfAabERIgf0TE/E2XklXgwNDZcE0rdImd+QL7fMJOv8SC9CxaDqECigb+AWI86bpYagsv+cFGyXWNj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8StNNRCEYsAJgDaeJXBn/ff1A0BPKrRxUYVRvZG8ZTjEP1wOaSxuaLN4/BEumzO92PBvOOG6Fjf8W2nYm9eudpcRhUOR8PvAlxwupqDSg83l8Es7p/Ox+in31JN4F+MV/JHbtTEoLJXKMm59xBmjroGRSqrSl8h+PBjfOi1wp+7ggUnK5sFOxHc8tVW+glMJaa6ljn8u+RNuI/gCBBspys3USWCwwa1tUuMj8vBSILsnxYr24cgD/YSoiyidGfTiCM0hk4zIoXpkpQpWcsbLUjTdPKwNghczd/8amEFZEN X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: e71a5b59-fcdd-4a48-5d7f-08db7dd6d13c X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2023 04:09:39.2875 (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: VoiT8Gz2qjaShftcLI8Seom7kqaxqR/obiYC/5hiQ5Fc1r5xDbSxBPjs0ir9Za3ve1vSEpqbQ0jfcWqdYtIY4Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8828 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);