diff mbox series

[RFC,4/4] network/ipsec: replace ipsec_try() with TST_RTNL_CHK()

Message ID 1533828226-24753-4-git-send-email-alexey.kodanev@oracle.com
State Superseded
Delegated to: Petr Vorel
Headers show
Series [RFC,1/4] lib/tst_test.c: add 'needs_drivers' option with tst_check_drivers cmd | expand

Commit Message

Alexey Kodanev Aug. 9, 2018, 3:23 p.m. UTC
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 testcases/network/stress/ipsec/ipsec_lib.sh |   21 +++------------------
 1 files changed, 3 insertions(+), 18 deletions(-)

Comments

Petr Vorel Aug. 14, 2018, 6:40 p.m. UTC | #1
Hi Alexey,

> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Acked-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/network/stress/ipsec/ipsec_lib.sh |   21 +++------------------
>  1 files changed, 3 insertions(+), 18 deletions(-)


Kind regards,
Petr
Petr Vorel Aug. 16, 2018, 11:16 a.m. UTC | #2
Hi Alexey,

> >> Hi Petr,

> >> Since the server waits for requests from the client, the timeout
> >> value for UDP/DCCP is the same as for the other protocols. Also the
> >> server starts earlier than the client, so it should wait some time
> >> to get the client requests.

> >> I've changed the client side only because either request from the
> >> client or reply from the server might be lost.

> > Thanks for your explanation.
> > I mean: UDP itself is the only protocol which don't support listen() so
> > netstress server using UDP timeouts after some time. The default is 100ms.

> Hmm, for the server the default should be 60 sec. Does it timeout earlier?
Yes. The timeout is affected by value of -m. Thats' what I meant by my previous:
$ date +"%T.%3N"; testcases/network/netstress/netstress -m 1 -T udp; date +"%T.%3N"
15:52:34.501
tst_test.c:1015: INFO: Timeout per run is 0h 05m 00s
The timeout is actually 1ms. Try it with -m 1000 and it'll be indeed 1s
netstress.c:917: INFO: max requests '3'
netstress.c:944: INFO: using UDP
netstress.c:676: INFO: assigning a name to the server socket...
netstress.c:683: INFO: bind to port 47728
netstress.c:575: FAIL: recv failed, sock '3'
netstress.c:642: BROK: Server closed
...
15:52:34.516


This is caused by udp/udp_lite not using listen(), but maybe is should be at
least mentioned in help (if wanted behavior).

Kind regards,
Petr
Petr Vorel Aug. 16, 2018, 11:42 a.m. UTC | #3
Hi Alexey,

> On 07/27/2018 04:01 PM, Alexey Kodanev wrote:
> ...
> >> +	tst_netload -T udp -r 1 -a 1 -H $addr

> > Unfortunately, it won't work this way. tst_netload is using requests/response
> > model for UDP. You have to make sure the server can send responses.

> > Also, netstress UDP/DCCP client allows to pass 'max_etime_cnt' (12) failed
> > requests after which it will double receive timeout, starting from 100ms up to
> > 3.2s. This is about 30 sec if there is no connection. With a single request or
> > below max_etime_cnt + 1 value it will always pass. I guess we need to set the
> > proper request parameter limit for UDP/DCCP protocol or check whether the
> > number of timeout errors is equal or greater than the number of requests.

> Applied the fix for this bug:
> 4ceb442b56ad ("netstress: handle timeout errors for a small number of requests")

Thanks for your explanation and netstress fix.

I'll try to implement it in C, using rtnetlink as we've been talking about in
the past. That should stress the system more than using user space tools.
Maybe for the start with just changing interfaces (without checking by sending
packets).


Kind regards,
Petr
Alexey Kodanev Aug. 16, 2018, 12:01 p.m. UTC | #4
On 08/16/2018 02:16 PM, Petr Vorel wrote:
> Hi Alexey,
> 
>>>> Hi Petr,
> 
>>>> Since the server waits for requests from the client, the timeout
>>>> value for UDP/DCCP is the same as for the other protocols. Also the
>>>> server starts earlier than the client, so it should wait some time
>>>> to get the client requests.
> 
>>>> I've changed the client side only because either request from the
>>>> client or reply from the server might be lost.
> 
>>> Thanks for your explanation.
>>> I mean: UDP itself is the only protocol which don't support listen() so
>>> netstress server using UDP timeouts after some time. The default is 100ms.
> 
>> Hmm, for the server the default should be 60 sec. Does it timeout earlier?
> Yes. The timeout is affected by value of -m. Thats' what I meant by my previous:
> $ date +"%T.%3N"; testcases/network/netstress/netstress -m 1 -T udp; date +"%T.%3N"
> 15:52:34.501
> tst_test.c:1015: INFO: Timeout per run is 0h 05m 00s
> The timeout is actually 1ms. Try it with -m 1000 and it'll be indeed 1s
> netstress.c:917: INFO: max requests '3'
> netstress.c:944: INFO: using UDP
> netstress.c:676: INFO: assigning a name to the server socket...
> netstress.c:683: INFO: bind to port 47728
> netstress.c:575: FAIL: recv failed, sock '3'
> netstress.c:642: BROK: Server closed
> ...
> 15:52:34.516
> 
> 
> This is caused by udp/udp_lite not using listen(), but maybe is should be at
> least mentioned in help (if wanted behavior).

Agree.


Thanks,
Alexey
diff mbox series

Patch

diff --git a/testcases/network/stress/ipsec/ipsec_lib.sh b/testcases/network/stress/ipsec/ipsec_lib.sh
index aedba9b..f850166 100644
--- a/testcases/network/stress/ipsec/ipsec_lib.sh
+++ b/testcases/network/stress/ipsec/ipsec_lib.sh
@@ -157,21 +157,6 @@  ipsec_set_algoline()
 	esac
 }
 
-ipsec_try()
-{
-	local output="$($@ 2>&1 || echo 'TERR')"
-
-	if echo "$output" | grep -q "TERR"; then
-		echo "$output" | grep -q \
-			'RTNETLINK answers: Function not implemented' && \
-			tst_brk TCONF "'$@': not implemented"
-		echo "$output" | grep -q \
-			'RTNETLINK answers: Operation not supported' && \
-			tst_brk TCONF "'$@': not supported (maybe missing 'ip${TST_IPV6}_vti' kernel module)"
-		tst_brk TBROK "$@ failed: $output"
-	fi
-}
-
 # tst_ipsec target src_addr dst_addr: config ipsec
 #
 # target: target of the configuration host ( lhost / rhost )
@@ -195,7 +180,7 @@  tst_ipsec()
 	if [ $target = lhost ]; then
 		local spi_1="0x$SPI"
 		local spi_2="0x$(( $SPI + 1 ))"
-		ipsec_try ip xfrm state add src $src dst $dst spi $spi_1 \
+		TST_RTNL_CHK xfrm state add src $src dst $dst spi $spi_1 \
 			$p $ALG mode $mode sel src $src dst $dst
 		ROD ip xfrm state add src $dst dst $src spi $spi_2 \
 			$p $ALG mode $mode sel src $dst dst $src
@@ -257,12 +242,12 @@  tst_ipsec_vti()
 	cleanup_vti=$vti
 
 	if [ $target = lhost ]; then
-		ipsec_try ip li add $vti $type local $src remote $dst $key $d
+		TST_RTNL_CHK ip li add $vti $type local $src remote $dst $key $d
 		ROD ip li set $vti up
 
 		local spi_1="spi 0x$SPI"
 		local spi_2="spi 0x$(( $SPI + 1 ))"
-		ipsec_try $ipx st add $o_dir $p $spi_1 $ALG $m
+		TST_RTNL_CHK $ipx st add $o_dir $p $spi_1 $ALG $m
 		ROD $ipx st add $i_dir $p $spi_2 $ALG $m
 		ROD $ipx po add dir out tmpl $o_dir $p $m $mrk
 		ROD $ipx po add dir in tmpl $i_dir $p $m $mrk