linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests: net: properly support IPv6 in GSO GRE test
@ 2021-11-04 10:46 Andrea Righi
  2021-11-04 11:30 ` patchwork-bot+netdevbpf
  2021-11-11 15:20 ` Jakub Kicinski
  0 siblings, 2 replies; 4+ messages in thread
From: Andrea Righi @ 2021-11-04 10:46 UTC (permalink / raw)
  To: Shuah Khan, David S . Miller, Jakub Kicinski
  Cc: linux-kselftest, netdev, linux-kernel

Explicitly pass -6 to netcat when the test is using IPv6 to prevent
failures.

Also make sure to pass "-N" to netcat to close the socket after EOF on
the client side, otherwise we would always hit the timeout and the test
would fail.

Without this fix applied:

 TEST: GREv6/v4 - copy file w/ TSO                                   [FAIL]
 TEST: GREv6/v4 - copy file w/ GSO                                   [FAIL]
 TEST: GREv6/v6 - copy file w/ TSO                                   [FAIL]
 TEST: GREv6/v6 - copy file w/ GSO                                   [FAIL]

With this fix applied:

 TEST: GREv6/v4 - copy file w/ TSO                                   [ OK ]
 TEST: GREv6/v4 - copy file w/ GSO                                   [ OK ]
 TEST: GREv6/v6 - copy file w/ TSO                                   [ OK ]
 TEST: GREv6/v6 - copy file w/ GSO                                   [ OK ]

Fixes: 025efa0a82df ("selftests: add simple GSO GRE test")
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
---
 tools/testing/selftests/net/gre_gso.sh | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/net/gre_gso.sh b/tools/testing/selftests/net/gre_gso.sh
index facbb0c80443..fdeb44d621eb 100755
--- a/tools/testing/selftests/net/gre_gso.sh
+++ b/tools/testing/selftests/net/gre_gso.sh
@@ -116,17 +116,18 @@ gre_gst_test_checks()
 {
 	local name=$1
 	local addr=$2
+	local proto=$3
 
-	$NS_EXEC nc -kl $port >/dev/null &
+	$NS_EXEC nc $proto -kl $port >/dev/null &
 	PID=$!
 	while ! $NS_EXEC ss -ltn | grep -q $port; do ((i++)); sleep 0.01; done
 
-	cat $TMPFILE | timeout 1 nc $addr $port
+	cat $TMPFILE | timeout 1 nc $proto -N $addr $port
 	log_test $? 0 "$name - copy file w/ TSO"
 
 	ethtool -K veth0 tso off
 
-	cat $TMPFILE | timeout 1 nc $addr $port
+	cat $TMPFILE | timeout 1 nc $proto -N $addr $port
 	log_test $? 0 "$name - copy file w/ GSO"
 
 	ethtool -K veth0 tso on
@@ -155,7 +156,7 @@ gre6_gso_test()
 	sleep 2
 
 	gre_gst_test_checks GREv6/v4 172.16.2.2
-	gre_gst_test_checks GREv6/v6 2001:db8:1::2
+	gre_gst_test_checks GREv6/v6 2001:db8:1::2 -6
 
 	cleanup
 }
-- 
2.32.0


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

* Re: [PATCH] selftests: net: properly support IPv6 in GSO GRE test
  2021-11-04 10:46 [PATCH] selftests: net: properly support IPv6 in GSO GRE test Andrea Righi
@ 2021-11-04 11:30 ` patchwork-bot+netdevbpf
  2021-11-11 15:20 ` Jakub Kicinski
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-11-04 11:30 UTC (permalink / raw)
  To: Andrea Righi; +Cc: shuah, davem, kuba, linux-kselftest, netdev, linux-kernel

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Thu,  4 Nov 2021 11:46:13 +0100 you wrote:
> Explicitly pass -6 to netcat when the test is using IPv6 to prevent
> failures.
> 
> Also make sure to pass "-N" to netcat to close the socket after EOF on
> the client side, otherwise we would always hit the timeout and the test
> would fail.
> 
> [...]

