summaryrefslogtreecommitdiff
path: root/sys/compat
diff options
context:
space:
mode:
authorPaul Irofti <pirofti@cvs.openbsd.org>2012-06-19 11:28:21 +0000
committerPaul Irofti <pirofti@cvs.openbsd.org>2012-06-19 11:28:21 +0000
commit11a4761d13cb89f1003c70e15b8efff3db92fe3f (patch)
tree91e8e5efbda0d5d8ff3790b9c1a88ea0ebc9b9ec /sys/compat
parentc9360b9533b5cb8349b38fd7ff6ae7f526254ec4 (diff)
Add socket type mask to filter out implementation specific flags.
The newer glibc's, when creating a socket, add some higher bit flags to the type argument that are used for debug, statistics, profiling whatever. They are not useful and implementation specific. This is needed for DNS resolving, otherwise the nss library from glibc will always fail to do the right thing. Okay jasper@
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/linux/linux_socket.c4
-rw-r--r--sys/compat/linux/linux_socket.h5
2 files changed, 6 insertions, 3 deletions
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c
index d17d67811e0..4f1ab4ea55b 100644
--- a/sys/compat/linux/linux_socket.c
+++ b/sys/compat/linux/linux_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_socket.c,v 1.44 2012/04/22 05:43:14 guenther Exp $ */
+/* $OpenBSD: linux_socket.c,v 1.45 2012/06/19 11:28:20 pirofti Exp $ */
/* $NetBSD: linux_socket.c,v 1.14 1996/04/05 00:01:50 christos Exp $ */
/*
@@ -245,7 +245,7 @@ linux_socket(p, v, retval)
return error;
SCARG(&bsa, protocol) = lsa.protocol;
- SCARG(&bsa, type) = lsa.type;
+ SCARG(&bsa, type) = lsa.type & LINUX_SOCKET_TYPE_MASK;
SCARG(&bsa, domain) = linux_to_bsd_domain(lsa.domain);
if (SCARG(&bsa, domain) == -1)
return EINVAL;
diff --git a/sys/compat/linux/linux_socket.h b/sys/compat/linux/linux_socket.h
index 1d22cec0299..98ff2d950ec 100644
--- a/sys/compat/linux/linux_socket.h
+++ b/sys/compat/linux/linux_socket.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_socket.h,v 1.9 2011/12/03 12:38:30 fgsch Exp $ */
+/* $OpenBSD: linux_socket.h,v 1.10 2012/06/19 11:28:20 pirofti Exp $ */
/* $NetBSD: linux_socket.h,v 1.3 1995/05/28 10:16:34 mycroft Exp $ */
/*
@@ -120,6 +120,9 @@
#define LINUX_MSG_WAITALL 0x100
#define LINUX_MSG_NOSIGNAL 0x4000
+/* Mask out extra type-related options */
+#define LINUX_SOCKET_TYPE_MASK 0xf
+
struct linux_sockaddr {
unsigned short sa_family;
char sa_data[14];