From: Amos Jeffries Date: Sun, 25 Jul 2010 13:49:07 +0000 (+1200) Subject: IPv4-only mode fixes on rev10662 X-Git-Tag: SQUID_3_2_0_1~33 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6df7ad5697768941748f2e6de548ee485c8dbd2c;p=thirdparty%2Fsquid.git IPv4-only mode fixes on rev10662 * get IP probe fro v4-mapping right. * only open http_port on IPv4 when IPv6 is disabled but available. --- diff --git a/src/cache_cf.cc b/src/cache_cf.cc index e5557c45f9..968c932e8c 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -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); diff --git a/src/ip/tools.cc b/src/ip/tools.cc index 50ceb11638..20a6c16281 100644 --- a/src/ip/tools.cc +++ b/src/ip/tools.cc @@ -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 {