public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/5] network/ipsec: fix warning when using wrong option for ipv4
@ 2020-09-24  7:17 Alexey Kodanev
  2020-09-24  7:17 ` [LTP] [PATCH 2/5] network/virt_lib: use test ip version in virt_compare_netperf() Alexey Kodanev
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Alexey Kodanev @ 2020-09-24  7:17 UTC (permalink / raw)
  To: ltp

This patch is fixing the warning in ipsec vti setup:
Warning: nodad option can be set only for IPv6 addresses

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 testcases/network/stress/ipsec/ipsec_lib.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/testcases/network/stress/ipsec/ipsec_lib.sh b/testcases/network/stress/ipsec/ipsec_lib.sh
index d40941d45..198c9315d 100644
--- a/testcases/network/stress/ipsec/ipsec_lib.sh
+++ b/testcases/network/stress/ipsec/ipsec_lib.sh
@@ -295,11 +295,12 @@ tst_ipsec_setup_vti()
 	tst_ipsec_vti lhost $ip_loc $ip_rmt $tst_vti
 	tst_ipsec_vti rhost $ip_rmt $ip_loc $tst_vti
 
-	local mask=
+	local mask address_opt
 	if [ "$TST_IPV6" ]; then
 		ip_loc_tun="${IPV6_NET32_UNUSED}::1";
 		ip_rmt_tun="${IPV6_NET32_UNUSED}::2";
 		mask=64
+		address_opt=nodad
 		ROD ip -6 route add ${IPV6_NET32_UNUSED}::/$mask dev $tst_vti
 	else
 		ip_loc_tun="${IPV4_NET16_UNUSED}.1.1";
@@ -311,6 +312,6 @@ tst_ipsec_setup_vti()
 	tst_res TINFO "Add IPs to vti tunnel, " \
 		       "loc: $ip_loc_tun/$mask, rmt: $ip_rmt_tun/$mask"
 
-	ROD ip a add $ip_loc_tun/$mask dev $tst_vti nodad
+	ROD ip a add $ip_loc_tun/$mask dev $tst_vti $address_opt
 	tst_rhost_run -s -c "ip a add $ip_rmt_tun/$mask dev $tst_vti"
 }
-- 
2.20.1


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

* [LTP] [PATCH 2/5] network/virt_lib: use test ip version in virt_compare_netperf()
  2020-09-24  7:17 [LTP] [PATCH 1/5] network/ipsec: fix warning when using wrong option for ipv4 Alexey Kodanev
@ 2020-09-24  7:17 ` Alexey Kodanev
  2020-09-24  7:17 ` [LTP] [PATCH resend 3/5] network/nsf_lib.sh: TCONF on mount (udp/udp6) failure for Linux v5.6+ Alexey Kodanev
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Alexey Kodanev @ 2020-09-24  7:17 UTC (permalink / raw)
  To: ltp

This will match virtual device underlying ip version.

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 testcases/network/virt/virt_lib.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/testcases/network/virt/virt_lib.sh b/testcases/network/virt/virt_lib.sh
index f488932ff..827829633 100644
--- a/testcases/network/virt/virt_lib.sh
+++ b/testcases/network/virt/virt_lib.sh
@@ -292,10 +292,10 @@ virt_compare_netperf()
 	local vt="$(cat res_ipv4)"
 	local vt6="$(cat res_ipv6)"
 
-	tst_netload -H $ip_remote $opts -d res_ipv4
+	tst_netload -H $(tst_ipaddr rhost) $opts -d res_lan
 
-	local lt="$(cat res_ipv4)"
-	tst_res TINFO "time lan($lt) $virt_type IPv4($vt) and IPv6($vt6) ms"
+	local lt="$(cat res_lan)"
+	tst_res TINFO "time lan IPv${TST_IPVER}($lt) $virt_type IPv4($vt) and IPv6($vt6) ms"
 
 	per=$(( $vt * 100 / $lt - 100 ))
 	per6=$(( $vt6 * 100 / $lt - 100 ))
-- 
2.20.1


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

* [LTP] [PATCH resend 3/5] network/nsf_lib.sh: TCONF on mount (udp/udp6) failure for Linux v5.6+
  2020-09-24  7:17 [LTP] [PATCH 1/5] network/ipsec: fix warning when using wrong option for ipv4 Alexey Kodanev
  2020-09-24  7:17 ` [LTP] [PATCH 2/5] network/virt_lib: use test ip version in virt_compare_netperf() Alexey Kodanev
