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.
Tested on sample files cooked by my self system utilities from the
iputils rpm and opera. All of them didn't work before this diff and now
do.
Okay?
Index: linux_socket.c
===================================================================
RCS file: /cvs/src/sys/compat/linux/linux_socket.c,v
retrieving revision 1.44
diff -u -p -r1.44 linux_socket.c
--- linux_socket.c 22 Apr 2012 05:43:14 -0000 1.44
+++ linux_socket.c 19 Jun 2012 08:21:09 -0000
@@ -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;
Index: linux_socket.h
===================================================================
RCS file: /cvs/src/sys/compat/linux/linux_socket.h,v
retrieving revision 1.9
diff -u -p -r1.9 linux_socket.h
--- linux_socket.h 3 Dec 2011 12:38:30 -0000 1.9
+++ linux_socket.h 19 Jun 2012 08:21:09 -0000
@@ -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];