From: yk@y-koj.net
To: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>, Shuah Khan <shuah@kernel.org>
Cc: Yohei Kojima <yk@y-koj.net>,
netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH net 4/5] selftests: net: improve error handling in TFO test
Date: Tue, 30 Dec 2025 03:32:37 +0900 [thread overview]
Message-ID: <7fdfbe8907c7f54ea65ffb4f8cd64cdb291eeedf.1767032397.git.yk@y-koj.net> (raw)
In-Reply-To: <cover.1767032397.git.yk@y-koj.net>
From: Yohei Kojima <yk@y-koj.net>
This commit improves the error handling in TCP Fast Open (TFO) test by
(1) adding the sendto() return value check and (2) changing read() error
handling code to exit with 1.
Signed-off-by: Yohei Kojima <yk@y-koj.net>
---
tools/testing/selftests/net/tfo.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/net/tfo.c b/tools/testing/selftests/net/tfo.c
index 8d82140f0f76..4572eb9b8968 100644
--- a/tools/testing/selftests/net/tfo.c
+++ b/tools/testing/selftests/net/tfo.c
@@ -82,7 +82,8 @@ static void run_server(void)
error(1, errno, "getsockopt(SO_INCOMING_NAPI_ID)");
if (read(connfd, buf, 64) < 0)
- perror("read()");
+ error(1, errno, "read()");
+
fprintf(outfile, "%d\n", opt);
fclose(outfile);
@@ -92,14 +93,17 @@ static void run_server(void)
static void run_client(void)
{
- int fd;
+ int fd, ret;
char *msg = "Hello, world!";
fd = socket(AF_INET6, SOCK_STREAM, 0);
if (fd == -1)
error(1, errno, "socket()");
- sendto(fd, msg, strlen(msg), MSG_FASTOPEN, (struct sockaddr *)&cfg_addr, sizeof(cfg_addr));
+ ret = sendto(fd, msg, strlen(msg), MSG_FASTOPEN,
+ (struct sockaddr *)&cfg_addr, sizeof(cfg_addr));
+ if (ret < 0)
+ error(1, errno, "sendto()");
close(fd);
}
--
2.51.2
next prev parent reply other threads:[~2025-12-29 18:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-29 18:32 [PATCH net 0/5] net: netdevsim: fix inconsistent carrier state after link/unlink yk
2025-12-29 18:32 ` [PATCH net 2/5] selftests: netdevsim: test that linking already-connected devices fails yk
2025-12-29 18:32 ` [PATCH net 3/5] selftests: netdevsim: add carrier state consistency test yk
2025-12-29 18:32 ` yk [this message]
2025-12-29 18:32 ` [PATCH net 5/5] selftests: net: report SKIP if TFO test processes timed out yk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7fdfbe8907c7f54ea65ffb4f8cd64cdb291eeedf.1767032397.git.yk@y-koj.net \
--to=yk@y-koj.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox