* [LTP] [PATCH] netns_helper.sh: use 'ping -6' when ping6 is not avaliable
@ 2018-08-29 3:51 Lei Yang
2018-08-31 9:27 ` Petr Vorel
2018-10-08 10:07 ` Petr Vorel
0 siblings, 2 replies; 3+ messages in thread
From: Lei Yang @ 2018-08-29 3:51 UTC (permalink / raw)
To: ltp
ping6 has been merged into ping since 2015 by using "ping -6"
in some distrubiton like open embeded, they droped ping6 completely
this patch will let both "ping -6" and ping6 work
Signed-off-by: Lei Yang <Lei.Yang@windriver.com>
---
testcases/kernel/containers/netns/netns_helper.sh | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/containers/netns/netns_helper.sh b/testcases/kernel/containers/netns/netns_helper.sh
index 6aea10b..e3f60e1 100755
--- a/testcases/kernel/containers/netns/netns_helper.sh
+++ b/testcases/kernel/containers/netns/netns_helper.sh
@@ -168,7 +168,12 @@ netns_setup()
ipv6)
IFCONF_IN6_ARG="inet6 add"
IP0=$6; IP1=$7;
- tping="ping6"; NETMASK=64
+ if which ping6 >/dev/null 2>&1; then
+ tping="ping6"
+ else
+ tping="ping -6"
+ fi
+ NETMASK=64
;;
*)
tst_brkm TBROK "second argument must be an ip version (ipv4|ipv6)"
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [LTP] [PATCH] netns_helper.sh: use 'ping -6' when ping6 is not avaliable
2018-08-29 3:51 [LTP] [PATCH] netns_helper.sh: use 'ping -6' when ping6 is not avaliable Lei Yang
@ 2018-08-31 9:27 ` Petr Vorel
2018-10-08 10:07 ` Petr Vorel
1 sibling, 0 replies; 3+ messages in thread
From: Petr Vorel @ 2018-08-31 9:27 UTC (permalink / raw)
To: ltp
Hi Lei,
> ping6 has been merged into ping since 2015 by using "ping -6"
> in some distrubiton like open embeded, they droped ping6 completely
> this patch will let both "ping -6" and ping6 work
I raised similar patch for tst_ping() (tst_net.sh) in the past [1]
(it wasn't accepted and I wouldn't be for accepting it now).
ping is used in many scripts (most of them are "network tests", which use
tst_net.sh, netns_helper.sh is the only exception), so it'd be good to have
general solution.
Old iputils versions (before s20150815) didn't have -4/-6 switches, new ones
leave creating ping6 symlink to distros (see [2]). We could use simple
solution: just to require ping6 (tst_test_cmds ping6), as symlink can be done by
user anywhere in the path (even with root access, which is expected anyway for
many tests) + document it in testcases/network/README.md.
I'd prefer this solution.
Or we can create some helper, which does this check (not sure the name,
tst_ping() is already used).
Kind regards,
Petr
[1] http://lists.linux.it/pipermail/ltp/2016-December/003312.html
[2] https://github.com/iputils/iputils/commit/ebad35fee3de851b809c7b72ccc654a72b6af61d
> Signed-off-by: Lei Yang <Lei.Yang@windriver.com>
> ---
> testcases/kernel/containers/netns/netns_helper.sh | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
> diff --git a/testcases/kernel/containers/netns/netns_helper.sh b/testcases/kernel/containers/netns/netns_helper.sh
> index 6aea10b..e3f60e1 100755
> --- a/testcases/kernel/containers/netns/netns_helper.sh
> +++ b/testcases/kernel/containers/netns/netns_helper.sh
> @@ -168,7 +168,12 @@ netns_setup()
> ipv6)
> IFCONF_IN6_ARG="inet6 add"
> IP0=$6; IP1=$7;
> - tping="ping6"; NETMASK=64
> + if which ping6 >/dev/null 2>&1; then
FYI: There is a helper tst_cmd_available(), but it's just for new shell API (tst_test.sh).
> + tping="ping6"
> + else
> + tping="ping -6"
> + fi
> + NETMASK=64
> ;;
> *)
> tst_brkm TBROK "second argument must be an ip version (ipv4|ipv6)"
^ permalink raw reply [flat|nested] 3+ messages in thread
* [LTP] [PATCH] netns_helper.sh: use 'ping -6' when ping6 is not avaliable
2018-08-29 3:51 [LTP] [PATCH] netns_helper.sh: use 'ping -6' when ping6 is not avaliable Lei Yang
2018-08-31 9:27 ` Petr Vorel
@ 2018-10-08 10:07 ` Petr Vorel
1 sibling, 0 replies; 3+ messages in thread
From: Petr Vorel @ 2018-10-08 10:07 UTC (permalink / raw)
To: ltp
Hi Lei,
> ping6 has been merged into ping since 2015 by using "ping -6"
> in some distrubiton like open embeded, they droped ping6 completely
> this patch will let both "ping -6" and ping6 work
> Signed-off-by: Lei Yang <Lei.Yang@windriver.com>
> ---
> testcases/kernel/containers/netns/netns_helper.sh | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
...
> - tping="ping6"; NETMASK=64
> + if which ping6 >/dev/null 2>&1; then
> + tping="ping6"
> + else
> + tping="ping -6"
> + fi
> + NETMASK=64
I decided to push this patch. I plan to create alias in tst_net.sh, but
netns_helper.sh doesn't use it (and use still legacy shell API),
so your patch uses the best approach.
Thanks for your patch!
Kind regards,
Petr
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-10-08 10:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-29 3:51 [LTP] [PATCH] netns_helper.sh: use 'ping -6' when ping6 is not avaliable Lei Yang
2018-08-31 9:27 ` Petr Vorel
2018-10-08 10:07 ` Petr Vorel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox