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);
}