PageRenderTime 22ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/net-proxy/squid/files/squid-3.1.6-bug3011.patch

https://github.com/mikehale/portage
Patch | 116 lines | 106 code | 10 blank | 0 comment | 0 complexity | 128dd4707877e77efd982d661a7b2d4e MD5 | raw file
  1. diff -ur ./src/dns_internal.cc /var/tmp/squid-3.1.6/src/dns_internal.cc
  2. --- ./src/dns_internal.cc 2010-08-01 22:01:37.000000000 +0800
  3. +++ /var/tmp/squid-3.1.6/src/dns_internal.cc 2010-08-10 19:31:46.000000000 +0800
  4. @@ -201,10 +201,15 @@
  5. if (A.IsAnyAddr()) {
  6. debugs(78, 0, "WARNING: Squid does not accept " << A << " in DNS server specifications.");
  7. - A = "127.0.0.1";
  8. + A.SetLocalhost();
  9. debugs(78, 0, "Will be using " << A << " instead, assuming you meant that DNS is running on the same machine");
  10. }
  11. + if (!Ip::EnableIpv6 && !A.SetIPv4()) {
  12. + debugs(78, DBG_IMPORTANT, "WARNING: IPv6 is disabled. Discarding " << A << " in DNS server specifications.");
  13. + return;
  14. + }
  15. +
  16. if (nns == nns_alloc) {
  17. int oldalloc = nns_alloc;
  18. ns *oldptr = nameservers;
  19. @@ -742,6 +747,12 @@
  20. else
  21. addr = Config.Addrs.udp_incoming;
  22. + if (nameservers[ns].S.IsIPv4() && !addr.SetIPv4()) {
  23. + debugs(31, DBG_CRITICAL, "ERROR: Cannot contact DNS nameserver " << nameservers[ns].S << " from " << addr);
  24. + addr.SetAnyAddr();
  25. + addr.SetIPv4();
  26. + }
  27. +
  28. vc->queue = new MemBuf;
  29. vc->msg = new MemBuf;
  30. diff -ur ./src/forward.cc /var/tmp/squid-3.1.6/src/forward.cc
  31. --- ./src/forward.cc 2010-08-01 22:01:37.000000000 +0800
  32. +++ /var/tmp/squid-3.1.6/src/forward.cc 2010-08-10 19:31:46.000000000 +0800
  33. @@ -870,9 +870,9 @@
  34. // if IPv6 is disabled try to force IPv4-only outgoing.
  35. if (!Ip::EnableIpv6 && !outgoing.SetIPv4()) {
  36. - debugs(50, 4, "fwdConnectStart: " << xstrerror());
  37. + debugs(50, 4, "fwdConnectStart: IPv6 is Disabled. Cannot connect from " << outgoing);
  38. ErrorState *anErr = errorCon(ERR_CONNECT_FAIL, HTTP_SERVICE_UNAVAILABLE, request);
  39. - anErr->xerrno = errno;
  40. + anErr->xerrno = EAFNOSUPPORT;
  41. fail(anErr);
  42. self = NULL; // refcounted
  43. return;
  44. diff -ur ./src/neighbors.cc /var/tmp/squid-3.1.6/src/neighbors.cc
  45. --- ./src/neighbors.cc 2010-08-01 22:01:38.000000000 +0800
  46. +++ /var/tmp/squid-3.1.6/src/neighbors.cc 2010-08-10 19:49:16.000000000 +0800
  47. @@ -46,6 +46,7 @@
  48. #include "Store.h"
  49. #include "icmp/net_db.h"
  50. #include "ip/IpAddress.h"
  51. +#include "ip/tools.h"
  52. /* count mcast group peers every 15 minutes */
  53. #define MCAST_COUNT_RATE 900
  54. @@ -1387,6 +1388,20 @@
  55. IpAddress temp(getOutgoingAddr(NULL,p));
  56. + // if IPv6 is disabled try to force IPv4-only outgoing.
  57. + if (!Ip::EnableIpv6 && !temp.SetIPv4()) {
  58. + debugs(50, DBG_IMPORTANT, "WARNING: IPv6 is disabled. Failed to use " << temp << " to probe " << p->host);
  59. + return ret;
  60. + }
  61. +
  62. + // if IPv6 is split-stack, prefer IPv4
  63. + if (Ip::EnableIpv6&IPV6_SPECIAL_SPLITSTACK) {
  64. + // NP: This is not a great choice of default,
  65. + // but with the current Internet being IPv4-majority has a higher success rate.
  66. + // if setting to IPv4 fails we dont care, that just means to use IPv6 outgoing.
  67. + temp.SetIPv4();
  68. + }
  69. +
  70. fd = comm_open(SOCK_STREAM, IPPROTO_TCP, temp, COMM_NONBLOCKING, p->host);
  71. if (fd < 0)
  72. diff -ur ./src/tunnel.cc /var/tmp/squid-3.1.6/src/tunnel.cc
  73. --- ./src/tunnel.cc 2010-08-01 22:01:38.000000000 +0800
  74. +++ /var/tmp/squid-3.1.6/src/tunnel.cc 2010-08-10 20:02:46.000000000 +0800
  75. @@ -46,6 +46,7 @@
  76. #include "client_side.h"
  77. #include "MemBuf.h"
  78. #include "http.h"
  79. +#include "ip/tools.h"
  80. class TunnelStateData
  81. {
  82. @@ -641,6 +642,24 @@
  83. statCounter.server.other.requests++;
  84. /* Create socket. */
  85. IpAddress temp = getOutgoingAddr(request,NULL);
  86. +
  87. + // if IPv6 is disabled try to force IPv4-only outgoing.
  88. + if (!Ip::EnableIpv6 && !temp.SetIPv4()) {
  89. + debugs(50, 4, "tunnelStart: IPv6 is Disabled. Tunnel failed from " << temp);
  90. + err = errorCon(ERR_CONNECT_FAIL, HTTP_SERVICE_UNAVAILABLE, request);
  91. + err->xerrno = EAFNOSUPPORT;
  92. + errorSend(fd, err);
  93. + return;
  94. + }
  95. +
  96. + // if IPv6 is split-stack, prefer IPv4
  97. + if (Ip::EnableIpv6&IPV6_SPECIAL_SPLITSTACK) {
  98. + // NP: This is not a great choice of default,
  99. + // but with the current Internet being IPv4-majority has a higher success rate.
  100. + // if setting to IPv4 fails we dont care, that just means to use IPv6 outgoing.
  101. + temp.SetIPv4();
  102. + }
  103. +
  104. int flags = COMM_NONBLOCKING;
  105. if (request->flags.spoof_client_ip) {
  106. flags |= COMM_TRANSPARENT;