git: aa9f97af93fc - main - tests/unix_dgram: account for size of sender address in the filling cycle
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 17 May 2022 02:08:30 UTC
The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=aa9f97af93fc9df5596654fc11f2720878c81e1a commit aa9f97af93fc9df5596654fc11f2720878c81e1a Author: Gleb Smirnoff <glebius@FreeBSD.org> AuthorDate: 2022-05-17 02:04:02 +0000 Commit: Gleb Smirnoff <glebius@FreeBSD.org> CommitDate: 2022-05-17 02:08:21 +0000 tests/unix_dgram: account for size of sender address in the filling cycle This fixes test failure with large net.local.dgram.recvspace values. --- tests/sys/kern/unix_dgram.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/sys/kern/unix_dgram.c b/tests/sys/kern/unix_dgram.c index 66a9ab6092ee..4bcb84587f46 100644 --- a/tests/sys/kern/unix_dgram.c +++ b/tests/sys/kern/unix_dgram.c @@ -54,6 +54,9 @@ static struct sigaction sigact = { /* * Fill socket to a state when next send(len) would fail. + * + * Note that every datagram is prepended with sender address, + * size of struct sockaddr. */ static void fill(int fd, void *buf, ssize_t len) @@ -64,7 +67,9 @@ fill(int fd, void *buf, ssize_t len) ATF_REQUIRE(sysctlbyname("net.local.dgram.recvspace", &recvspace, &llen, NULL, 0) == 0); - for (sent = 0; sent + len < (ssize_t)recvspace; sent += len) + for (sent = 0; + sent + len + sizeof(struct sockaddr) < recvspace; + sent += len + sizeof(struct sockaddr)) ATF_REQUIRE(send(fd, buf, len, 0) == len); }