public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] test_net.sh: add tst_set_sysctl()
@ 2017-01-25 14:21 Alexey Kodanev
  2017-01-25 14:21 ` [LTP] [PATCH 2/2] net: dctcp01: apply tst_set_sysctl() Alexey Kodanev
  2017-01-31 10:07 ` [LTP] [PATCH 1/2] test_net.sh: add tst_set_sysctl() Cyril Hrubis
  0 siblings, 2 replies; 7+ messages in thread
From: Alexey Kodanev @ 2017-01-25 14:21 UTC (permalink / raw)
  To: ltp

It can handle the case when sysctl is not namespaceified.

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 testcases/lib/test_net.sh |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/testcases/lib/test_net.sh b/testcases/lib/test_net.sh
index 37cc939..43a1d59 100644
--- a/testcases/lib/test_net.sh
+++ b/testcases/lib/test_net.sh
@@ -390,6 +390,27 @@ tst_ping()
 	return $ret
 }
 
+# tst_set_sysctl NAME VALUE [safe]
+# It can handle netns case when sysctl not namespaceified.
+tst_set_sysctl()
+{
+	local name="$1"
+	local value="$2"
+	local safe=
+	[ "$3" = "safe" ] && safe="-s" || safe=""
+
+	local add_opt=
+	[ "$TST_USE_NETNS" = "yes" ] && add_opt="-e"
+
+	if [ "$safe" ]; then
+		ROD sysctl -qw $name=$value
+	else
+		sysctl -qw $name=$value
+	fi
+
+	tst_rhost_run $safe -c "sysctl -qw $add_opt $name=$value"
+}
+
 # Management Link
 [ -z "$RHOST" ] && TST_USE_NETNS="yes"
 export RHOST="$RHOST"
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-01-31 15:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-25 14:21 [LTP] [PATCH 1/2] test_net.sh: add tst_set_sysctl() Alexey Kodanev
2017-01-25 14:21 ` [LTP] [PATCH 2/2] net: dctcp01: apply tst_set_sysctl() Alexey Kodanev
2017-01-31 10:07 ` [LTP] [PATCH 1/2] test_net.sh: add tst_set_sysctl() Cyril Hrubis
2017-01-31 11:27   ` Alexey Kodanev
2017-01-31 12:41     ` Cyril Hrubis
2017-01-31 13:38       ` Alexey Kodanev
2017-01-31 15:23         ` Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox