All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] lib/tst_net.sh: ignore errors on rhost with -i option in tst_net_run()
@ 2021-09-13 12:39 ` Alexey Kodanev
  2021-09-13 12:39     ` Alexey Kodanev
  2021-09-14  5:46     ` Petr Vorel
  0 siblings, 2 replies; 7+ messages in thread
From: Alexey Kodanev @ 2021-09-13 12:39 UTC (permalink / raw)
  To: ltp

Unfortanetly busysbox/sysctl with -e option only suppresses the
warning about unknown keys and still returns exit code 1:
    sysctl -h
    ...
    -e don't warn about unknown keys

As a result busy_poll01 fails on this error:

    busy_poll01.sh
    busy_poll01 1 TINFO: initialize 'lhost' 'ltp_ns_veth2' interface
    ...
    busy_poll01 1 TINFO: set low latency busy poll to 50
    busy_poll01 1 TBROK: 'sysctl -q -w '-e' net.core.busy_read=50' failed on '': ''

So let's add a new option (-i) in tst_net_run() to ignore the
error when running the command on "rhost".

Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
---
 testcases/lib/tst_net.sh | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index 958d71e3d..7f2a1bab3 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -212,6 +212,7 @@ tst_rhost_run()
 # -l LPARAM: parameter passed to CMD in lhost
 # -r RPARAM: parameter passed to CMD in rhost
 # -q: quiet mode (suppress failure warnings)
+# -i: ignore errors on rhost
 # CMD: command to run (this must be binary, not shell builtin/function due
 # tst_rhost_run() limitation)
 # RETURN: 0 on success, 1 on missing CMD or exit code on lhost or rhost
@@ -227,12 +228,13 @@ tst_net_run()
 	local quiet
 
 	local OPTIND
-	while getopts l:qr:s opt; do
+	while getopts l:qr:si opt; do
 		case "$opt" in
 		l) lparams="$OPTARG" ;;
 		q) quiet=1 ;;
 		r) rparams="$OPTARG" ;;
 		s) lsafe="ROD"; rsafe="-s" ;;
+		i) rsafe="" ;;
 		*) tst_brk_ TBROK "tst_net_run: unknown option: $OPTARG" ;;
 		esac
 	done
@@ -916,9 +918,9 @@ tst_set_sysctl()
 	[ "$3" = "safe" ] && safe="-s"
 
 	local rparam=
-	[ "$TST_USE_NETNS" = "yes" ] && rparam="-r '-e'"
+	[ "$TST_USE_NETNS" = "yes" ] && rparam="-i -r '-e'"
 
-	tst_net_run $safe $rparam "sysctl" "-q -w $name=$value"
+	tst_net_run $safe -q $rparam "sysctl" "-q -w $name=$value"
 }
 
 tst_cleanup_rhost()
-- 
2.25.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* [LTP] [PATCH 2/2] lib/tst_net.sh: disable ipv6_dad work on test interfaces
@ 2021-09-13 12:39     ` Alexey Kodanev
  2021-09-14  5:48         ` Petr Vorel
  2021-11-16  9:20       ` suy.fnst
  0 siblings, 2 replies; 7+ messages in thread
From: Alexey Kodanev @ 2021-09-13 12:39 UTC (permalink / raw)
  To: ltp; +Cc: Su Yue

To fix intermittent issues with ping (in flood mode) [1] tests
after initial test interfaces setup.

We're already adding IPv6 addresses with nodad option, but it
should disable ipv6_dad for link-local addresses too, so that
they are fully functional when tests start to use them.

It could also be tst_wait_ipv6_dad(), but it slows down a test
setup.

[1]: https://github.com/iputils/iputils/issues/300

Tested-by: Su Yue <suy.fnst@fujitsu.com>
Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
---
 testcases/lib/tst_net.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index 7f2a1bab3..89d4c79ec 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -517,6 +517,7 @@ tst_init_iface()
 		ip link set $iface down || return $?
 		ip route flush dev $iface || return $?
 		ip addr flush dev $iface || return $?
+		sysctl -qw net.ipv6.conf.$iface.accept_dad=0 || return $?
 		ip link set $iface up
 		return $?
 	fi
@@ -528,6 +529,7 @@ tst_init_iface()
 	tst_rhost_run -c "ip link set $iface down" || return $?
 	tst_rhost_run -c "ip route flush dev $iface" || return $?
 	tst_rhost_run -c "ip addr flush dev $iface" || return $?
+	tst_rhost_run -c "sysctl -qw net.ipv6.conf.$iface.accept_dad=0" || return $?
 	tst_rhost_run -c "ip link set $iface up"
 }
 
-- 
2.25.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH 1/2] lib/tst_net.sh: ignore errors on rhost with -i option in tst_net_run()
@ 2021-09-14  5:46     ` Petr Vorel
  2021-09-14  9:42         ` Alexey Kodanev
  0 siblings, 1 reply; 7+ messages in thread
From: Petr Vorel @ 2021-09-14  5:46 UTC (permalink / raw)
  To: Alexey Kodanev; +Cc: ltp

Hi Alexey,

good catch!
Reviewed-by: Petr Vorel <pvorel@suse.cz>

BTW are you going to send patch / report it to busybox? (I haven't find anything on ML)

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH 2/2] lib/tst_net.sh: disable ipv6_dad work on test interfaces
@ 2021-09-14  5:48         ` Petr Vorel
  0 siblings, 0 replies; 7+ messages in thread
From: Petr Vorel @ 2021-09-14  5:48 UTC (permalink / raw)
  To: Alexey Kodanev; +Cc: Su Yue, ltp

Hi Alexey,

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Thanks!

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH 1/2] lib/tst_net.sh: ignore errors on rhost with -i option in tst_net_run()
@ 2021-09-14  9:42         ` Alexey Kodanev
  2021-09-15  9:35             ` Petr Vorel
  0 siblings, 1 reply; 7+ messages in thread
From: Alexey Kodanev @ 2021-09-14  9:42 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

Hi Petr,
On 14.09.2021 08:46, Petr Vorel wrote:
> Hi Alexey,
> 
> good catch!
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
> 
> BTW are you going to send patch / report it to busybox? (I haven't find anything on ML)

Looking at busybox history, seems expected from the beginning there:

commit 64309f8669f08f2c3c16a3b5bf82d9cae84ec388
Author: Denis Vlasenko <vda.linux@googlemail.com>
Date:   Thu Nov 29 06:40:28 2007 +0000

    sysctl: add -e: supress warnings about invalid key (Jeremy Kerr <jk@ozlabs.org>)

-e option unsets FLAG_SHOW_KEY_ERRORS.

busybox/sysctl: "-e	Don't warn about unknown keys"
(Though, -q option can be used for that, which was added later, in 2012)
vs
procps/sysctl:  "-e, --ignore         ignore unknown variables errors"

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH 1/2] lib/tst_net.sh: ignore errors on rhost with -i option in tst_net_run()
@ 2021-09-15  9:35             ` Petr Vorel
  0 siblings, 0 replies; 7+ messages in thread
From: Petr Vorel @ 2021-09-15  9:35 UTC (permalink / raw)
  To: Alexey Kodanev; +Cc: ltp

Hi Alexey,

> Hi Petr,
> On 14.09.2021 08:46, Petr Vorel wrote:
> > Hi Alexey,

> > good catch!
> > Reviewed-by: Petr Vorel <pvorel@suse.cz>

> > BTW are you going to send patch / report it to busybox? (I haven't find anything on ML)

> Looking at busybox history, seems expected from the beginning there:

> commit 64309f8669f08f2c3c16a3b5bf82d9cae84ec388
> Author: Denis Vlasenko <vda.linux@googlemail.com>
> Date:   Thu Nov 29 06:40:28 2007 +0000

>     sysctl: add -e: supress warnings about invalid key (Jeremy Kerr <jk@ozlabs.org>)

> -e option unsets FLAG_SHOW_KEY_ERRORS.

> busybox/sysctl: "-e	Don't warn about unknown keys"
> (Though, -q option can be used for that, which was added later, in 2012)
> vs
> procps/sysctl:  "-e, --ignore         ignore unknown variables errors"

Hm, IMHO it'd be good change to -e have 0 exit status. Because that's the
behavior in procps-ng (tested on 3.3.17).

If you do it, please let me know and/or Cc me in your patch. Otherwise I'll do it.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH 2/2] lib/tst_net.sh: disable ipv6_dad work on test interfaces
  2021-09-13 12:39     ` Alexey Kodanev
  2021-09-14  5:48         ` Petr Vorel
@ 2021-11-16  9:20       ` suy.fnst
  1 sibling, 0 replies; 7+ messages in thread
From: suy.fnst @ 2021-11-16  9:20 UTC (permalink / raw)
  To: Alexey Kodanev, ltp

Hi,
  Obviously `sysctl -qw net.ipv6.conf.$iface.accept_dad=0` would failed if ipv6 is off.
It caused failures of tests when ipv6 is off in our internal environment.
  No mean to blame the commit, just report the issue : )

Thanks,
Su

________________________________________
From: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
Sent: Monday, September 13, 2021 20:39
To: ltp@lists.linux.it
Cc: Alexey Kodanev; Su, Yue/苏 越
Subject: [PATCH 2/2] lib/tst_net.sh: disable ipv6_dad work on test interfaces

To fix intermittent issues with ping (in flood mode) [1] tests
after initial test interfaces setup.

We're already adding IPv6 addresses with nodad option, but it
should disable ipv6_dad for link-local addresses too, so that
they are fully functional when tests start to use them.

It could also be tst_wait_ipv6_dad(), but it slows down a test
setup.

[1]: https://github.com/iputils/iputils/issues/300

Tested-by: Su Yue <suy.fnst@fujitsu.com>
Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
---
 testcases/lib/tst_net.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index 7f2a1bab3..89d4c79ec 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -517,6 +517,7 @@ tst_init_iface()
                ip link set $iface down || return $?
                ip route flush dev $iface || return $?
                ip addr flush dev $iface || return $?
+               sysctl -qw net.ipv6.conf.$iface.accept_dad=0 || return $?
                ip link set $iface up
                return $?
        fi
@@ -528,6 +529,7 @@ tst_init_iface()
        tst_rhost_run -c "ip link set $iface down" || return $?
        tst_rhost_run -c "ip route flush dev $iface" || return $?
        tst_rhost_run -c "ip addr flush dev $iface" || return $?
+       tst_rhost_run -c "sysctl -qw net.ipv6.conf.$iface.accept_dad=0" || return $?
        tst_rhost_run -c "ip link set $iface up"
 }

--
2.25.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

end of thread, other threads:[~2021-11-16  9:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-13 12:39 [LTP] [PATCH 1/2] lib/tst_net.sh: ignore errors on rhost with -i option in tst_net_run() Alexey Kodanev
2021-09-13 12:39 ` Alexey Kodanev
2021-09-13 12:39   ` [LTP] [PATCH 2/2] lib/tst_net.sh: disable ipv6_dad work on test interfaces Alexey Kodanev
2021-09-13 12:39     ` Alexey Kodanev
2021-09-14  5:48       ` Petr Vorel
2021-09-14  5:48         ` Petr Vorel
2021-11-16  9:20       ` suy.fnst
2021-09-14  5:46   ` [LTP] [PATCH 1/2] lib/tst_net.sh: ignore errors on rhost with -i option in tst_net_run() Petr Vorel
2021-09-14  5:46     ` Petr Vorel
2021-09-14  9:42       ` Alexey Kodanev
2021-09-14  9:42         ` Alexey Kodanev
2021-09-15  9:35           ` Petr Vorel
2021-09-15  9:35             ` Petr Vorel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.