Bug 6775 - Spurious use of __USE_GNU for in6_pktinfo definition
Summary: Spurious use of __USE_GNU for in6_pktinfo definition
Alias: None
Product: glibc
Classification: Unclassified
Component: network (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Ulrich Drepper
Depends on:
Reported: 2008-07-30 07:59 UTC by Francis Dupont
Modified: 2015-08-22 20:31 UTC (History)
2 users (show)

See Also:
Last reconfirmed:
fweimer: security-


Note You need to log in before you can comment on or make changes to this bug.
Description Francis Dupont 2008-07-30 07:59:40 UTC
In libc/inet/netinet/in.h version >= 2.8 the in6_pkinfo structure definition is protected by __USE_GNU
when the structure is a member of the "Advanced Sockets API for IPv6" (RFC 2292 and 3542) which:
 - has nothing to do with GNU
 - is used by many IPv6 applications
So can you fix this before the release?
At our side, we'll try to update the POSIX standard.

Comment 1 Ulrich Drepper 2008-07-30 13:50:25 UTC
This definition is not in POSIX and therefore there must be a feature selector.
 We use __USE_GNU for all the modern extensions which have no history in old BSD
and SysV code.  This has nothing to do with being originated in GNU systems.

Just fix your code to define _GNU_SOURCE.  Every program compiled on Linux
should do that.
Comment 2 Greg Hudson 2014-07-04 15:09:18 UTC
IPv6 pktinfo is specified in RFC 3542, although it is still not part of POSIX.  It is implemented and part of the default namespace of netinet/in.h in Solaris, FreeBSD, the Hurd, OS X, AIX, and HP-UX.  In glibc, it should be protected with __USE_MISC and be available by default.

By contrast, IPv4 pktinfo originated with Linux.  It is now implemented in Solaris and maybe some of the BSDs, but it is much less widely available.  In glibc it is already protected with __USE_MISC and available by default.  That's a good thing, but it demonstrates that glibc is much too conservative about declaring IPv6 pktinfo.

I disagree that all Linux programs should define _GNU_SOURCE.  It breaks strerror_r with respect to POSIX and may cause other issues I don't yet know about.  It's also an extra step which should not be necessary to use extensions available on many other platforms.