mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH] support including linux inet headers if libc ones are included first
@ 2016-10-18 20:28 Rich Felker
  0 siblings, 0 replies; only message in thread
From: Rich Felker @ 2016-10-18 20:28 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 981 bytes --]

I'd like to apply something like the attached patch to fix the
longstanding issue of kernel network headers conflicting with the libc
ones. I know some people have patched this on the kernel side by
removing the defined(__GLIBC__) check in linux/libc-compat.h, but that
(1) pokes at libc internals, namely the inclusion-guard names, (2)
pretends to work if the kernel headers are included first, but
actually doesn't, and (3) they have glibc-specific logic for some of
the ipv6 fields that are only optionally-exposed, whereas musl always
exposes them (because they're in a reserved namespace).

I have no interest in trying to support the case where the kernel
headers were included first, since they may have all sorts of
gratuitous problems we'd have to work around (and maintain workarounds
for) in their definitions of the types. But simply suppressing the
kernel headers' definitions of network types via reserved-namespace
__UAPI_* macros seems reasonable.

Comments?

Rich

[-- Attachment #2: inet-uapi-compat.diff --]
[-- Type: text/plain, Size: 745 bytes --]

diff --git a/include/netinet/in.h b/include/netinet/in.h
index f6bb77b..0d4d04a 100644
--- a/include/netinet/in.h
+++ b/include/netinet/in.h
@@ -385,6 +385,21 @@ struct ip6_mtuinfo {
 
 #define IPV6_RTHDR_TYPE_0       0
 
+#define __UAPI_DEF_IN_ADDR      0
+#define __UAPI_DEF_IN_IPPROTO   0
+#define __UAPI_DEF_IN_PKTINFO   0
+#define __UAPI_DEF_IP_MREQ      0
+#define __UAPI_DEF_SOCKADDR_IN  0
+#define __UAPI_DEF_IN_CLASS     0
+#define __UAPI_DEF_IN6_ADDR     0
+#define __UAPI_DEF_IN6_ADDR_ALT 0
+#define __UAPI_DEF_SOCKADDR_IN6 0
+#define __UAPI_DEF_IPV6_MREQ    0
+#define __UAPI_DEF_IPPROTO_V6   0
+#define __UAPI_DEF_IPV6_OPTIONS 0
+#define __UAPI_DEF_IN6_PKTINFO  0
+#define __UAPI_DEF_IP6_MTUINFO  0
+
 #ifdef __cplusplus
 }
 #endif

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-10-18 20:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-18 20:28 [PATCH] support including linux inet headers if libc ones are included first Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).