diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-01-31 12:59:35 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-01-31 12:59:35 -0500 |
commit | 09ccc4c4a3b67695295ad95f24b2f102d5f2fa1a (patch) | |
tree | 22954a4eeb94bf31805c6fcd9b6620f37928e3e6 /src/or/connection.c | |
parent | 4fe253ef40a96dbfb978752e9d2833e8b491ca28 (diff) | |
download | tor-09ccc4c4a3b67695295ad95f24b2f102d5f2fa1a.tar.gz tor-09ccc4c4a3b67695295ad95f24b2f102d5f2fa1a.zip |
Add support for TPROXY via new TransTPRoxy option
Based on patch from "thomo" at #10582.
Diffstat (limited to 'src/or/connection.c')
-rw-r--r-- | src/or/connection.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index 1f6e11fac1..7d8feeb95c 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -1035,6 +1035,17 @@ connection_listener_new(const struct sockaddr *listensockaddr, make_socket_reuseable(s); +#if defined USE_TRANSPARENT && defined(IP_TRANSPARENT) + if (options->TransTPROXY && type == CONN_TYPE_AP_TRANS_LISTENER) { + int one = 1; + if (setsockopt(s, SOL_IP, IP_TRANSPARENT, &one, sizeof(one)) < 0) { + int e = tor_socket_errno(s); + log_warn(LD_NET, "Error setting IP_TRANSPARENT flag: %s", + tor_socket_strerror(e)); + } + } +#endif + #ifdef IPV6_V6ONLY if (listensockaddr->sa_family == AF_INET6) { #ifdef _WIN32 |