@ 2020-09-24  7:17 ` Alexey Kodanev
  2020-09-24  7:17 ` [LTP] [PATCH 4/5] network/netstress: replace rand with rand_r() in the client thread Alexey Kodanev
  2020-09-24  7:17 ` [LTP] [PATCH 5/5] network/ipneigh01: use ROD when deleting the entries Alexey Kodanev
  3 siblings, 0 replies; 7+ messages in thread
From: Alexey Kodanev @ 2020-09-24  7:17 UTC (permalink / raw)
  To: ltp

Most likely support is disabled with NFS_DISABLE_UDP_SUPPORT config
option (default y).
commit b24ee6c64ca7 ("NFS: allow deprecation of NFS UDP protocol")

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/network/nfs/nfs_stress/nfs_lib.sh | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh
index e236cd485..1bd057717 100644
--- a/testcases/network/nfs/nfs_stress/nfs_lib.sh
+++ b/testcases/network/nfs/nfs_stress/nfs_lib.sh
@@ -87,11 +87,17 @@ nfs_mount()
 
 	tst_res TINFO "Mounting NFS: $mnt_cmd"
 	if [ -n "$LTP_NETNS" ] && [ -z "$LTP_NFS_NETNS_USE_LO" ]; then
-		tst_rhost_run -s -c "$mnt_cmd"
-		return
+		tst_rhost_run -c "$mnt_cmd"
+	else
+		$mnt_cmd > /dev/null
 	fi
 
-	ROD $mnt_cmd
+	if [ $? -ne 0 ]; then
+		if [ "$type" = "udp" -o "$type" = "udp6" ] && tst_kvcmp -ge 5.6; then
+			tst_brk TCONF "UDP support disabled with the kernel config NFS_DISABLE_UDP_SUPPORT?"
+		fi
+		tst_brk TBROK "mount command failed"
+	fi
 }
 
 nfs_setup()
-- 
2.20.1


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

* [LTP] [PATCH 4/5] network/netstress: replace rand with rand_r() in the client thread
  2020-09-24  7:17 [LTP] [PATCH 1/5] network/ipsec: fix warning when using wrong option for ipv4 Alexey Kodanev
  2020-09-24  7:17 ` [LTP] [PATCH 2/5] network/virt_lib: use test ip version in virt_compare_netperf() Alexey Kodanev
  2020-09-24  7:17 ` [LTP] [PATCH resend 3/5] network/nsf_lib.sh: TCONF on mount (udp/udp6) failure for Linux v5.6+ Alexey Kodanev
@ 2020-09-24  7:17 ` Alexey Kodanev
  2020-09-24  7:17 ` [LTP] [PATCH 5/5] network/ipneigh01: use ROD when deleting the entries Alexey Kodanev
  3 siblings, 0 replies; 7+ messages in thread
From: Alexey Kodanev @ 2020-09-24  7:17 UTC (permalink / raw)
  To: ltp

Store seed per client thread in order to get reproducible results.

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 configure.ac                            |  1 +
 testcases/network/netstress/netstress.c | 33 ++++++++++++++++---------
 2 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/configure.ac b/configure.ac
index 142bfe26e..03e4e09c9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -108,6 +108,7 @@ AC_CHECK_FUNCS_ONCE([ \
     profil \
     pwritev \
     pwritev2 \
+    rand_r \
     readlinkat \
     recvmmsg \
     renameat \
diff --git a/testcases/network/netstress/netstress.c b/testcases/network/netstress/netstress.c
index c5da4d464..e79e64220 100644
--- a/testcases/network/netstress/netstress.c
+++ b/testcases/network/netstress/netstress.c
@@ -31,6 +31,13 @@
 #include "tst_test.h"
 #include "tst_safe_net.h"
 
+#if !defined(HAVE_RAND_R)
+static int rand_r(LTP_ATTRIBUTE_UNUSED unsigned int *seed)
+{
+    return rand();
+}
+#endif
+
 static const int max_msg_len = (1 << 16) - 1;
 static const int min_msg_len = 5;
 
@@ -62,6 +69,7 @@ static const int end_byte	= 0x0a;
 static int init_cln_msg_len	= 32;
 static int init_srv_msg_len	= 128;
 static int max_rand_msg_len;
+static int init_seed;
 
 /*
  * The number of requests from client after
@@ -344,10 +352,11 @@ union net_size_field {
 	uint16_t value;
 };
 
-static void make_client_request(char client_msg[], int *cln_len, int *srv_len)
+static void make_client_request(char client_msg[], int *cln_len, int *srv_len,
+				unsigned int *seed)
 {
 	if (max_rand_msg_len)
-		*cln_len = *srv_len = min_msg_len + rand() % max_rand_msg_len;
+		*cln_len = *srv_len = min_msg_len + rand_r(seed) % max_rand_msg_len;
 
 	memset(client_msg, client_byte, *cln_len);
 	client_msg[0] = start_byte;
@@ -362,7 +371,7 @@ static void make_client_request(char client_msg[], int *cln_len, int *srv_len)
 	client_msg[*cln_len - 1] = end_byte;
 }
 
-void *client_fn(LTP_ATTRIBUTE_UNUSED void *arg)
+void *client_fn(void *id)
 {
 	int cln_len = init_cln_msg_len,
 	    srv_len = init_srv_msg_len;
@@ -371,13 +380,14 @@ void *client_fn(LTP_ATTRIBUTE_UNUSED void *arg)
 	char client_msg[max_msg_len];
 	int i = 0;
 	intptr_t err = 0;
+	unsigned int seed = init_seed ^ (intptr_t)id;
 
 	inf.raddr_len = sizeof(inf.raddr);
 	inf.etime_cnt = 0;
 	inf.timeout = wait_timeout;
 	inf.pmtu_err_cnt = 0;
 
-	make_client_request(client_msg, &cln_len, &srv_len);
+	make_client_request(client_msg, &cln_len, &srv_len, &seed);
 
 	/* connect & send requests */
 	inf.fd = client_connect_send(client_msg, cln_len);
@@ -407,7 +417,7 @@ void *client_fn(LTP_ATTRIBUTE_UNUSED void *arg)
 		}
 
 		if (max_rand_msg_len)
-			make_client_request(client_msg, &cln_len, &srv_len);
+			make_client_request(client_msg, &cln_len, &srv_len, &seed);
 
 		SAFE_SEND(1, inf.fd, client_msg, cln_len, send_flags);
 
@@ -468,9 +478,9 @@ static void client_init(void)
 	family = remote_addrinfo->ai_family;
 
 	clock_gettime(CLOCK_MONOTONIC_RAW, &tv_client_start);
-	int i;
+	intptr_t i;
 	for (i = 0; i < clients_num; ++i)
-		SAFE_PTHREAD_CREATE(&thread_ids[i], 0, client_fn, NULL);
+		SAFE_PTHREAD_CREATE(&thread_ids[i], 0, client_fn, (void *)i);
 }
 
 static void client_run(void)
@@ -496,7 +506,7 @@ static void client_run(void)
 	int msg_len = min_msg_len;
 
 	max_rand_msg_len = 0;
-	make_client_request(client_msg, &msg_len, &msg_len);
+	make_client_request(client_msg, &msg_len, &msg_len, NULL);
 	/* ask server to terminate */
 	client_msg[0] = start_fin_byte;
 	int cfd = client_connect_send(client_msg, msg_len);
@@ -861,10 +871,9 @@ static void setup(void)
 
 	if (max_rand_msg_len) {
 		max_rand_msg_len -= min_msg_len;
-		unsigned int seed = max_rand_msg_len ^ client_max_requests;
-
-		srand(seed);
-		tst_res(TINFO, "srand() seed 0x%x", seed);
+		init_seed = max_rand_msg_len ^ client_max_requests;
+		srand(init_seed); /* in case rand_r() is missing */
+		tst_res(TINFO, "rand start seed 0x%x", init_seed);
 	}
 
 	/* if client_num is not set, use num of processors */
-- 
2.20.1


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

* [LTP] [PATCH 5/5] network/ipneigh01: use ROD when deleting the entries
  2020-09-24  7:17 [LTP] [PATCH 1/5] network/ipsec: fix warning when using wrong option for ipv4 Alexey Kodanev
                   ` (2 preceding siblings ...)
  2020-09-24  7:17 ` [LTP] [PATCH 4/5] network/netstress: replace rand with rand_r() in the client thread Alexey Kodanev
@ 2020-09-24  7:17 ` Alexey Kodanev
  2020-09-30  8:07   ` Petr Vorel
  3 siblings, 1 reply; 7+ messages in thread
From: Alexey Kodanev @ 2020-09-24  7:17 UTC (permalink / raw)
  To: ltp

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 testcases/network/tcp_cmds/ipneigh/ipneigh01.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/testcases/network/tcp_cmds/ipneigh/ipneigh01.sh b/testcases/network/tcp_cmds/ipneigh/ipneigh01.sh
index e15dd708c..6ad987c49 100755
--- a/testcases/network/tcp_cmds/ipneigh/ipneigh01.sh
+++ b/testcases/network/tcp_cmds/ipneigh/ipneigh01.sh
@@ -20,14 +20,14 @@ do_setup()
 	case $CMD in
 	ip)
 		SHOW_CMD="ip neigh show"
-		DEL_CMD="ip neigh del $(tst_ipaddr rhost) dev $(tst_iface)"
+		DEL_CMD="ROD 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 -a"
-		DEL_CMD="arp -d $(tst_ipaddr rhost) -i $(tst_iface)"
+		DEL_CMD="ROD arp -d $(tst_ipaddr rhost) -i $(tst_iface)"
 		;;
 	*)
 		tst_brk TBROK "unknown or missing command, use -c [ arp | ip ]"
@@ -75,7 +75,7 @@ do_test()
 		[ "$ret" -ne 0 ] && \
 			tst_brk TFAIL "$entry_name entry '$(tst_ipaddr rhost)' not listed"
 
-		$DEL_CMD || tst_brk TFAIL "fail to delete entry"
+		$DEL_CMD
 
 		$SHOW_CMD | grep -q "$(tst_ipaddr rhost).*$(tst_hwaddr rhost)" && \
 			tst_brk TFAIL "'$DEL_CMD' failed, entry has " \
-- 
2.20.1


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

* [LTP] [PATCH 5/5] network/ipneigh01: use ROD when deleting the entries
  2020-09-24  7:17 ` [LTP] [PATCH 5/5] network/ipneigh01: use ROD when deleting the entries Alexey Kodanev
@ 2020-09-30  8:07   ` Petr Vorel
  2020-09-30  9:45     ` Alexey Kodanev
  0 siblings, 1 reply; 7+ messages in thread
From: Petr Vorel @ 2020-09-30  8:07 UTC (permalink / raw)
  To: ltp

Hi Alexey,

sorry for late review.

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

I'm going to merge it so it gets into the release (should be done today).

Kind regards,
Petr

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

* [LTP] [PATCH 5/5] network/ipneigh01: use ROD when deleting the entries
  2020-09-30  8:07   ` Petr Vorel
@ 2020-09-30  9:45     ` Alexey Kodanev
  0 siblings, 0 replies; 7+ messages in thread
From: Alexey Kodanev @ 2020-09-30  9:45 UTC (permalink / raw)
  To: ltp

On 30.09.2020 11:07, Petr Vorel wrote:
> Hi Alexey,
> 
> sorry for late review.
> 
> For whole patchset.
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
> 
> I'm going to merge it so it gets into the release (should be done today).

Thank you Petr!

> 
> Kind regards,
> Petr
> 


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

end of thread, other threads:[~2020-09-30  9:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-24  7:17 [LTP] [PATCH 1/5] network/ipsec: fix warning when using wrong option for ipv4 Alexey Kodanev
2020-09-24  7:17 ` [LTP] [PATCH 2/5] network/virt_lib: use test ip version in virt_compare_netperf() Alexey Kodanev
2020-09-24  7:17 ` [LTP] [PATCH resend 3/5] network/nsf_lib.sh: TCONF on mount (udp/udp6) failure for Linux v5.6+ Alexey Kodanev
2020-09-24  7:17 ` [LTP] [PATCH 4/5] network/netstress: replace rand with rand_r() in the client thread Alexey Kodanev
2020-09-24  7:17 ` [LTP] [PATCH 5/5] network/ipneigh01: use ROD when deleting the entries Alexey Kodanev
2020-09-30  8:07   ` Petr Vorel
2020-09-30  9:45     ` Alexey Kodanev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox