} else if (strcmp(token, "tproxy") == 0) {
s->tproxy = 1;
- s->transparent = 1;
need_linux_tproxy = 1;
#if USE_IPV6
/* INET6: until transparent REDIRECT works on IPv6 SOCKET, force wildcard to IPv4 */
}
ConnStateData *
-
connStateCreate(const IPAddress &peer, const IPAddress &me, int fd, http_port_list *port)
{
ConnStateData *result = new ConnStateData;
result->in.buf = (char *)memAllocBuf(CLIENT_REQ_BUF_SZ, &result->in.allocatedSize);
result->port = cbdataReference(port);
- if (port->transparent)
+#if LINUX_TPROXY4
+ if(port->transparent || port->tproxy)
+#else
+ if(port->transparent)
+#endif
{
-
IPAddress dst;
if (clientNatLookup(fd, me, peer, dst) == 0) {
#if LINUX_TPROXY4
/* because the transparent/non-transparent port info is only known here.
* we have to set the IP_TRANSPARENT option here. */
- if(s->transparent)
- comm_set_transparent(fd,0);
+ if(s->tproxy)
+ comm_set_transparent(fd);
#endif
comm_listen(fd);
#if LINUX_TPROXY4
/* AYJ: do we need to set this again on every accept? */
if(fd_table[fd].flags.transparent == 1) {
- comm_set_transparent(sock, 0);
+ comm_set_transparent(sock);
F->flags.transparent = 1;
}
#endif
/**
* Set the socket IP_TRANSPARENT option for Linux TPROXY v4 support.
*/
-SQUIDCEXTERN void comm_set_transparent(int fd, int tos);
+SQUIDCEXTERN void comm_set_transparent(int fd);
SQUIDCEXTERN void commSetSelect(int, unsigned int, PF *, void *, time_t);
SQUIDCEXTERN void commResetSelect(int);
default:
FwdState::Pointer fwd = new FwdState(client_fd, entry, request);
-#if LINUX_TPROXY
+#if LINUX_TPROXY2 || LINUX_TPROXY4
/* If we need to transparently proxy the request
* then we need the client source protocol, address and port */
fwd->src = request->client_addr;
const char *domain = NULL;
int ctimeout;
int ftimeout = Config.Timeout.forward - (squid_curtime - start_t);
-#if LINUX_TPROXY
+#if LINUX_TPROXY2
struct in_tproxy itp;
#endif
ctimeout = Config.Timeout.connect;
}
-#if LINUX_TPROXY
+#if LINUX_TPROXY2 || LINUX_TPROXY4
if (request->flags.tproxy)
client_addr = request->client_addr;
if (fs->_peer) {
hierarchyNote(&request->hier, fs->code, fs->_peer->host);
} else {
-#if LINUX_TPROXY
+#if LINUX_TPROXY2 || LINUX_TPROXY4
if (request->flags.tproxy) {
+
+#if LINUX_TPROXY4
+ comm_set_transparent(fd);
+
+#elif LINUX_TPROXY2
IPAddress addr;
src.GetInAddr(itp.v.addr.faddr);
request->flags.tproxy = 0;
}
}
+#endif
}
#endif