Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F158005438
D55840.id173638.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D55840.id173638.diff
View Options
Index: sys/netlink/netlink_socket.c
===================================================================
--- sys/netlink/netlink_socket.c
+++ sys/netlink/netlink_socket.c
@@ -106,11 +106,11 @@
cnt++;
else {
ATF_REQUIRE(errno == EAGAIN);
- ATF_REQUIRE(sizeof(hdr) * cnt > sendspace);
+ ATF_REQUIRE(sizeof(hdr) * cnt >= sendspace);
}
ATF_REQUIRE(ioctl(fd, FIONREAD, &recvavail) != -1);
ATF_REQUIRE(ioctl(fd, FIONWRITE, &sendavail) != -1);
- } while (recvavail <= recvspace - rsize ||
+ } while (recvavail < recvspace ||
sendavail <= sendspace - sizeof(hdr));
return (fd);
@@ -124,7 +124,8 @@
ATF_TC_BODY(overflow, tc)
{
char buf[BUFLEN];
- int fd;
+ socklen_t slen = sizeof(int);
+ int fd, recvspace, recvavail;
fd = fullsocket();
@@ -137,10 +138,17 @@
ATF_REQUIRE(timer_done == 1);
/*
- * Now, reading something from the receive buffer should wake up the
- * taskqueue and send buffer should start getting drained.
+ * Now, reading from the receive buffer should wake up the taskqueue
+ * and the send buffer should start getting drained. The receive
+ * buffer may be slightly over its limit due to in-flight replies, so
+ * drain it below the limit to ensure the taskqueue can proceed.
*/
- ATF_REQUIRE(recv(fd, buf, BUFLEN, 0) > sizeof(hdr));
+ ATF_REQUIRE(getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &recvspace,
+ &slen) == 0);
+ do {
+ ATF_REQUIRE(recv(fd, buf, BUFLEN, 0) > (ssize_t)sizeof(hdr));
+ ATF_REQUIRE(ioctl(fd, FIONREAD, &recvavail) != -1);
+ } while (recvavail >= recvspace);
timer_done = 0;
ATF_REQUIRE(setitimer(ITIMER_REAL, &itv, NULL) == 0);
ATF_REQUIRE(send(fd, &hdr, sizeof(hdr), 0) == sizeof(hdr));
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, May 28, 10:06 AM (20 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33583127
Default Alt Text
D55840.id173638.diff (1 KB)
Attached To
Mode
D55840: tests/netlink: fix flaky netlink_socket:overflow
Attached
Detach File
Event Timeline
Log In to Comment