diff mbox series

[3/5] network/virt: skip setting neighbour table if tunnel doesn't have hwaddr

Message ID 20201015122056.20715-3-alexey.kodanev@oracle.com
State New
Headers show
Series [1/5] lib/tst_net: add generic tst_netload_compare() | expand

Commit Message

Alexey Kodanev Oct. 15, 2020, 12:20 p.m. UTC
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 testcases/network/virt/virt_lib.sh | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

Petr Vorel Oct. 26, 2020, 7:06 a.m. UTC | #1
Hi Alexey,

good idea.

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

> diff --git a/testcases/network/virt/virt_lib.sh b/testcases/network/virt/virt_lib.sh
> index 80b9bcc90..f62120347 100644
> --- a/testcases/network/virt/virt_lib.sh
> +++ b/testcases/network/virt/virt_lib.sh
> @@ -229,10 +229,13 @@ virt_minimize_timeout()
>  	local mac_loc="$(cat /sys/class/net/ltp_v0/address)"
>  	local mac_rmt="$(tst_rhost_run -c 'cat /sys/class/net/ltp_v0/address')"

> -	ROD_SILENT "ip ne replace $ip_virt_remote lladdr \
> -		    $mac_rmt nud permanent dev ltp_v0"
> -	tst_rhost_run -s -c "ip ne replace $ip_virt_local lladdr \
> -			     $mac_loc nud permanent dev ltp_v0"
> +	if [ "$mac_loc" ]; then
NOTE: I guess it's safe to check only $mac_rmt (and not $mac_rmt)

> +		ROD_SILENT "ip ne replace $ip_virt_remote lladdr \
> +			    $mac_rmt nud permanent dev ltp_v0"
> +		tst_rhost_run -s -c "ip ne replace $ip_virt_local lladdr \
> +				     $mac_loc nud permanent dev ltp_v0"
> +	fi
> +
>  	virt_tcp_syn=$(sysctl -n net.ipv4.tcp_syn_retries)
>  	ROD sysctl -q net.ipv4.tcp_syn_retries=1
>  }

Kind regards,
Petr
diff mbox series

Patch

diff --git a/testcases/network/virt/virt_lib.sh b/testcases/network/virt/virt_lib.sh
index 80b9bcc90..f62120347 100644
--- a/testcases/network/virt/virt_lib.sh
+++ b/testcases/network/virt/virt_lib.sh
@@ -229,10 +229,13 @@  virt_minimize_timeout()
 	local mac_loc="$(cat /sys/class/net/ltp_v0/address)"
 	local mac_rmt="$(tst_rhost_run -c 'cat /sys/class/net/ltp_v0/address')"
 
-	ROD_SILENT "ip ne replace $ip_virt_remote lladdr \
-		    $mac_rmt nud permanent dev ltp_v0"
-	tst_rhost_run -s -c "ip ne replace $ip_virt_local lladdr \
-			     $mac_loc nud permanent dev ltp_v0"
+	if [ "$mac_loc" ]; then
+		ROD_SILENT "ip ne replace $ip_virt_remote lladdr \
+			    $mac_rmt nud permanent dev ltp_v0"
+		tst_rhost_run -s -c "ip ne replace $ip_virt_local lladdr \
+				     $mac_loc nud permanent dev ltp_v0"
+	fi
+
 	virt_tcp_syn=$(sysctl -n net.ipv4.tcp_syn_retries)
 	ROD sysctl -q net.ipv4.tcp_syn_retries=1
 }