]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
IPv6: improve BCP 177 compliance
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 9 Jul 2015 02:50:17 +0000 (19:50 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 9 Jul 2015 02:50:17 +0000 (19:50 -0700)
Always perform the IP transport probes to detect IPv6 availability.

* Accept lack of IPv6 assignment as per normal by auto-disabling IPv6.

* Whine loudly if (and only if) it would have worked but has been
  forced OFF by --disable-ipv6.

src/ip/tools.cc

index faf2bc3307e8f61e5d6354c9815ef635e3151253..061fb33418f64dba9627b75e2f6434313ddd31a2 100644 (file)
@@ -30,7 +30,6 @@ int Ip::EnableIpv6 = IPV6_OFF;
 void
 Ip::ProbeTransport()
 {
-#if USE_IPV6
     // check for usable IPv6 sockets
     int s = socket(PF_INET6, SOCK_STREAM, 0);
     if (s < 0) {
@@ -56,12 +55,18 @@ Ip::ProbeTransport()
     debugs(3, 2, "Missing RFC 3493 compliance - attempting split IPv4 and IPv6 stacks ...");
     EnableIpv6 |= IPV6_SPECIAL_SPLITSTACK;
 #endif
+    // TODO: attempt to use the socket to connect somewhere ?
+    //  needs to be safe to contact and with guaranteed working IPv6 at the other end.
     close(s);
 
+#if USE_IPV6
     debugs(3, 2, "IPv6 transport " << (EnableIpv6?"Enabled":"Disabled"));
 #else
-    debugs(3, 2, "IPv6 transport forced OFF by build parameters.");
-    EnableIpv6 = IPV6_OFF;
+    debugs(3, 2, "IPv6 transport " << (EnableIpv6?"Available":"Disabled"));
+    if (EnableIpv6 != IPV6_OFF) {
+        debugs(3, DBG_CRITICAL, "WARNING: BCP 177 violation. IPv6 transport forced OFF by build parameters.");
+        EnableIpv6 = IPV6_OFF;
+    }
 #endif
 }