summaryrefslogtreecommitdiffstats
path: root/share/man/man3
diff options
context:
space:
mode:
authorotto <otto@openbsd.org>2017-04-03 19:40:43 +0000
committerotto <otto@openbsd.org>2017-04-03 19:40:43 +0000
commitbfa5009d3a8c694c94d5fa97b8dff7f070b74253 (patch)
tree9d05a526b5cd0c460afaef47ff00e7fa1404f7a4 /share/man/man3
parentWSDISPLAY_MAXFONTCOUNT macro was introduced in sys/dev/wscons/wsconsio.h (diff)
downloadwireguard-openbsd-bfa5009d3a8c694c94d5fa97b8dff7f070b74253.tar.xz
wireguard-openbsd-bfa5009d3a8c694c94d5fa97b8dff7f070b74253.zip
Send and receive 1 byte of data in addition to the control message. This is
needed to make the code work in more cases. Sending actually is not really needed, but do it anyway, to avoid confusing mismatch between producer and consumer. Problem noted by Luke Small; ok deraadt@
Diffstat (limited to 'share/man/man3')
-rw-r--r--share/man/man3/CMSG_DATA.316
1 files changed, 14 insertions, 2 deletions
diff --git a/share/man/man3/CMSG_DATA.3 b/share/man/man3/CMSG_DATA.3
index 1beb705b425..309be7ff810 100644
--- a/share/man/man3/CMSG_DATA.3
+++ b/share/man/man3/CMSG_DATA.3
@@ -1,7 +1,7 @@
-.\" $OpenBSD: CMSG_DATA.3,v 1.5 2008/03/24 16:11:07 deraadt Exp $
+.\" $OpenBSD: CMSG_DATA.3,v 1.6 2017/04/03 19:40:43 otto Exp $
.\" Written by Jared Yanovich <jaredy@openbsd.org>
.\" Public domain, July 3, 2005
-.Dd $Mdocdate: March 24 2008 $
+.Dd $Mdocdate: April 3 2017 $
.Dt CMSG_DATA 3
.Os
.Sh NAME
@@ -95,10 +95,16 @@ union {
struct cmsghdr hdr;
unsigned char buf[CMSG_SPACE(sizeof(int))];
} cmsgbuf;
+struct iovec io_vector[1];
+
+io_vector[0].iov_base = &ch;
+io_vector[0].iov_len = 1;
memset(&msg, 0, sizeof(msg));
msg.msg_control = &cmsgbuf.buf;
msg.msg_controllen = sizeof(cmsgbuf.buf);
+msg.msg_iov = io_vector;
+msg.msg_iovlen = 1;
cmsg = CMSG_FIRSTHDR(&msg);
cmsg->cmsg_len = CMSG_LEN(sizeof(int));
@@ -118,10 +124,16 @@ union {
struct cmsghdr hdr;
unsigned char buf[CMSG_SPACE(sizeof(int))];
} cmsgbuf;
+struct iovec io_vector[1];
+
+io_vector[0].iov_base = &ch;
+io_vector[0].iov_len = 1;
memset(&msg, 0, sizeof(msg));
msg.msg_control = &cmsgbuf.buf;
msg.msg_controllen = sizeof(cmsgbuf.buf);
+msg.msg_iov = io_vector;
+msg.msg_iovlen = 1;
if (recvmsg(s, &msg, 0) == -1)
err(1, "recvmsg");