[LTP] [PATCH] Re: [PATCH] syscalls/setsockopt05: associate receiver with destination address

Martin Doucha mdoucha@suse.cz
Wed Aug 26 12:39:13 CEST 2020


OK, here's the correct test patch. The source port changes on every iteration
so different send() calls shouldn't interfere with one another. If you get
ECONNREFUSED with this patch applied, it's caused by broken implementation
of send(MSG_MORE), not delayed ICMP packets. If this patch prevents the error,
resubmit your patch with fixes.

I'll write the test for send(MSG_MORE) either way because if the flag isn't
honored by the kernel, setsockopt05 will be useless.

---
 testcases/kernel/syscalls/setsockopt/setsockopt05.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/testcases/kernel/syscalls/setsockopt/setsockopt05.c b/testcases/kernel/syscalls/setsockopt/setsockopt05.c
index e78ef236e..698396390 100644
--- a/testcases/kernel/syscalls/setsockopt/setsockopt05.c
+++ b/testcases/kernel/syscalls/setsockopt/setsockopt05.c
@@ -64,6 +64,9 @@ static void run(void)
 
 	for (i = 0; i < 1000; i++) {
 		sock = SAFE_SOCKET(AF_INET, SOCK_DGRAM, 0);
+		addr.sin_port = 12346 + i;
+		SAFE_BIND(sock, (struct sockaddr *)&addr, sizeof(addr));
+		addr.sin_port = 12345;
 		SAFE_CONNECT(sock, (struct sockaddr *)&addr, sizeof(addr));
 		SAFE_SEND(1, sock, buf, BUFSIZE, MSG_MORE);
 		SAFE_SETSOCKOPT_INT(sock, SOL_SOCKET, SO_NO_CHECK, 1);
-- 
2.28.0



More information about the ltp mailing list