[LTP] [PATCH 6/9] tst_net.sh: Rename function + add doc

Petr Vorel pvorel@suse.cz
Thu Jan 26 22:53:58 CET 2023


Rename tst_net_detect_ipv6() to tst_net_detect_ipv6_cmdline() because
there will be another function to detect IPv6 disabled via sysctl.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/lib/tst_net.sh | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index 6cb9f02a5f..3a9c16f070 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -100,7 +100,10 @@ tst_brk_()
 	[ -z "$TST_USE_LEGACY_API" ] && tst_brk $@ || tst_brkm $@
 }
 
-tst_net_detect_ipv6()
+# detect IPv6 not disabled via ipv6.disable=1 kernel cmdline parameter
+# or via CONFIG_IPV6=y kernel configure option
+# $TST_NET_IPV6_ENABLED: 1 (enabled), 0 (disabled)
+tst_net_detect_ipv6_cmdline()
 {
 	local type="${1:-lhost}"
 	local cmd='[ -f /proc/net/if_inet6 ]'
@@ -970,7 +973,7 @@ tst_default_max_pkt()
 [ -n "$TST_USE_LEGACY_API" ] && . test.sh || . tst_test.sh
 
 # detect IPv6 support on lhost for tests which don't use test links
-tst_net_detect_ipv6
+tst_net_detect_ipv6_cmdline
 
 [ -n "$TST_NET_SKIP_VARIABLE_INIT" ] && return 0
 
@@ -1007,7 +1010,7 @@ tst_require_cmds tst_net_iface_prefix tst_net_ip_prefix tst_net_vars
 eval $(tst_net_ip_prefix $IPV4_LHOST || echo "exit $?")
 eval $(tst_net_ip_prefix -r $IPV4_RHOST || echo "exit $?")
 
-[ "$TST_NET_IPV6_ENABLED" = 1 ] && tst_net_detect_ipv6 rhost
+[ "$TST_NET_IPV6_ENABLED" = 1 ] && tst_net_detect_ipv6_cmdline rhost
 
 if [ "$TST_NET_IPV6_ENABLED" = 1 ]; then
 	eval $(tst_net_ip_prefix $IPV6_LHOST || echo "exit $?")
-- 
2.39.1



More information about the ltp mailing list