]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 3006: IPV6_V6ONLY definition missing - Solaris 9 - SunStudio 12.0
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 7 Aug 2010 03:45:03 +0000 (15:45 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 7 Aug 2010 03:45:03 +0000 (15:45 +1200)
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.

src/ip/tools.cc

index 94c1d55002ff3716e72d99d795eaebe5d7516c75..e930331e09d3f5e62c31d8787b630647fe4db39e 100644 (file)
@@ -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"));