Here is the summary with links:
  - selftests: net: properly support IPv6 in GSO GRE test
    https://git.kernel.org/netdev/net/c/a985442fdecb

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* Re: [PATCH] selftests: net: properly support IPv6 in GSO GRE test
  2021-11-04 10:46 [PATCH] selftests: net: properly support IPv6 in GSO GRE test Andrea Righi
  2021-11-04 11:30 ` patchwork-bot+netdevbpf
@ 2021-11-11 15:20 ` Jakub Kicinski
  2021-11-11 15:31   ` Andrea Righi
  1 sibling, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2021-11-11 15:20 UTC (permalink / raw)
  To: Andrea Righi
  Cc: Shuah Khan, David S . Miller, linux-kselftest, netdev, linux-kernel

On Thu,  4 Nov 2021 11:46:13 +0100 Andrea Righi wrote:
> Explicitly pass -6 to netcat when the test is using IPv6 to prevent
> failures.
> 
> Also make sure to pass "-N" to netcat to close the socket after EOF on
> the client side, otherwise we would always hit the timeout and the test
> would fail.
> 
> Without this fix applied:
> 
>  TEST: GREv6/v4 - copy file w/ TSO                                   [FAIL]
>  TEST: GREv6/v4 - copy file w/ GSO                                   [FAIL]
>  TEST: GREv6/v6 - copy file w/ TSO                                   [FAIL]
>  TEST: GREv6/v6 - copy file w/ GSO                                   [FAIL]
> 
> With this fix applied:
> 
>  TEST: GREv6/v4 - copy file w/ TSO                                   [ OK ]
>  TEST: GREv6/v4 - copy file w/ GSO                                   [ OK ]
>  TEST: GREv6/v6 - copy file w/ TSO                                   [ OK ]
>  TEST: GREv6/v6 - copy file w/ GSO                                   [ OK ]
> 
> Fixes: 025efa0a82df ("selftests: add simple GSO GRE test")
> Signed-off-by: Andrea Righi <andrea.righi@canonical.com>

This breaks the test for me on Fedora now :(

nc: invalid option -- 'N'
Ncat: Try `--help' or man(1) ncat for more information, usage options and help. QUITTING.
    TEST: GREv6/v4 - copy file w/ TSO                                   [FAIL]
nc: invalid option -- 'N'
Ncat: Try `--help' or man(1) ncat for more information, usage options and help. QUITTING.
    TEST: GREv6/v4 - copy file w/ GSO                                   [FAIL]
nc: invalid option -- 'N'
Ncat: Try `--help' or man(1) ncat for more information, usage options and help. QUITTING.
    TEST: GREv6/v6 - copy file w/ TSO                                   [FAIL]
nc: invalid option -- 'N'
Ncat: Try `--help' or man(1) ncat for more information, usage options and help. QUITTING.
    TEST: GREv6/v6 - copy file w/ GSO                                   [FAIL]

Tests passed:   0
Tests failed:   4


Can you please test this on your distro?

--->8-----

diff --git a/tools/testing/selftests/net/gre_gso.sh b/tools/testing/selftests/net/gre_gso.sh
index fdeb44d621eb..3224651db97b 100755
--- a/tools/testing/selftests/net/gre_gso.sh
+++ b/tools/testing/selftests/net/gre_gso.sh
@@ -118,16 +118,18 @@ gre_gst_test_checks()
 	local addr=$2
 	local proto=$3
 
-	$NS_EXEC nc $proto -kl $port >/dev/null &
+	[ "$proto" == 6 ] && addr="[$addr]"
+
+	$NS_EXEC socat - tcp${proto}-listen:$port,reuseaddr,fork >/dev/null &
 	PID=$!
 	while ! $NS_EXEC ss -ltn | grep -q $port; do ((i++)); sleep 0.01; done
 
-	cat $TMPFILE | timeout 1 nc $proto -N $addr $port
+	cat $TMPFILE | timeout 1 socat -u STDIN TCP:$addr:$port
 	log_test $? 0 "$name - copy file w/ TSO"
 
 	ethtool -K veth0 tso off
 
-	cat $TMPFILE | timeout 1 nc $proto -N $addr $port
+	cat $TMPFILE | timeout 1 socat -u STDIN TCP:$addr:$port
 	log_test $? 0 "$name - copy file w/ GSO"
 
 	ethtool -K veth0 tso on
@@ -155,8 +157,8 @@ gre6_gso_test()
 
 	sleep 2
 
-	gre_gst_test_checks GREv6/v4 172.16.2.2
-	gre_gst_test_checks GREv6/v6 2001:db8:1::2 -6
+	gre_gst_test_checks GREv6/v4 172.16.2.2 4
+	gre_gst_test_checks GREv6/v6 2001:db8:1::2 6
 
 	cleanup
 }
@@ -212,8 +214,8 @@ if [ ! -x "$(command -v ip)" ]; then
 	exit $ksft_skip
 fi
 
-if [ ! -x "$(command -v nc)" ]; then
-	echo "SKIP: Could not run test without nc tool"
+if [ ! -x "$(command -v socat)" ]; then
+	echo "SKIP: Could not run test without socat tool"
 	exit $ksft_skip
 fi
 

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

* Re: [PATCH] selftests: net: properly support IPv6 in GSO GRE test
  2021-11-11 15:20 ` Jakub Kicinski
