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.
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.