summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2015-07-17 15:23:59 +0000
committerguenther <guenther@openbsd.org>2015-07-17 15:23:59 +0000
commit028dbc3c784e6977b34470dc3019099934cf48d7 (patch)
treeceed41bf11cabd548c88db177d3d7f675581efaa
parentRemove spaces before the double semicolons in case-blocks. (diff)
downloadwireguard-openbsd-028dbc3c784e6977b34470dc3019099934cf48d7.tar.xz
wireguard-openbsd-028dbc3c784e6977b34470dc3019099934cf48d7.zip
In socketpair(), need to mask the type argument when testing for dgram.
based on jeremy@'s diff ok jeremy@ deraadt@
-rw-r--r--sys/kern/uipc_syscalls.c4
-rw-r--r--sys/sys/socket.h5
2 files changed, 6 insertions, 3 deletions
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index 2bbe4c87c18..fcd37c8ccd4 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_syscalls.c,v 1.102 2015/05/21 13:35:15 nicm Exp $ */
+/* $OpenBSD: uipc_syscalls.c,v 1.103 2015/07/17 15:23:59 guenther Exp $ */
/* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */
/*
@@ -403,7 +403,7 @@ sys_socketpair(struct proc *p, void *v, register_t *retval)
}
if ((error = soconnect2(so1, so2)) != 0)
goto free4;
- if (SCARG(uap, type) == SOCK_DGRAM) {
+ if ((SCARG(uap, type) & SOCK_TYPE_MASK) == SOCK_DGRAM) {
/*
* Datagram socket connection is asymmetric.
*/
diff --git a/sys/sys/socket.h b/sys/sys/socket.h
index 51cd1221f42..8ecfaf34d8c 100644
--- a/sys/sys/socket.h
+++ b/sys/sys/socket.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: socket.h,v 1.87 2015/01/21 02:23:14 guenther Exp $ */
+/* $OpenBSD: socket.h,v 1.88 2015/07/17 15:23:59 guenther Exp $ */
/* $NetBSD: socket.h,v 1.14 1996/02/09 18:25:36 christos Exp $ */
/*
@@ -68,6 +68,9 @@ typedef __sa_family_t sa_family_t; /* sockaddr address family type */
#define SOCK_RAW 3 /* raw-protocol interface */
#define SOCK_RDM 4 /* reliably-delivered message */
#define SOCK_SEQPACKET 5 /* sequenced packet stream */
+#ifdef _KERNEL
+#define SOCK_TYPE_MASK 0x000F /* mask that covers the above */
+#endif
/*
* Socket creation flags