UltraMonkey-L7 V3(multi-thread implementation)
Revisión | 51c185757e513c6f3a89b6337dd15ccc2c18b8bc (tree) |
---|---|
Tiempo | 2013-10-25 17:14:40 |
Autor | Hiroaki Nakano <nakano.hiroaki@nttc...> |
Commiter | Hiroaki Nakano |
ipv6でtproxyを使えるようにする。
さらにipv4用tproxyのためのconfigureチェックが
間違っているので修正。
Signed-off-by: Hiroaki Nakano <nakano.hiroaki@nttcom.co.jp>
@@ -29,13 +29,7 @@ AC_CHECK_LIB([netsnmp], main, :, | ||
29 | 29 | [AC_MSG_ERROR( l7vsd require netsnmp library. )] ) |
30 | 30 | |
31 | 31 | # Checks for header files. |
32 | -AC_CHECK_HEADERS([limits.h unistd.h]) | |
33 | - | |
34 | -# Checks for declarations. | |
35 | -AC_CHECK_DECLS([IP_TRANSPARENT], [], [], [[ | |
36 | - #include <sys/socket.h> | |
37 | - #include <linux/in.h> | |
38 | -]]) | |
32 | +AC_CHECK_HEADERS([limits.h unistd.h sys/socket.h linux/in.h linux/in6.h]) | |
39 | 33 | |
40 | 34 | # Checks for typedefs, structures, and compiler characteristics. |
41 | 35 | AC_HEADER_STDBOOL |
@@ -139,7 +139,7 @@ public: | ||
139 | 139 | } |
140 | 140 | } |
141 | 141 | |
142 | -#ifdef IP_TRANSPARENT | |
142 | +#if defined(IP_TRANSPARENT) || defined(IPV6_TRANSPARENT) | |
143 | 143 | virtual void set_transparent(const boost::asio::ip::tcp::endpoint &client_endpoint, boost::system::error_code &error_code) { |
144 | 144 | int ip_socket_level; |
145 | 145 | client_endpoint.address().is_v4() |
@@ -147,7 +147,12 @@ public: | ||
147 | 147 | : ip_socket_level = SOL_IPV6; |
148 | 148 | // set IP_TRANSPARENT |
149 | 149 | int on = 1; |
150 | - int err = ::setsockopt(my_socket->native(), ip_socket_level, IP_TRANSPARENT, &on, sizeof(on)); | |
150 | + int err = 0; | |
151 | + if (ip_socket_level == SOL_IP) { | |
152 | + err = ::setsockopt(my_socket->native(), ip_socket_level, IP_TRANSPARENT, &on, sizeof(on)); | |
153 | + } else if (ip_socket_level == SOL_IPV6) { | |
154 | + err = ::setsockopt(my_socket->native(), ip_socket_level, IPV6_TRANSPARENT, &on, sizeof(on)); | |
155 | + } | |
151 | 156 | if (err) { |
152 | 157 | error_code = boost::system::error_code(errno, boost::asio::error::get_system_category()); |
153 | 158 | return; |
@@ -157,6 +162,7 @@ public: | ||
157 | 162 | my_socket->bind(client_endpoint, error_code); |
158 | 163 | } |
159 | 164 | #endif |
165 | + | |
160 | 166 | protected: |
161 | 167 | virtual void set_quickack(boost::system::error_code &error_code) { |
162 | 168 | int err = ::setsockopt(my_socket->native(), IPPROTO_TCP, TCP_QUICKACK, &opt_info.quickack_val, sizeof(opt_info.quickack_val)); |
@@ -25,11 +25,21 @@ | ||
25 | 25 | #ifndef TCP_SOCKET_OPTION_H |
26 | 26 | #define TCP_SOCKET_OPTION_H |
27 | 27 | |
28 | +#include <sys/socket.h> | |
28 | 29 | #include "config.h" |
29 | -#if HAVE_DECL_IP_TRANSPARENT && !defined(IP_TRANSPARENT) | |
30 | + | |
31 | +#if HAVE_IN_H | |
32 | +#include <linux/in.h> | |
33 | +#else | |
30 | 34 | #define IP_TRANSPARENT 19 |
31 | 35 | #endif |
32 | 36 | |
37 | +#if HAVE_IN6_H | |
38 | +#include <linux/in6.h> | |
39 | +#else | |
40 | +#define IPV6_TRANSPARENT 75 | |
41 | +#endif | |
42 | + | |
33 | 43 | namespace l7vs |
34 | 44 | { |
35 | 45 | //! tcp_socket_option |