From patchwork Wed May 2 16:11:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10376085 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9300160234 for ; Wed, 2 May 2018 16:12:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 822B928F6A for ; Wed, 2 May 2018 16:12:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 75F9528F74; Wed, 2 May 2018 16:12:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, MAILING_LIST_MULTI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 983EC28F6A for ; Wed, 2 May 2018 16:12:01 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40bjw000nwzF2Tg for ; Thu, 3 May 2018 02:12:00 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="MjVhG2rY"; dkim-atps=neutral X-Original-To: linux-mlxsw@lists.ozlabs.org Delivered-To: linux-mlxsw@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=mellanox.com (client-ip=40.107.3.83; helo=eur03-am5-obe.outbound.protection.outlook.com; envelope-from=petrm@mellanox.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="MjVhG2rY"; dkim-atps=neutral Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30083.outbound.protection.outlook.com [40.107.3.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40bjvv0d01zF2TY for ; Thu, 3 May 2018 02:11:54 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=7JPzl/YL+L4MudhEWmsrRG0BCTS4Bqhc+K3Jd8//k2k=; b=MjVhG2rY6dzuxN2og7dfhZo7QseW6S8NVRRXLmIgAKJv8o40UqBbKlZzcCcPcfUT4Pd9KidYeMOvsgpGWYGgtTYDQWc+DskGdqpPQqVyCZUvtwjDaXYRQQ8Vhpn8eWta9/JsOcBWDT2oOWwFQkDV5KTzYXA+NXtMY9XXe1ZWwMc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by VI1PR05MB4191.eurprd05.prod.outlook.com (2603:10a6:803:4e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.715.20; Wed, 2 May 2018 16:11:52 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw 2/2] selftests: forwarding: Use sysctl_set(), sysctl_restore() In-Reply-To: References: Message-Id: <674abd08cee906f9a6317127a5b3478e521b8082.1525277166.git.petrm@mellanox.com> Date: Wed, 02 May 2018 18:11:47 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 X-Originating-IP: [78.45.160.211] X-ClientProxiedBy: CWLP265CA0052.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:12::16) To VI1PR05MB4191.eurprd05.prod.outlook.com (2603:10a6:803:4e::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(2017052603328)(7153060)(7193020); SRVR:VI1PR05MB4191; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 3:mPemIOYUVG2OiGVfMjLXN9IN1d4ftXKzlvmOVzz2iJGUfZYleDIABQU+86MqOwfHYrcNbDzu/hTFGw1Ylyt9yzAraxAfiK1U6TqD4dzNckJY+aLH9greHBX/M0BpjNi9vW4kpHzMQPDVedTHW2sGqCCjRCo/nbk/9xCDmka0oPgamhMedva7elsBSthtVFXYZcAvJnqOSIBE7i6aWMlRBqW1GwOTWGjWT3Ti3dnvqS18X5cHZLKDJib7uDIlSgDj; 25:8YjkxVDC5JZLRTtgSfRJnS4hh8GwaGO0PhRSbYosPa9X1YAeoGEUx4dGJ+dLwlaahW6V9ouoMNB8eHzMPyJm94Jga64gnGqg5U4bbO7NunK/X/MIcB86/0VeYYM7CKH6guZ6qta8fRlzoTbfGBlhRxOVgO/vcaxDpLpjXFK32SfgD+6hE7OWg0rUhlB2XxfjNtH9EW4KAipRVTsSoqNYzX/OCqMJE3Cl+6AdLqkyAG2PLaHpmCpgj/X325SYSL9VdOOjuvtDrvzn7qHc82TdT1i9/0fR2JcN3ziwxoQIMMvZwmc/LzRbbTX5wXyvXYRv+fLPUQtUC+GuJSks8Feu4w==; 31:nbiQ2NJgarPcSu13JLHC42Y6o4Gqnu+4+uh3vtVOjXm3ywmyFp2c9Z65CjfR+uP+qbeub5iSRdKg+w6Xng8k0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exchange-Antispam-Report-Test: UriScan:(788757137089); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(10201501046)(3231254)(944501410)(52105095)(93006095)(93001095)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(6072148)(201708071742011); SRVR:VI1PR05MB4191; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB4191; X-Forefront-PRVS: 06607E485E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(366004)(376002)(39860400002)(396003)(39380400002)(199004)(189003)(6496006)(11346002)(52116002)(5660300001)(76176011)(16586007)(58126008)(47776003)(59450400001)(386003)(446003)(2351001)(478600001)(68736007)(2616005)(476003)(66066001)(48376002)(575784001)(50466002)(86362001)(36756003)(97736004)(8936002)(8676002)(956004)(26005)(6116002)(6666003)(6486002)(118296001)(53936002)(105586002)(107886003)(81156014)(81166006)(305945005)(16526019)(2906002)(51416003)(106356001)(316002)(486006)(6916009)(3846002)(25786009)(4326008)(7736002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB4191; H:t540p; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR05MB4191; 23:AGbnQd9V7GGZL9j1lBrfQKuNmIOeqZIc9h2S7CkEX?= =?us-ascii?Q?+ZaHGTwh7T+nwTsLG3xOkUJoJqNbexJfaM2Z39Tgngoa7ILi+tYu+mWxpsMw?= =?us-ascii?Q?KojmNzs//9cS+/zgGoVnUgyCSLU9Sn/UYFsmc+b3xvLVwjD1RZ0SPkyezFVk?= =?us-ascii?Q?j7o+66m3yWYq3alzvlVlv25XQoccYct+Qd5w08FdNYA80uKi/1R5AQ7FhRBA?= =?us-ascii?Q?sV9llFh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5rcXLI=; 24:/MKzo7ypXV7Pc4MAls6t45wkw21mEhJk8euu0wYlLXs1vX6TvtJj/Kh5zcAIxqyFaQ4RuFw7MQrUbr+jCjz4Iv0JXu6rXw++tRoh6asEhxI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 7:5Je2eE7QZg4qhxHNPRel0vJeDdEpsV0Z9r9JsRDbWQDstTgAQtULIJ5zqkCdlTdjxgBBNvat8pY9FHIcOU5zxK4682KnvD6nzwnILlgs24dxDGCFBtq+CNEjcvdm2RXSXL5IqVgSpHFEv7FKvH/ZtBNElie2Qc8MBvMzp5hbwYxTIb/xhdDbIX4hy3aEOe1Y6L9qZboKpRy1N4S5PbSIbljK7rUVidta23XLFQ/DNJ+NbfJFlP1lZzb3OlGXEB61 X-MS-Office365-Filtering-Correlation-Id: 8ec70c75-96c4-47a1-abcd-08d5b0476b0f X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 May 2018 16:11:52.5023 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8ec70c75-96c4-47a1-abcd-08d5b0476b0f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4191 X-BeenThere: linux-mlxsw@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: mlxsw driver development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-internal@mellanox.com Errors-To: linux-mlxsw-bounces+patchwork-linux-mlxsw=patchwork.kernel.org@lists.ozlabs.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of hand-managing the sysctl set and restore, use the wrappers sysctl_set() and sysctl_restore() to do the bookkeeping automatically. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- tools/testing/selftests/net/forwarding/lib.sh | 11 ++++------- tools/testing/selftests/net/forwarding/mirror_gre_changes.sh | 7 ++----- tools/testing/selftests/net/forwarding/mirror_gre_nh.sh | 10 ++++------ tools/testing/selftests/net/forwarding/router_multipath.sh | 12 ++++-------- 4 files changed, 14 insertions(+), 26 deletions(-) diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index 426b294..a7a6750 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -420,17 +420,14 @@ sysctl_restore() forwarding_enable() { - ipv4_fwd=$(sysctl -n net.ipv4.conf.all.forwarding) - ipv6_fwd=$(sysctl -n net.ipv6.conf.all.forwarding) - - sysctl -q -w net.ipv4.conf.all.forwarding=1 - sysctl -q -w net.ipv6.conf.all.forwarding=1 + sysctl_set net.ipv4.conf.all.forwarding 1 + sysctl_set net.ipv6.conf.all.forwarding 1 } forwarding_restore() { - sysctl -q -w net.ipv6.conf.all.forwarding=$ipv6_fwd - sysctl -q -w net.ipv4.conf.all.forwarding=$ipv4_fwd + sysctl_restore net.ipv6.conf.all.forwarding + sysctl_restore net.ipv4.conf.all.forwarding } tc_offload_check() diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_changes.sh b/tools/testing/selftests/net/forwarding/mirror_gre_changes.sh index fdb612f..50ab346 100755 --- a/tools/testing/selftests/net/forwarding/mirror_gre_changes.sh +++ b/tools/testing/selftests/net/forwarding/mirror_gre_changes.sh @@ -36,9 +36,7 @@ setup_prepare() # This test downs $swp3, which deletes the configured IPv6 address # unless this sysctl is set. - local key=net.ipv6.conf.$swp3.keep_addr_on_down - SWP3_KEEP_ADDR_ON_DOWN=$(sysctl -n $key) - sysctl -qw $key=1 + sysctl_set net.ipv6.conf.$swp3.keep_addr_on_down 1 ip address add dev $swp3 192.0.2.129/28 ip address add dev $h3 192.0.2.130/28 @@ -57,8 +55,7 @@ cleanup() ip address del dev $h3 192.0.2.130/28 ip address del dev $swp3 192.0.2.129/28 - local key=net.ipv6.conf.$swp3.keep_addr_on_down - sysctl -qw $key=$SWP3_KEEP_ADDR_ON_DOWN + sysctl_restore net.ipv6.conf.$swp3.keep_addr_on_down mirror_gre_topo_destroy vrf_cleanup diff --git a/tools/testing/selftests/net/forwarding/mirror_gre_nh.sh b/tools/testing/selftests/net/forwarding/mirror_gre_nh.sh index 3575e9b..8fa681e 100755 --- a/tools/testing/selftests/net/forwarding/mirror_gre_nh.sh +++ b/tools/testing/selftests/net/forwarding/mirror_gre_nh.sh @@ -29,10 +29,8 @@ setup_prepare() swp3=${NETIFS[p5]} h3=${NETIFS[p6]} - all_rp_filter=$(sysctl -n net.ipv4.conf.all.rp_filter) - h3_rp_filter=$(sysctl -n net.ipv4.conf.$h3.rp_filter) - sysctl -qw net.ipv4.conf.all.rp_filter=0 - sysctl -qw net.ipv4.conf.$h3.rp_filter=0 + sysctl_set net.ipv4.conf.all.rp_filter 0 + sysctl_set net.ipv4.conf.$h3.rp_filter 0 vrf_prepare mirror_gre_topo_create @@ -66,8 +64,8 @@ cleanup() mirror_gre_topo_destroy vrf_cleanup - sysctl -qw net.ipv4.conf.$h3.rp_filter=$h3_rp_filter - sysctl -qw net.ipv4.conf.all.rp_filter=$all_rp_filter + sysctl_restore net.ipv4.conf.$h3.rp_filter + sysctl_restore net.ipv4.conf.all.rp_filter } test_gretap() diff --git a/tools/testing/selftests/net/forwarding/router_multipath.sh b/tools/testing/selftests/net/forwarding/router_multipath.sh index 6c43762..8b6d0fb 100755 --- a/tools/testing/selftests/net/forwarding/router_multipath.sh +++ b/tools/testing/selftests/net/forwarding/router_multipath.sh @@ -205,13 +205,11 @@ multipath4_test() local weight_rp13=$3 local t0_rp12 t0_rp13 t1_rp12 t1_rp13 local packets_rp12 packets_rp13 - local hash_policy # Transmit multiple flows from h1 to h2 and make sure they are # distributed between both multipath links (rp12 and rp13) # according to the configured weights. - hash_policy=$(sysctl -n net.ipv4.fib_multipath_hash_policy) - sysctl -q -w net.ipv4.fib_multipath_hash_policy=1 + sysctl_set net.ipv4.fib_multipath_hash_policy 1 ip route replace 198.51.100.0/24 vrf vrf-r1 \ nexthop via 169.254.2.22 dev $rp12 weight $weight_rp12 \ nexthop via 169.254.3.23 dev $rp13 weight $weight_rp13 @@ -233,7 +231,7 @@ multipath4_test() ip route replace 198.51.100.0/24 vrf vrf-r1 \ nexthop via 169.254.2.22 dev $rp12 \ nexthop via 169.254.3.23 dev $rp13 - sysctl -q -w net.ipv4.fib_multipath_hash_policy=$hash_policy + sysctl_restore net.ipv4.fib_multipath_hash_policy } multipath6_l4_test() @@ -243,13 +241,11 @@ multipath6_l4_test() local weight_rp13=$3 local t0_rp12 t0_rp13 t1_rp12 t1_rp13 local packets_rp12 packets_rp13 - local hash_policy # Transmit multiple flows from h1 to h2 and make sure they are # distributed between both multipath links (rp12 and rp13) # according to the configured weights. - hash_policy=$(sysctl -n net.ipv6.fib_multipath_hash_policy) - sysctl -q -w net.ipv6.fib_multipath_hash_policy=1 + sysctl_set net.ipv6.fib_multipath_hash_policy 1 ip route replace 2001:db8:2::/64 vrf vrf-r1 \ nexthop via fe80:2::22 dev $rp12 weight $weight_rp12 \ @@ -272,7 +268,7 @@ multipath6_l4_test() nexthop via fe80:2::22 dev $rp12 \ nexthop via fe80:3::23 dev $rp13 - sysctl -q -w net.ipv6.fib_multipath_hash_policy=$hash_policy + sysctl_restore net.ipv6.fib_multipath_hash_policy } multipath6_test()