Blob Blame History Raw
diff -up squid-3.1.1/src/comm.cc.ipv6_disabled squid-3.1.1/src/comm.cc
--- squid-3.1.1/src/comm.cc.ipv6_disabled	2010-03-29 12:02:56.000000000 +0200
+++ squid-3.1.1/src/comm.cc	2010-04-02 15:31:50.467098739 +0200
@@ -637,6 +637,9 @@ comm_open_listener(int sock_type,
         /* attempt to open this IPv4-only. */
         sock = comm_openex(sock_type, proto, addr, flags, 0, note);
         debugs(50, 2, HERE << "attempt open " << note << " socket on: " << addr);
+	
+	/* disable IPv6 */
+	IpAddress::SetIPv6Disabled(true);
     }
 #endif
 
diff -up squid-3.1.1/src/ip/IpAddress.cc.ipv6_disabled squid-3.1.1/src/ip/IpAddress.cc
--- squid-3.1.1/src/ip/IpAddress.cc.ipv6_disabled	2010-03-29 12:02:56.000000000 +0200
+++ squid-3.1.1/src/ip/IpAddress.cc	2010-04-02 15:44:38.759070488 +0200
@@ -250,6 +250,9 @@ bool IpAddress::IsIPv4() const
 bool IpAddress::IsIPv6() const
 {
 #if USE_IPV6
+    if(m_IPv6Disabled)
+        return false;
+
     return IsAnyAddr() || IsNoAddr() || !IN6_IS_ADDR_V4MAPPED( &m_SocketAddr.sin6_addr );
 #else
     return false; // enforce IPv4 in IPv4-only mode.
@@ -1186,3 +1189,7 @@ bool IpAddress::GetInAddr(struct in_addr
     assert(false);
     return false;
 }
+
+#if USE_IPV6
+bool IpAddress::m_IPv6Disabled = false;
+#endif
diff -up squid-3.1.1/src/ip/IpAddress.h.ipv6_disabled squid-3.1.1/src/ip/IpAddress.h
--- squid-3.1.1/src/ip/IpAddress.h.ipv6_disabled	2010-03-29 12:02:56.000000000 +0200
+++ squid-3.1.1/src/ip/IpAddress.h	2010-04-02 15:42:15.060319653 +0200
@@ -428,6 +428,14 @@ private:
     static const struct in6_addr v4_anyaddr;
     static const struct in6_addr v6_noaddr;
 #endif
+
+/* IPv6 stack can be disabled */
+#if USE_IPV6
+private:
+    static bool m_IPv6Disabled;
+public:
+    static void SetIPv6Disabled(bool state) { m_IPv6Disabled = state; }
+#endif
 };