]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
IPv4-only mode fixes on rev10662
authorAmos Jeffries <squid3@treenet.co.nz>
Sun, 25 Jul 2010 13:49:07 +0000 (01:49 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 25 Jul 2010 13:49:07 +0000 (01:49 +1200)
* get IP probe fro v4-mapping right.

* only open http_port on IPv4 when IPv6 is disabled but available.

src/cache_cf.cc
src/ip/tools.cc

index e5557c45f9eda587851b756a44e6b575e8e4f99b..968c932e8ca0a9f0fe0ffacca529388223e9c120 100644 (file)
@@ -3126,14 +3126,20 @@ parse_http_port_specification(http_port_list * s, char *token)
     if (NULL == host) {
         s->s.SetAnyAddr();
         s->s.SetPort(port);
+        if (!Ip::EnableIpv6)
+            s->s.SetIPv4();
         debugs(3, 3, "http(s)_port: found Listen on wildcard address: *:" << s->s.GetPort() );
     } else if ( s->s = host ) { /* check/parse numeric IPA */
         s->s.SetPort(port);
+        if (!Ip::EnableIpv6)
+            s->s.SetIPv4();
         debugs(3, 3, "http(s)_port: Listen on Host/IP: " << host << " --> " << s->s);
     } else if ( s->s.GetHostByName(host) ) { /* check/parse for FQDN */
         /* dont use ipcache */
         s->defaultsite = xstrdup(host);
         s->s.SetPort(port);
+        if (!Ip::EnableIpv6)
+            s->s.SetIPv4();
         debugs(3, 3, "http(s)_port: found Listen as Host " << s->defaultsite << " on IP: " << s->s);
     } else {
         debugs(3, 0, "http(s)_port: failed to resolve Host/IP: " << host);
index 50ceb1163871e43841fce0def2055f1260d53891..20a6c16281eec0d7d59843e5a0ca2fcf3ba1a53a 100644 (file)
@@ -62,7 +62,7 @@ Ip::ProbeTransport()
 
     // Test for v4-mapping capability
     int tos = 0;
-    if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, (char *) &tos, sizeof(int)) < 0) {
+    if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, (char *) &tos, sizeof(int)) == 0) {
         debugs(3, 2, "Detected IPv6 hybrid or v4-mapping stack...");
         EnableIpv6 |= IPV6_SPECIAL_V4MAPPING;
     } else {