From patchwork Mon Nov 18 16:43:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13878804 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2054.outbound.protection.outlook.com [40.107.244.54]) (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 DE2381BD9C8; Mon, 18 Nov 2024 16:02:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731945743; cv=fail; b=SirjdEQwXRGwy5CNlYEYG0dj+IcI7s4rB6W+wObZrJZSi880QTa/nLmWyK38kn1+BGv4wIpdHSe/Se0jnKF5AB36FU+enyeSSBw9hwPh1j29PCQQUv992BTaqKZIpdG8cY9G8zIwDcShM21qzy178qfrlisnoWxbWfQ+gnJ5CHw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731945743; c=relaxed/simple; bh=cVfKjVqLaxBjvU8xsYDqwvrVmkq7fEKbZK6IxdezcGo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fdY3/z4/6B6BRDDPlwBYzV+f0bLCar4tKVD2eeZNZsPgGKTaD7kccQxox+LzszeYJMK1X/eZKREwXbgwaHppbhRvhYU7MYagFfNq65icUCuutc89I6rY7AO7I/SQtmxJVmnXy0n/2JioVw79l7SKepEdllZy0G7A3u64Sff9Tq4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=UAY9d2Dc; arc=fail smtp.client-ip=40.107.244.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="UAY9d2Dc" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iuM6vRtFoHLvD/EbCKDIw4kzwZpfspfPwWszcR+ad9MNVcfzeLvW7HJVqRu+qcwT7I4+YR6ctg8/rikMZ1uyawsD0cyiMq+CKkeqZ4PG6HO31oQdlNYNxkix3JdhbVX1ZC4R9OyWWEVmTgEVfo3Dy6OVIYBnzKbqnhiyupYxesgRQHeAIlwEe5lSjsQ3Kiq57K/SbTR0/FATnMsUBj0dUHtfk8Y6l2cNQFLq7JAPpsUveYJffIOjZX3N+DarG32tgEU9wMjv8tKx4BBY4J7LIInaDjGHI4DUtsJlz2HjoZ9m2D5XRLf2szXI8qXN0l7uBK/DDurmJJ1N1EJMPCszPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=DVqdvTshHxNki3bZ3TKLjG68UTcnAHsRVq2A6Gcb6kI=; b=Sxi1rs+p4owKYwfKReeezEPskG7XkRjYmzA3ISsCyd8U7byBLejwuFpdROgkVKtcDNoXx+Q9IeoVOfOlJ9v143Xdwnb3veqMHQkjI2+yXxWzTvYxforalDjYN0B/RNnSC0RD8o0NMiOHZdMCeO+t21Pjdmy9UxLfWcg6x9LFubNioZvwyM/8fIlTz6lU1Ya8aE0G8ug4YQB9pOaWSxWs5j/foSYqJVATkB/grT3qkcluKI39oo3z/EY1z3YVlJvSRnH0m6v360e2GnDhohFhPGZyMjnsstjTa157VnwL+d9vsbiSuZmhfiiQJyLpQRwAc541kwp0QvpAYpD7wrER3Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DVqdvTshHxNki3bZ3TKLjG68UTcnAHsRVq2A6Gcb6kI=; b=UAY9d2DclhTTRl4IiKShJMLvIdKuzLk48CP23YIkrNkh3Jjx0vkfOCCXXW76VJP08kNlb0DrI/prMLCKcYMjABSkV8CYwwkUrUV+yUO3V6Wyqm6F1Z92kiAnrJpJOibEI43/2DWlqtNB/bDYnxj6M/FlRwFZiIkkZCnwZ4Se6Tdl44Z5TGXF5V4No7FfuL6ngH3eJ8sQCBsEIX0qCeLbKQhQag2dambajn4NvnRJnHhrBz12dxAohMn59b+qnjNiL2PIrSS96s8Soi6u3PSSmfiVmAg4F5aSpypg3moljUWOkAIQ4bRwhMB0T3S51kArIOJBThMgHAD7E/gSOpJ0NQ== Received: from CH2PR20CA0001.namprd20.prod.outlook.com (2603:10b6:610:58::11) by DM4PR12MB7599.namprd12.prod.outlook.com (2603:10b6:8:109::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.21; Mon, 18 Nov 2024 16:02:15 +0000 Received: from CH1PEPF0000AD76.namprd04.prod.outlook.com (2603:10b6:610:58:cafe::b9) by CH2PR20CA0001.outlook.office365.com (2603:10b6:610:58::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.23 via Frontend Transport; Mon, 18 Nov 2024 16:02:15 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CH1PEPF0000AD76.mail.protection.outlook.com (10.167.244.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.14 via Frontend Transport; Mon, 18 Nov 2024 16:02:14 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 18 Nov 2024 08:02:00 -0800 Received: from localhost.localdomain (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 18 Nov 2024 08:01:53 -0800 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , CC: Simon Horman , Ido Schimmel , "Petr Machata" , , Shuah Khan , Benjamin Poirier , Hangbin Liu , Vladimir Oltean , Subject: [RFC PATCH net-next 09/11] selftests: net: lib: Rename ip_link_master() to ip_link_set_master() Date: Mon, 18 Nov 2024 17:43:15 +0100 Message-ID: <8d336cf9b91f5faa99051c75655a1c0eacaaac72.1731941465.git.petrm@nvidia.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000AD76:EE_|DM4PR12MB7599:EE_ X-MS-Office365-Filtering-Correlation-Id: 4170f378-9598-490a-ab1d-08dd07ea5e7e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|36860700013|7416014|82310400026; X-Microsoft-Antispam-Message-Info: kdUgCBkOA9iax9jCt8lbS3C45vBXjrNSdvjwM+grIZHfEjgCTWsBMChgw5bg2KieOIFXSMsOpvzt1ZP1VJ0lc4nZ2eeTFVLCwk1fpf5rSysSZI0SvCVgO5TpTNDqiT4in6If6F7PYfnKXQy5ZjfiEWVfXybEItEL+ZwIc5RYm1v9jsEqUaVoEOh3GlRIpCVQKkQ/2ZjIy0t6MeMtW0UEFbzFPpZ8Y+3rJfFdKLVQRkCrHcojT3FI16xUDvw0G1nPiYY59xLOigXR+QefeHUn0BuJDSkW1YfbBpFBcPoYKH7MQWfVvSX81QQ3zP5AZCn3SFhWBXvOA02m0ZRvNmvlbeLgwyYm/66f85B6+erW6ZtF/i9UrPUgOTtXeMjpBp8H0RffiZx7lFT6kJJYQ4WapI3Gbs6lS1J/rNGWe7DK97OcNJFgu0dUhET5h7MSAoxbKmzlnvVhR8fpb+nPxiorAPz8bQbWR5BCAsmYmhnQfdfB4AvK6jQN/g13xL4A8k7uSLe6g78D9ZUfJQwtX3KQUF+NODBlflVTLfptvhslWLPW4hht8ojIgHV1iqyMebj0mPVPFgwbefglWT+6pYD7wlMbbg1TapQO3cKwgsZyVaqlN8j1Q8NPP8DqKFuctMFRvhnS2CHIZOL13vjGQVAHyAB66m7mUggvKzRSWiBuNWUTInZoPvAIS5cewEqNIlucm8N5oo4gcHCm/3ROqfpG4AYjbSe43Df2Ba+mzhFHXFbg+OXBdTYUa8omhPSbealbWmq2YWQdd7lu0UJf7OMHVp7+y18BQKrf1rKZDFyP+RdZffK7S5XguVddWespmebo/VIfWOHhxk5l4RWWkxUoatRdxTegTvc+gtOpbi5+LMSYc3gz9sqzhTHTfq9GhJefTHFMqYQo0wPwhf1S3DPsWGiDzX5G689/pKfzq0pGGrq5BlbgZVRUR3Wafi5eKvrM7JIbb4M6yOfQseK+66S8Wx1Ra7ft4u9338s/WEBTRTfG9GVAs8yEZ/BmwE+6MxSTcV74ihynVLmciLR5dy9JUoyybKyL5rFa+uUeu2Ssih/y/feC+8DRI/2tbKgEft7OitLFCgCbevgRy+f0eBZwE7+KWEfZYs5TxNRf6MeeLjddV41CNV7en67GBEEoYOaiHKvfG5XygyGXAhHibzyzsScrHAQNSvs8i7f0gMVA7Fpi9Zd4CIlhQUlPfn0Wmy9LaYbQ8ciL3dWX5LyQtoAR23e+rPRRg6Y4s83HXNE5dgzsScnYhZMlJ2uWj0AxTAq2OSlqmyQq/PCs/wvPCnSHXr3ZhjD/C91vZBMT4+Sdo/4LSj+QIc/Xke2adkadiKKBs+C8XuEeLfE/apeDXtPsqTGmqSKgzOR6l1EbudjmocI8W5wNS+ornffFlfsGegRpWxleR6dKMIhHvxwx6/m2uw== X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230040)(376014)(1800799024)(36860700013)(7416014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2024 16:02:14.3392 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4170f378-9598-490a-ab1d-08dd07ea5e7e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CH1PEPF0000AD76.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7599 Let's have a verb in that function name to make it clearer what's going on. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- Notes: CC: Shuah Khan CC: Benjamin Poirier CC: Hangbin Liu CC: Vladimir Oltean CC: linux-kselftest@vger.kernel.org tools/testing/selftests/net/fdb_notify.sh | 6 +++--- tools/testing/selftests/net/lib.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/net/fdb_notify.sh b/tools/testing/selftests/net/fdb_notify.sh index c03151e7791c..c159230c9b62 100755 --- a/tools/testing/selftests/net/fdb_notify.sh +++ b/tools/testing/selftests/net/fdb_notify.sh @@ -49,7 +49,7 @@ test_dup_vxlan_self() { ip_link_add br up type bridge vlan_filtering 1 ip_link_add vx up type vxlan id 2000 dstport 4789 - ip_link_master vx br + ip_link_set_master vx br do_test_dup add "vxlan" dev vx self dst 192.0.2.1 do_test_dup del "vxlan" dev vx self dst 192.0.2.1 @@ -59,7 +59,7 @@ test_dup_vxlan_master() { ip_link_add br up type bridge vlan_filtering 1 ip_link_add vx up type vxlan id 2000 dstport 4789 - ip_link_master vx br + ip_link_set_master vx br do_test_dup add "vxlan master" dev vx master do_test_dup del "vxlan master" dev vx master @@ -79,7 +79,7 @@ test_dup_macvlan_master() ip_link_add br up type bridge vlan_filtering 1 ip_link_add dd up type dummy ip_link_add mv up link dd type macvlan mode passthru - ip_link_master mv br + ip_link_set_master mv br do_test_dup add "macvlan master" dev mv self do_test_dup del "macvlan master" dev mv self diff --git a/tools/testing/selftests/net/lib.sh b/tools/testing/selftests/net/lib.sh index 8994fec1c38f..5ea6537acd2b 100644 --- a/tools/testing/selftests/net/lib.sh +++ b/tools/testing/selftests/net/lib.sh @@ -451,7 +451,7 @@ ip_link_add() defer ip link del dev "$name" } -ip_link_master() +ip_link_set_master() { local member=$1; shift local master=$1; shift From patchwork Mon Nov 18 16:43:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13878805 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2059.outbound.protection.outlook.com [40.107.237.59]) (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 8DE9D1B6CFC; Mon, 18 Nov 2024 16:02:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731945762; cv=fail; b=swBCqnUoM27593FmGGUbFIddb7D+THUCgg9kqCaRcR4GCXMfe1GoOiukeQ1ks4aMZhWZbGDa7/frX5Hdp4hG0VLm+z1QukMkEbXDc4OH0Itez0IQZBLgCI44Pj6rt37hDYY8t1UiCQ3qGBj3kFUmWJvpscY9ayA6PNnXK5DW/EU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731945762; c=relaxed/simple; bh=RUmjpS00KQPThj9efFSMqJlPjLPKYyp632VyEJwERTY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=B4Y5jlVJhlQ4+77Suq/8HUZ5p2FpOLWX+kEVaSSHjdwcuww6mWMoKlSTZtREEKcRWP/Lx3QkLVTzlo1NmGPe5WXWuh3xmAfKqNbJwLNFEBFjXb2WkTsd2ZtVJx1C8Xcdrroau0XLDjTmpXhGdXUQrDcYvMbiNZyYeQBt49lxJz4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=Ei2Fk602; arc=fail smtp.client-ip=40.107.237.59 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="Ei2Fk602" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kzmwg7UIdCUDhQW27Bu3VuuxKKYku/Puq4yfY8wcCxsNqy5yI01bpw+tHrcq3IK4w4RbjIs/3d0dJsVur2FdPZntR73xP8jERX2kVR59bheV0avHdyv0jyrHsyMAOQFhOcV/uVXTNHuBOm1l7KFwZnTsItC5v7eluE9LZVsqHAyITg143g8ZwTdH81DrQ+G3kSUNs51OugckMvlm6VNzg3c6JEVfXjIpHnp6LXueQvBAsr0LllRfelAUtAZeW+ROeFSzwPGJlJfH6V8T1u6WtRpNSe/lplit3AvT2H+yqdcRmatFqI90svOLR2joLGogeMkvTWw9iJtKSCCjz6U55Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=iemher0mO6qrlOQ5kx+Fwf3R18yaGpgpyBN2/v8lXvg=; b=e0b2JiNZ6WpIM+Sv4K0RnucIMqVQ8WS5/WHQ0NOdopE8c+QtnXvVQzxsbLz39h9MJHbNqFwk+On151Qwgm2H6uVMOhJRIuC0fNJCOhc7OtksvJNMBvo0spx4YQtkbRC55NY7Qn4VwXSQEVPFEg/13CRZpasOHqOpadPnMUm8n0d+ilgmo7gEoJZEMnXkjpc/5qe/URgonPs6Iu7EEW5b1KsGQJ/xxEWfe/yeyhsivCOvEtS2mvLNKIiFXVp7sfXCBhrinwPH3zTNUPJwgpSuWMGGVWmQsDv7JDNzJDwZEV7fZmWWY8ebnCPRcoHt8yb8AKZ/+va4Om9LhRlU4cfwHA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iemher0mO6qrlOQ5kx+Fwf3R18yaGpgpyBN2/v8lXvg=; b=Ei2Fk602UZkajS+rsKUuBHMSx3xUHvCrI3+mlzJHryFadvcd8AQ5TbQ9K+U1/TYX+faavR6TaszORZRp2LHPqEsuefLDGEP/xR1Ur0CabSjfHl2HqI4NV8blPs6MtxRbYuUHfngCQELGMRzJEXa6T5u/HtqW2eEJ/RpHEthV1HgVq6ZSGeWK+6YB4zbs/N7tOwyoLiPSWVfMeGVwKFezAqoTWNeMfIU2hqvFxhdFcCE8XDihJY4WWeVq+iBFBuLZIiDfApyMMwMSUihwHhRK9+IGUL8IFYnz4ZBRFy+bQv7LjN4N+wQBdITsFwF6gXwhvUyoxizVponicuijUrUyzw== Received: from PH7P220CA0019.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:326::26) by SJ2PR12MB8876.namprd12.prod.outlook.com (2603:10b6:a03:539::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.21; Mon, 18 Nov 2024 16:02:35 +0000 Received: from CY4PEPF0000EDD4.namprd03.prod.outlook.com (2603:10b6:510:326:cafe::87) by PH7P220CA0019.outlook.office365.com (2603:10b6:510:326::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.22 via Frontend Transport; Mon, 18 Nov 2024 16:02:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CY4PEPF0000EDD4.mail.protection.outlook.com (10.167.241.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.14 via Frontend Transport; Mon, 18 Nov 2024 16:02:34 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 18 Nov 2024 08:02:07 -0800 Received: from localhost.localdomain (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 18 Nov 2024 08:02:00 -0800 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , CC: Simon Horman , Ido Schimmel , "Petr Machata" , , Shuah Khan , Benjamin Poirier , Hangbin Liu , Vladimir Oltean , Subject: [RFC PATCH net-next 10/11] selftests: net: lib: Add several autodefer helpers Date: Mon, 18 Nov 2024 17:43:16 +0100 Message-ID: X-Mailer: git-send-email 2.47.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EDD4:EE_|SJ2PR12MB8876:EE_ X-MS-Office365-Filtering-Correlation-Id: 36682764-62bc-4234-86f1-08dd07ea6a58 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|7416014|36860700013|376014; X-Microsoft-Antispam-Message-Info: LFkJQ+luQcaoCLPldT/9PhEaID9RZ1sJ8XWw4KuZR5fqajINJvQzmv6vnzsLv3AOKFdB0YxOEo3H6M8ErPzX3CXmkaja1khuQScFiZ3Zfia1AaRfdHW+dMjTMQ0MHA8+cOg0x5l/mA9E0DXG6muQoCahCWr8t+NCSvMBsrufeJaX2wOnkWJh4Bxb2rEhKzV+0tNobaVvzR1B8FufTAhlwo2eTxvVHBsy9LNXYEzMglnts9OjmWcW+6a4WzypM5oQWb/3BIRQ9i4HAQ/bj8biELWqy1P8P6ocztf/CSHxmm5eiJZyRMPHCor++y5ZtIm43IfpoUnXlMqTtVCHHwRom3f1I6nrs7jGU8T4zkqUa7nS4VfNsTk2oJNOz9xzyQvlyPezttVdwLIuUw4mR1YK8GrNrH5WDQCMZNaqBBjgS2YCqCAYHBzSp2kI8NgqZqehqIB8FpO8VkSQMPVw37ZBGk/vIdTnezCDTnjP5BAHqOXY4XoWyi64vc6VM0u9NkWH1+xTLcxvT3YOXh2Bcau7VMfL2En5bKB+TAnwmFuuMoyFw5Yq7Mr+UXevKdcDDyo6WbR/NNM3im737bv1x/MisIJaXQwf926SjrDBxU6zj7oItJF6KGTw54tFTi0M9pSF2BIdorFHfvG4NWuVBsdHR74P1kjfzDw7ex6+K5w78O3CfR0/YqCjGGP04jycdfVJw0G2mQmxb3rKWouQZdvrZvLn+sOMQuCSeATSLLRGe/JnSF2FDF1PuwPAE/j3aND5mzStpMHfbtqdDwuHStzE8FzA/PjZ+u9wgatUkjA6tpiHCx3rVVya2suPB/uHjJk4ppgQTbKVRKmkS1G1BPTufyUiN76RPNCeWdcjN7MqndG87eX/VgIkSaXtYzuuYWYOHHTw+7yONkpPLuQ5BuGAl9R9vKMQBHStosfVr0FlTDqxNuaixJ9iSRzMXvVzAUhXNrzES8+LlKrCMBpakks1KQEorsf5g7O1b/O2xfcWKHrmnBDFEzSTjAk7/e45emEadsGGcRWMa+H4D35hl7H2Q0UY0CHBUH/t9/SSr6S57pdtJVsMzomnSLUjyWIKF3CryoZycJ2+ECMt7FOjG5MSG9NvEDif3HNQ4vr6/qEKT5gPrsIiTCAjdcrK7t1TnCJ8dTzkgaZ1S9p0eVmab8csNOrs0kaxZ6od6HchYU7SPIPuxpl3Gdt65utKoA8rD95CCDpvfluhEnpo9yY9iErnRQlhYR5rRi7723iay4TW2jiySuFWv4TqFOSdzruLGWhIs/q9H0fOpjOuKR1gtvICI3JP2SaeQjnwHz9bRIjoKedwvgs0auvHecB4/yKkNFxz3HzLNkd1WitSD00+0TsycKlvD4rBpIXZ3CTji4OyEvKol/9MAcNRp2d5UiWoe/XcGkC+HQ0Ei4A+oSXKKUhEMA== X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(82310400026)(1800799024)(7416014)(36860700013)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2024 16:02:34.3157 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 36682764-62bc-4234-86f1-08dd07ea6a58 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EDD4.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8876 Add ip_link_set_addr(), ip_link_set_up(), ip_addr_add() and ip_route_add() to the suite of helpers that automatically schedule a corresponding cleanup. When setting a new MAC, one needs to remember the old address first. Move mac_get() from forwarding/ to that end. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- Notes: CC: Shuah Khan CC: Benjamin Poirier CC: Hangbin Liu CC: Vladimir Oltean CC: linux-kselftest@vger.kernel.org tools/testing/selftests/net/forwarding/lib.sh | 7 ---- tools/testing/selftests/net/lib.sh | 39 +++++++++++++++++++ 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index 7337f398f9cc..1fd40bada694 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -932,13 +932,6 @@ packets_rate() echo $(((t1 - t0) / interval)) } -mac_get() -{ - local if_name=$1 - - ip -j link show dev $if_name | jq -r '.[]["address"]' -} - ether_addr_to_u64() { local addr="$1" diff --git a/tools/testing/selftests/net/lib.sh b/tools/testing/selftests/net/lib.sh index 5ea6537acd2b..2cd5c743b2d9 100644 --- a/tools/testing/selftests/net/lib.sh +++ b/tools/testing/selftests/net/lib.sh @@ -435,6 +435,13 @@ xfail_on_veth() fi } +mac_get() +{ + local if_name=$1 + + ip -j link show dev $if_name | jq -r '.[]["address"]' +} + kill_process() { local pid=$1; shift @@ -459,3 +466,35 @@ ip_link_set_master() ip link set dev "$member" master "$master" defer ip link set dev "$member" nomaster } + +ip_link_set_addr() +{ + local name=$1; shift + local addr=$1; shift + + local old_addr=$(mac_get "$name") + ip link set dev "$name" address "$addr" + defer ip link set dev "$name" address "$old_addr" +} + +ip_link_set_up() +{ + local name=$1; shift + + ip link set dev "$name" up + defer ip link set dev "$name" down +} + +ip_addr_add() +{ + local name=$1; shift + + ip addr add dev "$name" "$@" + defer ip addr del dev "$name" "$@" +} + +ip_route_add() +{ + ip route add "$@" + defer ip route del "$@" +} From patchwork Mon Nov 18 16:43:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13878806 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2070.outbound.protection.outlook.com [40.107.236.70]) (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 88BE41B6CFC; Mon, 18 Nov 2024 16:02:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.70 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731945768; cv=fail; b=D2PaLTEHLpbe9TcLBWaa1lnnGaB2qUVIQosmgNHaeyApEoczwCpICvIPUSxdQ8rJO8ZsogQoIkrUF3ZDBPq9xUawfIC819knlwyoSE81vcdaZ9wsxcttIXXQNtuUHmlZSLwRGA0swZfXyDGhyaQX/y3+oaXYmesXUOpPgdyxuW4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731945768; c=relaxed/simple; bh=sa+vZ4cO2nKVCAsPHtSng8OI9lMw+dXg1EIFqUVLVto=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rQbQsKUwXxZry6bsO97x2nQ/Ehdb01+opkn42RyN73fGa38kkTXEtaF4BGGUONBKawxAoBQ/aw8hksPvZOujd7kZ9U/LHlAmxhJy5pOKMsq8t+FHLBv9hc3CQB5I4nECb+BsUgDqZo5p3D3wX0XkaJcVpMi5CDUgbk3vCsgeh+U= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=UmPRUkd5; arc=fail smtp.client-ip=40.107.236.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="UmPRUkd5" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wK7liPe1gBKAasHnMhCs2sTQelfMfJAvAzRtTduoSavfabo5JwHMY7/zRpro9TewZDerIrcxI73m0EqW6BhELEI9jlmil1MLiw31jSBF8JYgESkvnwd87gd3A2BpWB1C4WedMBsb/tyhGe0DJCVxwVopNy/Do2K3sO8zaUpaV4+TtkWDJ5eI7WVGoGSLXbMpNYPO2dIT3sPKGbEPpeC/XqVStSHhT9GDMwHCX5mDJN7OhUGHGyrU8je0b6buszFoB8liJwShbxYheb8nKiWOWmrSdO1lrlvJKkBEmOqKIC7juL0XoR3Rt9vHt6kWwgHNMQOGib3rCw+Rzqg8nOljDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=oZq6qzGt8ei5DmYVubXAiDaB7Wew5c75RnjQVh/liIA=; b=icIOsqZw0I5gdaGkLoVITgOggCMNV24wgCN2FftyYyl3wjjTawTYXN4G6/ywMNmJuOX8ibMrhcjbw074gIeCOBcUpE6H9Z2dg01+umiAvrxcgBIlGTsMZy257bqsi0nZzoeKyRhS+KTshIPBEq8CqylkKwrtNqfPFfO0hwM7emZwj3hyhQvL+v1+yws4PqwFAMw2NqmHZxywGyTHKjrOmvcCbb8E2YOxRnoD6sydEx2r/eC/IivkRHpEpugQQzlnuhtC1eWT44Js9MShHh9nCsoxHm5tF5TUaf+9YTS5JRSxrHVUm3MDvVm9+y/COs7bAcYUCXAPl71Z+km9qJIbBA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oZq6qzGt8ei5DmYVubXAiDaB7Wew5c75RnjQVh/liIA=; b=UmPRUkd5NP+hiMdUnIeXqwBGDJMbP/SPDWLLWqpBHrZw9+6/ahiq0Tp7o686r8qf3b1vVKEEeMBXRg9DiU4fXE8BYZEswSkf7bhGBUCHVICc/D++Lmji/z3qQmGFPbc4KCkrILPHA06johwXH7JN2CH1Y/WP3n/MIO9sPTe7BkI2c4fqs+YDXGUguFglDMO/YTM+IxpX2LRrZ846KulmOSzHb8DbpP0Fs8CHWSxY90d0hghxw5vqjdv/XJwdvMAtM9II9fQtL58GPg6NFPfr7xbRxvZeHDo8BoUPD6H6dPNepxRREQZJkLAbE/fOzuUkojdZZj/a/PPrkYSoJ8S8OA== Received: from PH3PEPF000040A0.namprd05.prod.outlook.com (2603:10b6:518:1::51) by DM6PR12MB4249.namprd12.prod.outlook.com (2603:10b6:5:223::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.23; Mon, 18 Nov 2024 16:02:39 +0000 Received: from CY4PEPF0000EDD3.namprd03.prod.outlook.com (2a01:111:f403:f912::1) by PH3PEPF000040A0.outlook.office365.com (2603:1036:903:49::3) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.18 via Frontend Transport; Mon, 18 Nov 2024 16:02:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CY4PEPF0000EDD3.mail.protection.outlook.com (10.167.241.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.14 via Frontend Transport; Mon, 18 Nov 2024 16:02:38 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 18 Nov 2024 08:02:14 -0800 Received: from localhost.localdomain (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 18 Nov 2024 08:02:07 -0800 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , CC: Simon Horman , Ido Schimmel , "Petr Machata" , , Shuah Khan , Benjamin Poirier , Hangbin Liu , Vladimir Oltean , Subject: [RFC PATCH net-next 11/11] selftests: forwarding: Add a selftest for the new reserved_bits UAPI Date: Mon, 18 Nov 2024 17:43:17 +0100 Message-ID: <19411b7f8657ba2ded8c6d257223aa5117ce5344.1731941465.git.petrm@nvidia.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EDD3:EE_|DM6PR12MB4249:EE_ X-MS-Office365-Filtering-Correlation-Id: 8e8605f0-b26b-4b0b-cdfe-08dd07ea6ccb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: zSb9xsTa3gA3WL1Ekdd4lJ1ChwfArh4U0Ck7XPHYdaYGwhHuqitVl4EWDkPEMiarzum3bdh2FLlhU4n8nW6ACbOMBpZsj5EJR20JTCtPY3AOyIBi/Qw1BZebWC0V4Gz3cPP7aL8Fd5te3q0hbKYnFWNNdzcAcLwgKJbXhwWmdE8E55un/PdIexa+ZVMhFIReXIE0MLJ5shl1hthCj+YZWYDrMxrZL9Vge5etDtDsgcFrH+QJs5L5qgFy5WfKRQKv7mfyCLrbX0HPHi2sUBG3AEd5oz0XKs+AxfOq8y+tedvK2tciMWjhhBtVLNhisNAJp93YiNx3wXrsrz/SlZmYSpRQhw0GFJr3T9fKU8Cp/brrGXN2zJpNPa3M2TafMce9XPMG9maPPiw7CtEJZ58zmQGRADqnh6LMPHmH3a6ZFjYM0B9+jD9N+GM6zuLaQLpkm2ugcuSJnhBaeNdEEkN5tU+/PEwiFkIDi5scwheAfZqpSmhZcXM6VfBdnAUM17SMYpxrRFhD11Ne4k+jp2q2inTGFr/dgiGtVBxMySsS6F37xSJdlfcBOmFbGnYhLI/N8LYFTzv7BrhqjW5JhHaW03luYONtQOpwWe/uS81LPd6V680FdGohK3os+QOBCrUQGieiKWQ5RG4fTlX+ZPkLnWnePZCRuPRJ2zn/znBL28mQxtMF5/xgJwaSTOPQG6Wn0aBlOMFikeZVJ+t55Lv0NtZd1kKwSzCouypNSPm4fbHZt5Y97hZf7/dElLjl87GM+Wf/uBmQs7gJLDHgMTQxCyLIXX06sCsyNfqS6AxlfECIErFJRN+U2chATxpTPS3QGCErNsAoVLEJFBk0vBPxSr5eO77jcjqZ+Y2sTa1orFfNdJpbSZ/wKCGYAK0l05r5YLjE17c+26qgcmCXcPKAuzn9W9d/gDg9M4RuNtfOsDQsAfu5eG31kLEZmHZ14sBRy9Upj+qId9w1jXV/G2tyM5WZlgqAZZGlvGNe916dy84w6s61E0dz3GIPAaDCeiWJD4AmT+wgKxEHyoXM5yy7wb7GJZz9ZgvSDyIbNX49bp92TriVjSyHzSvZYIgHWnWbegzWG6Lf4dYi5DocglApJz8WuzGq2USp0Z4+VcCoqNqwL06Qz9fQYTmVME8zKqGwA0/h5Z5kEkONqy1j+pzXx90km+o7feSArpDGaFMtsyTGAHP/n9QusytaLrY0SxU4ChV2XZhvxvaoHPgbtkWnhYThzGzwaJ///6CeZSD/V5bTcjBd+kKz5E5POjr0QjoSUreDL4hmNi+jzZy11UibXma9T/KAgwGlEkF5Jcm3VfEWZs8FWReGMBPM683h4ALJDgErWtK68kvWaG/KP9HkKsIfTXeomIxZqR0gVcv2hCVjHKL3fyRwn5gHqSzRzIayn89iQgWJg5SlaI9dDTv1yA== X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(1800799024)(7416014)(376014)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2024 16:02:38.4266 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8e8605f0-b26b-4b0b-cdfe-08dd07ea6ccb X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EDD3.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4249 Run VXLAN packets through a gateway. Flip individual bits of the packet and/or reserved bits of the gateway, and check that the gateway treats the packets as expected. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- Notes: CC: Shuah Khan CC: Benjamin Poirier CC: Hangbin Liu CC: Vladimir Oltean CC: linux-kselftest@vger.kernel.org .../net/forwarding/vxlan_reserved.sh | 352 ++++++++++++++++++ 1 file changed, 352 insertions(+) create mode 100755 tools/testing/selftests/net/forwarding/vxlan_reserved.sh diff --git a/tools/testing/selftests/net/forwarding/vxlan_reserved.sh b/tools/testing/selftests/net/forwarding/vxlan_reserved.sh new file mode 100755 index 000000000000..46c31794b91b --- /dev/null +++ b/tools/testing/selftests/net/forwarding/vxlan_reserved.sh @@ -0,0 +1,352 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +# +--------------------+ +# | H1 (vrf) | +# | + $h1 | +# | | 192.0.2.1/28 | +# +----|---------------+ +# | +# +----|--------------------------------+ +# | SW | | +# | +--|------------------------------+ | +# | | + $swp1 BR1 (802.1d) | | +# | | | | +# | | + vx1 (vxlan) | | +# | | local 192.0.2.17 | | +# | | id 1000 dstport $VXPORT | | +# | +---------------------------------+ | +# | | +# | 192.0.2.32/28 via 192.0.2.18 | +# | | +# | + $rp1 | +# | | 192.0.2.17/28 | +# +--|----------------------------------+ +# | +# +--|----------------------------------+ +# | | | +# | + $rp2 | +# | 192.0.2.18/28 | +# | | +# | VRP2 (vrf) | +# +-------------------------------------+ + +: ${VXPORT:=4789} +: ${ALL_TESTS:=" + default_test + plain_test + reserved_0_test + reserved_10_test + reserved_31_test + reserved_56_test + reserved_63_test + "} + +NUM_NETIFS=4 +source lib.sh + +h1_create() +{ + simple_if_init $h1 192.0.2.1/28 + defer simple_if_fini $h1 192.0.2.1/28 + + tc qdisc add dev $h1 clsact + defer tc qdisc del dev $h1 clsact + + tc filter add dev $h1 ingress pref 77 \ + prot ip flower skip_hw ip_proto icmp action drop + defer tc filter del dev $h1 ingress pref 77 +} + +switch_create() +{ + ip_link_add br1 type bridge vlan_filtering 0 mcast_snooping 0 + # Make sure the bridge uses the MAC address of the local port and not + # that of the VxLAN's device. + ip_link_set_addr br1 $(mac_get $swp1) + ip_link_set_up br1 + + ip_link_set_up $rp1 + ip_addr_add $rp1 192.0.2.17/28 + ip_route_add 192.0.2.32/28 nexthop via 192.0.2.18 + + ip_link_set_master $swp1 br1 + ip_link_set_up $swp1 +} + +vrp2_create() +{ + simple_if_init $rp2 192.0.2.18/28 + defer simple_if_fini $rp2 192.0.2.18/28 +} + +setup_prepare() +{ + h1=${NETIFS[p1]} + swp1=${NETIFS[p2]} + + rp1=${NETIFS[p3]} + rp2=${NETIFS[p4]} + + vrf_prepare + defer vrf_cleanup + + forwarding_enable + defer forwarding_restore + + h1_create + switch_create + + vrp2_create +} + +vxlan_header_bytes() +{ + local vni=$1; shift + local -a extra_bits=("$@") + local -a bits + local i + + for ((i=0; i < 64; i++)); do + bits[i]=0 + done + + # Bit 4 is the I flag and is always on. + bits[4]=1 + + for i in ${extra_bits[@]}; do + bits[i]=1 + done + + # Bits 32..55 carry the VNI + local mask=0x800000 + for ((i=0; i < 24; i++)); do + bits[$((i + 32))]=$(((vni & mask) != 0)) + ((mask >>= 1)) + done + + local bytes + for ((i=0; i < 8; i++)); do + local byte=0 + local j + for ((j=0; j < 8; j++)); do + local bit=${bits[8 * i + j]} + ((byte += bit << (7 - j))) + done + bytes+=$(printf %02x $byte): + done + + echo ${bytes%:} +} + +neg_bytes() +{ + local bytes=$1; shift + + local -A neg=([0]=f [1]=e [2]=d [3]=c [4]=b [5]=a [6]=9 [7]=8 + [8]=7 [9]=6 [a]=5 [b]=4 [c]=3 [d]=2 [e]=1 [f]=0 [:]=:) + local out + local i + + for ((i=0; i < ${#bytes}; i++)); do + local c=${bytes:$i:1} + out+=${neg[$c]} + done + echo $out +} + +vxlan_ping_do() +{ + local count=$1; shift + local dev=$1; shift + local next_hop_mac=$1; shift + local dest_ip=$1; shift + local dest_mac=$1; shift + local vni=$1; shift + local reserved_bits=$1; shift + + local vxlan_header=$(vxlan_header_bytes $vni $reserved_bits) + + $MZ $dev -c $count -d 100msec -q \ + -b $next_hop_mac -B $dest_ip \ + -t udp sp=23456,dp=$VXPORT,p=$(: + )"$vxlan_header:"$( : VXLAN + )"$dest_mac:"$( : ETH daddr + )"00:11:22:33:44:55:"$( : ETH saddr + )"08:00:"$( : ETH type + )"45:"$( : IP version + IHL + )"00:"$( : IP TOS + )"00:54:"$( : IP total length + )"99:83:"$( : IP identification + )"40:00:"$( : IP flags + frag off + )"40:"$( : IP TTL + )"01:"$( : IP proto + )"00:00:"$( : IP header csum + )"$(ipv4_to_bytes 192.0.2.3):"$( : IP saddr + )"$(ipv4_to_bytes 192.0.2.1):"$( : IP daddr + )"08:"$( : ICMP type + )"00:"$( : ICMP code + )"8b:f2:"$( : ICMP csum + )"1f:6a:"$( : ICMP request identifier + )"00:01:"$( : ICMP request seq. number + )"4f:ff:c5:5b:00:00:00:00:"$( : ICMP payload + )"6d:74:0b:00:00:00:00:00:"$( : + )"10:11:12:13:14:15:16:17:"$( : + )"18:19:1a:1b:1c:1d:1e:1f:"$( : + )"20:21:22:23:24:25:26:27:"$( : + )"28:29:2a:2b:2c:2d:2e:2f:"$( : + )"30:31:32:33:34:35:36:37" +} + +vxlan_device_add() +{ + ip_link_add vx1 up type vxlan id 1000 \ + local 192.0.2.17 dstport "$VXPORT" \ + nolearning noudpcsum tos inherit ttl 100 "$@" + ip_link_set_master vx1 br1 +} + +vxlan_all_reserved_bits() +{ + local i + + for ((i=0; i < 64; i++)); do + if ((i == 4 || i >= 32 && i < 56)); then + continue + fi + echo $i + done +} + +vxlan_ping_vanilla() +{ + vxlan_ping_do 10 $rp2 $(mac_get $rp1) 192.0.2.17 $(mac_get $h1) 1000 +} + +vxlan_ping_reserved() +{ + for bit in $(vxlan_all_reserved_bits); do + vxlan_ping_do 1 $rp2 $(mac_get $rp1) \ + 192.0.2.17 $(mac_get $h1) 1000 "$bit" + ((n++)) + done +} + +vxlan_ping_test() +{ + local what=$1; shift + local get_stat=$1; shift + local expect=$1; shift + + RET=0 + + local t0=$($get_stat) + + "$@" + check_err $? "Failure when running $@" + + local t1=$($get_stat) + local delta=$((t1 - t0)) + + ((expect == delta)) + check_err $? "Expected to capture $expect packets, got $delta." + + log_test "$what" +} + +__default_test_do() +{ + local n_allowed_bits=$1; shift + local what=$1; shift + + vxlan_ping_test "$what: clean packets" \ + "tc_rule_stats_get $h1 77 ingress" \ + 10 vxlan_ping_vanilla + + local t0=$(link_stats_get vx1 rx errors) + vxlan_ping_test "$what: mangled packets" \ + "tc_rule_stats_get $h1 77 ingress" \ + $n_allowed_bits vxlan_ping_reserved + local t1=$(link_stats_get vx1 rx errors) + + RET=0 + local expect=$((39 - n_allowed_bits)) + local delta=$((t1 - t0)) + ((expect == delta)) + check_err $? "Expected $expect error packets, got $delta." + log_test "$what: drops reported" +} + +default_test_do() +{ + vxlan_device_add + __default_test_do 0 "Default" +} + +default_test() +{ + in_defer_scope \ + default_test_do +} + +plain_test_do() +{ + vxlan_device_add reserved_bits 0xf7ffffff000000ff + __default_test_do 0 "reserved_bits 0xf7ffffff000000ff" +} + +plain_test() +{ + in_defer_scope \ + plain_test_do +} + +reserved_test() +{ + local bit=$1; shift + + local allowed_bytes=$(vxlan_header_bytes 0xffffff $bit) + local reserved_bytes=$(neg_bytes $allowed_bytes) + local reserved_bits=${reserved_bytes//:/} + + vxlan_device_add reserved_bits 0x$reserved_bits + __default_test_do 1 "reserved_bits 0x$reserved_bits" +} + +reserved_0_test() +{ + in_defer_scope \ + reserved_test 0 +} + +reserved_10_test() +{ + in_defer_scope \ + reserved_test 10 +} + +reserved_31_test() +{ + in_defer_scope \ + reserved_test 31 +} + +reserved_56_test() +{ + in_defer_scope \ + reserved_test 56 +} + +reserved_63_test() +{ + in_defer_scope \ + reserved_test 63 +} + +trap cleanup EXIT + +setup_prepare +setup_wait +tests_run + +exit $EXIT_STATUS