IPAddress dst;
if (clientNatLookup(fd, me, peer, dst) == 0) {
- result-> me = dst; /* XXX This should be moved to another field */
+ result->me = dst; /* XXX This should be moved to another field */
result->transparent(true);
}
}
#endif
enter_suid();
- fd = comm_open(SOCK_STREAM,
- IPPROTO_TCP,
- s->s,
- COMM_NONBLOCKING, "HTTP Socket");
+
+#if LINUX_TPROXY4
+ if(s->tproxy) {
+ fd = comm_openex(SOCK_STREAM, IPPROTO_TCP, s->s, (COMM_NONBLOCKING|COMM_TRANSPARENT), 0, "HTTP Socket");
+ }
+ else
+#endif
+ {
+ fd = comm_open(SOCK_STREAM, IPPROTO_TCP, s->s, COMM_NONBLOCKING, "HTTP Socket");
+ }
+
leave_suid();
if (fd < 0)
continue;
-#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->tproxy)
- comm_set_transparent(fd);
-#endif
-
comm_listen(fd);
comm_accept(fd, httpAccept, s);
addr.GetAddrInfo(AI);
AI->ai_socktype = sock_type;
AI->ai_protocol = proto;
- AI->ai_flags = flags;
debugs(50, 3, "comm_openex: Attempt open socket for: " << addr );
PROF_stop(comm_open);
}
+#if LINUX_TPROXY4
+ if((flags & COMM_TRANSPARENT)) {
+ comm_set_transparent(new_socket);
+ F->flags.transparent = 1;
+ }
+#endif
+
#ifdef TCP_NODELAY
if (sock_type == SOCK_STREAM)
commSetTcpNoDelay(new_socket);
#define COMM_NONBLOCKING 0x01
#define COMM_NOCLOEXEC 0x02
#define COMM_REUSEADDR 0x04
+#define COMM_TRANSPARENT 0x08
#include "Debug.h"
#define do_debug(SECTION, LEVEL) ((Debug::level = (LEVEL)) > Debug::Levels[SECTION])
debugs(17, 3, "fwdConnectStart: got outgoing addr " << outgoing << ", tos " << tos);
- fd = comm_openex(SOCK_STREAM,
- IPPROTO_TCP,
- outgoing,
- COMM_NONBLOCKING,
- tos,
- url);
+#if LINUX_TPROXY4
+ if (request->flags.tproxy) {
+ fd = comm_openex(SOCK_STREAM, IPPROTO_TCP, outgoing, (COMM_NONBLOCKING|COMM_TRANSPARENT), tos, url);
+ }
+ else
+#endif
+ {
+ fd = comm_openex(SOCK_STREAM, IPPROTO_TCP, outgoing, COMM_NONBLOCKING, tos, url);
+ }
debugs(17, 3, "fwdConnectStart: got TCP FD " << fd);
{
ACLChecklist ch;
+#if LINUX_TPROXY4
+ if (request && request->flags.tproxy)
+ return request->client_addr;
+#endif
+
if (request)
{
ch.src_addr = request->client_addr;