From: Amos Jeffries Date: Wed, 9 Apr 2008 13:29:54 +0000 (+1200) Subject: Merged from trunk X-Git-Tag: SQUID_3_1_0_1~49^2~276^2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2b17881e75cf1ad9a43471fa6877c9e975bcac2f;p=thirdparty%2Fsquid.git Merged from trunk --- 2b17881e75cf1ad9a43471fa6877c9e975bcac2f diff --cc src/forward.cc index 124323e87c,bdf589ceb5..19aa34ea96 --- a/src/forward.cc +++ b/src/forward.cc @@@ -874,23 -879,43 +872,17 @@@ FwdState::connectStart( commSetTimeout(fd, ctimeout, fwdConnectTimeoutWrapper, this); - if (fs->_peer) { - hierarchyNote(&request->hier, fs->code, fs->_peer->host); - } else { - if (!fs->_peer) { -#if LINUX_TPROXY - - if (request->flags.tproxy) { - IPAddress addr; - - src.GetInAddr(itp.v.addr.faddr); - itp.v.addr.fport = 0; - - /* If these syscalls fail then we just fallback to connecting - * normally by simply ignoring the errors... - */ - itp.op = TPROXY_ASSIGN; - - addr = (struct in_addr)itp.v.addr.faddr; - addr.SetPort(itp.v.addr.fport); - - if (setsockopt(fd, SOL_IP, IP_TPROXY, &itp, sizeof(itp)) == -1) { - debugs(20, 1, "tproxy ip=" << addr << " ERROR ASSIGN"); - - request->flags.tproxy = 0; - } else { - itp.op = TPROXY_FLAGS; - itp.v.flags = ITP_CONNECT; - - if (setsockopt(fd, SOL_IP, IP_TPROXY, &itp, sizeof(itp)) == -1) { - debugs(20, 1, "tproxy ip=" << addr << " ERROR CONNECT"); -- - request->flags.tproxy = 0; - } - } +#if LINUX_TPROXY2 - if (request->flags.spoof_client_ip) { - // try to set the outgoing address using TPROXY v2 - // if it fails we abort any further TPROXY actions on this connection - if(IPInterceptor.SetTproxy2OutgoingAddr(int fd, const IPAddress &src) == -1) { - request->flags.spoof_client_ip = 0; - } ++ if (!fs->_peer && request->flags.spoof_client_ip) { ++ // try to set the outgoing address using TPROXY v2 ++ // if it fails we abort any further TPROXY actions on this connection ++ if(IPInterceptor.SetTproxy2OutgoingAddr(int fd, const IPAddress &src) == -1) { ++ request->flags.spoof_client_ip = 0; } - #endif -- - hierarchyNote(&request->hier, fs->code, request->GetHost()); -#endif } ++#endif + updateHierarchyInfo(); commConnectStart(fd, host, port, fwdConnectDoneWrapper, this); }