20#include <sys/socket.h>
23#include <netinet/in.h>
26#include <netinet/in6.h>
35 int s = socket(PF_INET6, SOCK_STREAM, 0);
37 debugs(3, 2,
"IPv6 not supported on this machine. Auto-Disabled.");
44#if defined(IPV6_V6ONLY)
46 if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, (
char *) &tos,
sizeof(
int)) == 0) {
47 debugs(3, 2,
"Detected IPv6 hybrid or v4-mapping stack...");
50 debugs(3, 2,
"Detected split IPv4 and IPv6 stacks ...");
56 debugs(3, 2,
"Missing RFC 3493 compliance - attempting split IPv4 and IPv6 stacks ...");
64 struct sockaddr_in6 sin;
66 if (bind(s,
reinterpret_cast<struct sockaddr *
>(&sin),
sizeof(sin)) != 0) {
67 debugs(3,
Critical(66),
"WARNING: BCP 177 violation. Detected non-functional IPv6 loopback.");
70 debugs(3, 2,
"Detected functional IPv6 loopback ...");
81 debugs(3,
Critical(67),
"WARNING: BCP 177 violation. IPv6 transport forced OFF by build parameters.");
void getSockAddr(struct sockaddr_storage &addr, const int family) const
#define debugs(SECTION, LEVEL, CONTENT)
void ProbeTransport(void)
Probe to discover IPv6 capabilities.
int EnableIpv6
Whether IPv6 is supported and type of support.