From 6df7ad5697768941748f2e6de548ee485c8dbd2c Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Mon, 26 Jul 2010 01:49:07 +1200 Subject: [PATCH] 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. --- src/cache_cf.cc | 6 ++++++ src/ip/tools.cc | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) 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 { -- 2.47.3