From: Amos Jeffries Date: Sun, 8 Aug 2010 12:43:00 +0000 (+1200) Subject: Merge from trunk X-Git-Tag: take08~55^2~124^2~88 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7803fd54336397e85194223fccca80f1a764fbd7;p=thirdparty%2Fsquid.git Merge from trunk --- 7803fd54336397e85194223fccca80f1a764fbd7 diff --cc src/comm/ListenStateData.cc index 1cd7b36fd3,8c03c56161..10980d8d9f --- a/src/comm/ListenStateData.cc +++ b/src/comm/ListenStateData.cc @@@ -299,17 -264,12 +299,13 @@@ Comm::ListenStateData::oldAccept(Comm:: fdd_table[sock].close_line = 0; fde *F = &fd_table[sock]; - details.peer.NtoA(F->ipaddr,MAX_IPSTRLEN); - F->remote_port = details.peer.GetPort(); - F->local_addr.SetPort(details.me.GetPort()); - F->sock_family = details.me.IsIPv6()?AF_INET6:AF_INET; - details.me.FreeAddrInfo(gai); + details.remote.NtoA(F->ipaddr,MAX_IPSTRLEN); + F->remote_port = details.remote.GetPort(); + F->local_addr = details.local; - #if USE_IPV6 - F->sock_family = AF_INET; - #else - F->sock_family = details.local.IsIPv4()?AF_INET:AF_INET6; - #endif ++ F->sock_family = details.local.IsIPv6()?AF_INET6:AF_INET; + // set socket flags + commSetCloseOnExec(sock); commSetNonBlocking(sock); /* IFF the socket is (tproxy) transparent, pass the flag down to allow spoofing */ diff --cc src/dns_internal.cc index f20d643d85,c709ddbc3f..661f3bcb37 --- a/src/dns_internal.cc +++ b/src/dns_internal.cc @@@ -32,16 -33,17 +32,17 @@@ * */ -#include "config.h" #include "squid.h" -#include "event.h" #include "CacheManager.h" -#include "SquidTime.h" -#include "Store.h" +#include "comm/Connection.h" +#include "comm/ConnOpener.h" #include "comm.h" +#include "event.h" #include "fde.h" + #include "ip/tools.h" #include "MemBuf.h" - +#include "SquidTime.h" +#include "Store.h" #include "wordlist.h" #if HAVE_ARPA_NAMESER_H diff --cc src/forward.cc index 9b9ed85b2e,41461410ca..2c577acbda --- a/src/forward.cc +++ b/src/forward.cc @@@ -52,9 -48,9 +52,10 @@@ #include "Store.h" #include "icmp/net_db.h" #include "ip/Intercept.h" + #include "ip/tools.h" -static PSC fwdStartCompleteWrapper; + +static PSC fwdPeerSelectionCompleteWrapper; static PF fwdServerClosedWrapper; #if USE_SSL static PF fwdNegotiateSSLWrapper; diff --cc src/ftp.cc index 50a2ed2024,33a8cb8791..ef997408b5 --- a/src/ftp.cc +++ b/src/ftp.cc @@@ -2351,23 -2343,22 +2353,22 @@@ ftpReadEPSV(FtpStateData* ftpState ftpState->state = SENT_EPSV_2; /* simulate having sent and failed EPSV 2 */ ftpSendPassive(ftpState); } else if (strcmp(buf, "(2)") == 0) { - #if USE_IPV6 - /* If server only supports EPSV 2 and we have already tried that. Go straight to EPRT */ - if (ftpState->state == SENT_EPSV_2) { - ftpSendEPRT(ftpState); + if (Ip::EnableIpv6) { + /* If server only supports EPSV 2 and we have already tried that. Go straight to EPRT */ + if (ftpState->state == SENT_EPSV_2) { + ftpSendEPRT(ftpState); + } else { + /* or try the next Passive mode down the chain. */ + ftpSendPassive(ftpState); + } } else { - /* or try the next Passive mode down the chain. */ + /* Server only accept EPSV in IPv6 traffic. */ + ftpState->state = SENT_EPSV_1; /* simulate having sent and failed EPSV 1 */ ftpSendPassive(ftpState); } - #else - /* We do not support IPv6. Remote server requires it. - So we must simulate having failed all EPSV methods. */ - ftpState->state = SENT_EPSV_1; - ftpSendPassive(ftpState); - #endif } else { /* handle broken server (RFC 2428 says MUST specify supported protocols in 522) */ - debugs(9, DBG_IMPORTANT, "WARNING: Server at " << fd_table[ftpState->ctrl.fd].ipaddr << " sent unknown protocol negotiation hint: " << buf); + debugs(9, DBG_IMPORTANT, "WARNING: Server at " << ftpState->ctrl.conn->remote << " sent unknown protocol negotiation hint: " << buf); ftpSendPassive(ftpState); } return; @@@ -2531,16 -2528,14 +2532,14 @@@ ftpSendPassive(FtpStateData * ftpState /* block other non-EPSV connections being attempted */ ftpState->flags.epsv_all_sent = true; } else { - #if USE_IPV6 - if (addr.IsIPv6()) { - debugs(9, 5, HERE << "FTP Channel (" << addr << "). Sending default EPSV 2"); - snprintf(cbuf, 1024, "EPSV 2\r\n"); + if (ftpState->ctrl.conn->local.IsIPv6()) { + debugs(9, 5, HERE << "FTP Channel (" << ftpState->ctrl.conn->remote << "). Sending default EPSV 2"); + snprintf(cbuf, CTRL_BUFLEN, "EPSV 2\r\n"); ftpState->state = SENT_EPSV_2; } - #endif - if (addr.IsIPv4()) { - debugs(9, 5, HERE << "Channel (" << addr <<"). Sending default EPSV 1"); - snprintf(cbuf, 1024, "EPSV 1\r\n"); + if (ftpState->ctrl.conn->local.IsIPv4()) { + debugs(9, 5, HERE << "Channel (" << ftpState->ctrl.conn->remote <<"). Sending default EPSV 1"); + snprintf(cbuf, CTRL_BUFLEN, "EPSV 1\r\n"); ftpState->state = SENT_EPSV_1; } } diff --cc src/icp_v2.cc index b321bc409a,284e3abe3b..5bbc5bd5d4 --- a/src/icp_v2.cc +++ b/src/icp_v2.cc @@@ -36,20 -36,21 +36,21 @@@ */ #include "squid.h" -#include "Store.h" -#include "comm.h" -#include "ICP.h" -#include "HttpRequest.h" -#include "acl/FilledChecklist.h" -#include "acl/Acl.h" #include "AccessLogEntry.h" -#include "wordlist.h" -#include "SquidTime.h" -#include "SwapDir.h" +#include "acl/Acl.h" +#include "acl/FilledChecklist.h" +#include "comm/Connection.h" +#include "HttpRequest.h" #include "icmp/net_db.h" +#include "ICP.h" #include "ip/Address.h" + #include "ip/tools.h" #include "ipc/StartListening.h" #include "rfc1738.h" +#include "Store.h" +#include "SquidTime.h" +#include "SwapDir.h" +#include "wordlist.h" /// dials icpIncomingConnectionOpened call class IcpListeningStartedDialer: public CallDialer, diff --cc src/ipcache.cc index 2f14c6dc21,3210065853..746d265122 --- a/src/ipcache.cc +++ b/src/ipcache.cc @@@ -31,11 -31,11 +31,13 @@@ */ #include "squid.h" + #include "CacheManager.h" #include "cbdata.h" +#include "CacheManager.h" +#include "DnsLookupDetails.h" #include "event.h" #include "ip/Address.h" + #include "ip/tools.h" #include "SquidTime.h" #include "Store.h" #include "wordlist.h" diff --cc src/snmp_core.cc index 1781eedb07,25d4d80a1c..390c7b6168 --- a/src/snmp_core.cc +++ b/src/snmp_core.cc @@@ -33,10 -33,9 +33,10 @@@ #include "acl/FilledChecklist.h" #include "cache_snmp.h" #include "comm.h" +#include "comm/Connection.h" #include "ipc/StartListening.h" - #include "compat/strsep.h" #include "ip/Address.h" + #include "ip/tools.h" #define SNMP_REQUEST_SIZE 4096 #define MAX_PROTOSTAT 5