summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/bits
diff options
context:
space:
mode:
authorCarlos O'Donell <carlos@redhat.com>2013-09-06 01:02:30 -0400
committerCarlos O'Donell <carlos@redhat.com>2013-09-06 01:02:30 -0400
commit6c82a2f8d7c8e21e39237225c819f182ae438db3 (patch)
tree2c64c0c236277386153a7c4561d4ba1f11108a37 /sysdeps/unix/sysv/linux/bits
parent5430fc65a118300b35a834a1112caea3441ff12e (diff)
downloadglibc-6c82a2f8d7c8e21e39237225c819f182ae438db3.tar.gz
glibc-6c82a2f8d7c8e21e39237225c819f182ae438db3.tar.xz
glibc-6c82a2f8d7c8e21e39237225c819f182ae438db3.zip
Coordinate IPv6 definitions for Linux and glibc
This change synchronizes the glibc headers with the Linux kernel
headers and arranges to coordinate the definition of structures
already defined the Linux kernel UAPI headers.

It is now safe to include glibc's netinet/in.h or Linux's linux/in6.h
in any order in a userspace application and you will get the same
ABI. The ABI is guaranteed by UAPI and glibc.
Diffstat (limited to 'sysdeps/unix/sysv/linux/bits')
-rw-r--r--sysdeps/unix/sysv/linux/bits/in.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/bits/in.h b/sysdeps/unix/sysv/linux/bits/in.h
index e959b33eac..d763ce9fc2 100644
--- a/sysdeps/unix/sysv/linux/bits/in.h
+++ b/sysdeps/unix/sysv/linux/bits/in.h
@@ -21,6 +21,18 @@
 # error "Never use <bits/in.h> directly; include <netinet/in.h> instead."
 #endif
 
+/* If the application has already included linux/in6.h from a linux-based
+   kernel then we will not define the IPv6 IPPROTO_* defines, in6_addr (nor the
+   defines), sockaddr_in6, or ipv6_mreq.  The ABI used by the linux-kernel and
+   glibc match exactly.  Neither the linux kernel nor glibc should break this
+   ABI without coordination.  */
+#ifdef _UAPI_LINUX_IN6_H
+/* This is not quite the same API since the kernel always defines s6_addr16 and
+   s6_addr32. This is not a violation of POSIX since POSIX says "at least the
+   following member" and that holds true.  */
+# define __USE_KERNEL_IPV6_DEFS
+#endif
+
 /* Options for use with `getsockopt' and `setsockopt' at the IP level.
    The first word in the comment at the right is the data type used;
    "bool" means a boolean value stored in an `int'.  */