@ 2021-11-11 15:31   ` Andrea Righi
  0 siblings, 0 replies; 4+ messages in thread
From: Andrea Righi @ 2021-11-11 15:31 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Shuah Khan, David S . Miller, linux-kselftest, netdev, linux-kernel

On Thu, Nov 11, 2021 at 07:20:48AM -0800, Jakub Kicinski wrote:
> On Thu,  4 Nov 2021 11:46:13 +0100 Andrea Righi wrote:
> > Explicitly pass -6 to netcat when the test is using IPv6 to prevent
> > failures.
> > 
> > Also make sure to pass "-N" to netcat to close the socket after EOF on
> > the client side, otherwise we would always hit the timeout and the test
> > would fail.
> > 
> > Without this fix applied:
> > 
> >  TEST: GREv6/v4 - copy file w/ TSO                                   [FAIL]
> >  TEST: GREv6/v4 - copy file w/ GSO                                   [FAIL]
> >  TEST: GREv6/v6 - copy file w/ TSO                                   [FAIL]
> >  TEST: GREv6/v6 - copy file w/ GSO                                   [FAIL]
> > 
> > With this fix applied:
> > 
> >  TEST: GREv6/v4 - copy file w/ TSO                                   [ OK ]
> >  TEST: GREv6/v4 - copy file w/ GSO                                   [ OK ]
> >  TEST: GREv6/v6 - copy file w/ TSO                                   [ OK ]
> >  TEST: GREv6/v6 - copy file w/ GSO                                   [ OK ]
> > 
> > Fixes: 025efa0a82df ("selftests: add simple GSO GRE test")
> > Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
> 
> This breaks the test for me on Fedora now :(

Oops, sorry about that.

> 
> nc: invalid option -- 'N'
> Ncat: Try `--help' or man(1) ncat for more information, usage options and help. QUITTING.
>     TEST: GREv6/v4 - copy file w/ TSO                                   [FAIL]
> nc: invalid option -- 'N'
> Ncat: Try `--help' or man(1) ncat for more information, usage options and help. QUITTING.
>     TEST: GREv6/v4 - copy file w/ GSO                                   [FAIL]
> nc: invalid option -- 'N'
> Ncat: Try `--help' or man(1) ncat for more information, usage options and help. QUITTING.
>     TEST: GREv6/v6 - copy file w/ TSO                                   [FAIL]
> nc: invalid option -- 'N'
> Ncat: Try `--help' or man(1) ncat for more information, usage options and help. QUITTING.
>     TEST: GREv6/v6 - copy file w/ GSO                                   [FAIL]
> 
> Tests passed:   0
> Tests failed:   4
> 
> 
> Can you please test this on your distro?

Tested, it works fine in Ubuntu as well:

$ sudo ./tools/testing/selftests/net/gre_gso.sh
    TEST: GREv6/v4 - copy file w/ TSO                                   [ OK ]
    TEST: GREv6/v4 - copy file w/ GSO                                   [ OK ]
    TEST: GREv6/v6 - copy file w/ TSO                                   [ OK ]
    TEST: GREv6/v6 - copy file w/ GSO                                   [ OK ]

Tests passed:   4
Tests failed:   0

Tested-by: Andrea Righi <andrea.righi@canonical.com>

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

end of thread, other threads:[~2021-11-11 15:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-04 10:46 [PATCH] selftests: net: properly support IPv6 in GSO GRE test Andrea Righi
2021-11-04 11:30 ` patchwork-bot+netdevbpf
2021-11-11 15:20 ` Jakub Kicinski
2021-11-11 15:31   ` Andrea Righi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).