From: Amos Jeffries Date: Sat, 7 Aug 2010 03:45:03 +0000 (+1200) Subject: Bug 3006: IPV6_V6ONLY definition missing - Solaris 9 - SunStudio 12.0 X-Git-Tag: take1~417 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ca44fd48ffae9775ffd96c3afbc135cdab768ab1;p=thirdparty%2Fsquid.git Bug 3006: IPV6_V6ONLY definition missing - Solaris 9 - SunStudio 12.0 Solaris 9 is not fully RFC 3493 compliant. It does not provide the IPV6_V6ONLY even as a null-op option. There are potentially other systems in the same situation. Fix is to detect the absence of the option and fall back to split-stack on IPv6-enabled systems without it. --- diff --git a/src/ip/tools.cc b/src/ip/tools.cc index 94c1d55002..e930331e09 100644 --- a/src/ip/tools.cc +++ b/src/ip/tools.cc @@ -62,6 +62,8 @@ Ip::ProbeTransport() } // Test for v4-mapping capability + // (AKA. the operating system supports RFC 3493 section 5.3) +#if defined(IPV6_V6ONLY) int tos = 0; if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, (char *) &tos, sizeof(int)) == 0) { debugs(3, 2, "Detected IPv6 hybrid or v4-mapping stack..."); @@ -70,6 +72,12 @@ Ip::ProbeTransport() debugs(3, 2, "Detected split IPv4 and IPv6 stacks ..."); EnableIpv6 |= IPV6_SPECIAL_SPLITSTACK; } +#else + // compliance here means they at least supply the option for compilers building code + // even if possibly to return hard-coded -1 on use. + debugs(3, 2, "Missing RFC 3493 compliance - attempting split IPv4 and IPv6 stacks ..."); + EnableIpv6 |= IPV6_SPECIAL_SPLITSTACK; +#endif close(s); debugs(3, 2, "IPv6 transport " << (EnableIpv6?"Enabled":"Disabled"));