aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/net/forwarding/lib.sh
diff options
context:
space:
mode:
authorPetr Machata <petrm@mellanox.com>2018-05-03 12:37:13 +0200
committerDavid S. Miller <davem@davemloft.net>2018-05-03 13:37:02 -0400
commitd51d10aa1dbdedd9254874bf37e8b0cd96ea3bde (patch)
treef3b3e33094389e6e6a33aa94960217c947fcffd4 /tools/testing/selftests/net/forwarding/lib.sh
parentselftests: forwarding: lib: Add sysctl_set(), sysctl_restore() (diff)
downloadlinux-dev-d51d10aa1dbdedd9254874bf37e8b0cd96ea3bde.tar.xz
linux-dev-d51d10aa1dbdedd9254874bf37e8b0cd96ea3bde.zip
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 <petrm@mellanox.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/testing/selftests/net/forwarding/lib.sh')
-rw-r--r--tools/testing/selftests/net/forwarding/lib.sh11
1 files changed, 4 insertions, 7 deletions
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()