From d51d10aa1dbdedd9254874bf37e8b0cd96ea3bde Mon Sep 17 00:00:00 2001 From: Petr Machata Date: Thu, 3 May 2018 12:37:13 +0200 Subject: selftests: forwarding: Use sysctl_set(), sysctl_restore() 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 Signed-off-by: David S. Miller --- tools/testing/selftests/net/forwarding/lib.sh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'tools/testing/selftests/net/forwarding/lib.sh') diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index e49e78b5cd3d..91041c49655b 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -400,17 +400,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() -- cgit v1.2.3