Skip Menu |
 

Subject: IPv6 pktinfo not used in Linux build
For reasons not yet clear to me, a Linux build environment (e.g. Ubuntu
12.04 or 14.04):

* declares struct in6_pktinfo in <netinet/in.h> only if __USE_GNU is
defined, which is only the case if _GNU_SOURCE is defined by the
compiled code.

* declares struct ip_pktinfo in <bits/in.h> (included by netinet/in.h)
if either __USE_GNU or __USE_MISC is defined. The latter is true by
default because _BSD_SOURCE is defined by default (if no other feature
macros are used).

This makes little sense to be, since the IPv6 pktinfo API is specified
in RFC 3542, while ip_pktinfo is less standardized and I believe
originated in Linux.

The upshot is that we are not using IPv6 pktinfo on Linux, and instead
are creating one UDP listener socket per non-loopback IPv6 interface
address.

Combined with issue #7526, this adds more motivation to use
AC_USE_SYSTEM_EXTENSIONS and deal with any consequent damage (such as
the different behavior of strerror_r). But there are more conservative
workarounds, such as moving the pktinfo code to a separate file and
defining _GNU_SOURCE in that file.
I reopened https://sourceware.org/bugzilla/show_bug.cgi?id=6775 in an
attempt to get IPv6 pktinfo to be part of the default netinet/in.h
namespace on Linux. I think I have reasonably good arguments, but I
still don't have a lot of hope, if the attitude is "everyone should be
using _GNU_SOURCE".