diff mbox series

[v2,1/1] ipneigh01.sh: Add workaround for ARP timeout

Message ID 20230922155507.604020-1-pvorel@suse.cz
State Changes Requested
Headers show
Series [v2,1/1] ipneigh01.sh: Add workaround for ARP timeout | expand

Commit Message

Petr Vorel Sept. 22, 2023, 3:55 p.m. UTC
From: Xu Senmiao <xusenmiao@huawei.com>

When the ARP status of the rhost is stale,
lhost ping rhost and the lhost deletes the ARP record,
the record in the rhost changes from stale to delay.

Then, the probe request is sent to the lhost, and the lhost ARP
information is updated.

   rhost(10.0.0.1)      lhost(10.0.0.2)
t1 10.0.0.2 STALE       ping 10.0.0.1
                        10.0.0.1 REACHABLE
                        arp -d 10.0.0.1
t2 10.0.0.2 DELAY
t3 probe 10.0.0.2
t4                      10.0.0.1 REACHABLE

Clear the ARP entries of rhost before each round of test.
This fixes an issue where ipneigh01_arp fail due to ARP timeout.

Signed-off-by: Xu Senmiao <xusenmiao@huawei.com>
[ pvorel: use $DEL_CMD ]
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Changes v1->v2:
* Using DEL_CMD to fix working on system without arp installed.

Xu, can you confirm that it fixes your problem?
Also, do you have this problem also on IPv6?
Could you test both arp and ip?
Also, do you have any idea why rhost get stale?

Kind regards,
Petr

 testcases/network/tcp_cmds/ipneigh/ipneigh01.sh | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Richard Palethorpe Nov. 23, 2023, 10:59 a.m. UTC | #1
Hello

Petr Vorel <pvorel@suse.cz> writes:

> From: Xu Senmiao <xusenmiao@huawei.com>
>
> When the ARP status of the rhost is stale,
> lhost ping rhost and the lhost deletes the ARP record,
> the record in the rhost changes from stale to delay.
>
> Then, the probe request is sent to the lhost, and the lhost ARP
> information is updated.
>
>    rhost(10.0.0.1)      lhost(10.0.0.2)
> t1 10.0.0.2 STALE       ping 10.0.0.1
>                         10.0.0.1 REACHABLE
>                         arp -d 10.0.0.1
> t2 10.0.0.2 DELAY
> t3 probe 10.0.0.2
> t4                      10.0.0.1 REACHABLE
>
> Clear the ARP entries of rhost before each round of test.
> This fixes an issue where ipneigh01_arp fail due to ARP timeout.
>
> Signed-off-by: Xu Senmiao <xusenmiao@huawei.com>
> [ pvorel: use $DEL_CMD ]
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> Changes v1->v2:
> * Using DEL_CMD to fix working on system without arp installed.
>
> Xu, can you confirm that it fixes your problem?
> Also, do you have this problem also on IPv6?
> Could you test both arp and ip?
> Also, do you have any idea why rhost get stale?

We need an answer to why the rhost is stale before merging this. It's
not clear that there is a test bug.

I will set this to changes requested in patchwork.

>
> Kind regards,
> Petr
>
>  testcases/network/tcp_cmds/ipneigh/ipneigh01.sh | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/testcases/network/tcp_cmds/ipneigh/ipneigh01.sh b/testcases/network/tcp_cmds/ipneigh/ipneigh01.sh
> index e67ff5cc8..f37241d49 100755
> --- a/testcases/network/tcp_cmds/ipneigh/ipneigh01.sh
> +++ b/testcases/network/tcp_cmds/ipneigh/ipneigh01.sh
> @@ -19,14 +19,14 @@ do_setup()
>  	case $CMD in
>  	ip)
>  		SHOW_CMD="ip neigh show"
> -		DEL_CMD="ROD ip neigh del $(tst_ipaddr rhost) dev $(tst_iface)"
> +		DEL_CMD="ip neigh del $(tst_ipaddr rhost) dev $(tst_iface)"
>  		;;
>  	arp)
>  		if [ -n "$TST_IPV6" ]; then
>  			tst_brk TCONF "'arp' doesn't support IPv6"
>  		fi
>  		SHOW_CMD="arp -an"
> -		DEL_CMD="ROD arp -d $(tst_ipaddr rhost) -i $(tst_iface)"
> +		DEL_CMD="arp -d $(tst_ipaddr rhost) -i $(tst_iface)"
>  		;;
>  	*)
>  		tst_brk TBROK "unknown or missing command, use -c [ arp | ip ]"
> @@ -56,6 +56,7 @@ do_test()
>  	tst_res TINFO "stress auto-creation $entry_name cache entry deleted with '$CMD' $NUMLOOPS times"
>  
>  	for i in $(seq 1 $NUMLOOPS); do
> +		$DEL_CMD
>  
>  		ping$TST_IPV6 -q -c1 $(tst_ipaddr rhost) -I $(tst_iface) > /dev/null || \
>  			tst_brk TFAIL "cannot ping $(tst_ipaddr rhost)"
> @@ -74,7 +75,7 @@ do_test()
>  		[ "$ret" -ne 0 ] && \
>  			tst_brk TFAIL "$entry_name entry '$(tst_ipaddr rhost)' not listed"
>  
> -		$DEL_CMD
> +		ROD $DEL_CMD
>  
>  		$SHOW_CMD | grep -q "$(tst_ipaddr rhost).*$(tst_hwaddr rhost)" && \
>  			tst_brk TFAIL "'$DEL_CMD' failed, entry has " \
> -- 
> 2.40.1
diff mbox series

Patch

diff --git a/testcases/network/tcp_cmds/ipneigh/ipneigh01.sh b/testcases/network/tcp_cmds/ipneigh/ipneigh01.sh
index e67ff5cc8..f37241d49 100755
--- a/testcases/network/tcp_cmds/ipneigh/ipneigh01.sh
+++ b/testcases/network/tcp_cmds/ipneigh/ipneigh01.sh
@@ -19,14 +19,14 @@  do_setup()
 	case $CMD in
 	ip)
 		SHOW_CMD="ip neigh show"
-		DEL_CMD="ROD ip neigh del $(tst_ipaddr rhost) dev $(tst_iface)"
+		DEL_CMD="ip neigh del $(tst_ipaddr rhost) dev $(tst_iface)"
 		;;
 	arp)
 		if [ -n "$TST_IPV6" ]; then
 			tst_brk TCONF "'arp' doesn't support IPv6"
 		fi
 		SHOW_CMD="arp -an"
-		DEL_CMD="ROD arp -d $(tst_ipaddr rhost) -i $(tst_iface)"
+		DEL_CMD="arp -d $(tst_ipaddr rhost) -i $(tst_iface)"
 		;;
 	*)
 		tst_brk TBROK "unknown or missing command, use -c [ arp | ip ]"
@@ -56,6 +56,7 @@  do_test()
 	tst_res TINFO "stress auto-creation $entry_name cache entry deleted with '$CMD' $NUMLOOPS times"
 
 	for i in $(seq 1 $NUMLOOPS); do
+		$DEL_CMD
 
 		ping$TST_IPV6 -q -c1 $(tst_ipaddr rhost) -I $(tst_iface) > /dev/null || \
 			tst_brk TFAIL "cannot ping $(tst_ipaddr rhost)"
@@ -74,7 +75,7 @@  do_test()
 		[ "$ret" -ne 0 ] && \
 			tst_brk TFAIL "$entry_name entry '$(tst_ipaddr rhost)' not listed"
 
-		$DEL_CMD
+		ROD $DEL_CMD
 
 		$SHOW_CMD | grep -q "$(tst_ipaddr rhost).*$(tst_hwaddr rhost)" && \
 			tst_brk TFAIL "'$DEL_CMD' failed, entry has " \