• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

UltraMonkey-L7 V3(multi-thread implementation)


Commit MetaInfo

Revisión51c185757e513c6f3a89b6337dd15ccc2c18b8bc (tree)
Tiempo2013-10-25 17:14:40
AutorHiroaki Nakano <nakano.hiroaki@nttc...>
CommiterHiroaki Nakano

Log Message

ipv6でtproxyを使えるようにする。
さらにipv4用tproxyのためのconfigureチェックが
間違っているので修正。

Signed-off-by: Hiroaki Nakano <nakano.hiroaki@nttcom.co.jp>

Cambiar Resumen

Diferencia incremental

--- a/configure.in
+++ b/configure.in
@@ -29,13 +29,7 @@ AC_CHECK_LIB([netsnmp], main, :,
2929 [AC_MSG_ERROR( l7vsd require netsnmp library. )] )
3030
3131 # 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])
3933
4034 # Checks for typedefs, structures, and compiler characteristics.
4135 AC_HEADER_STDBOOL
--- a/l7vsd/include/tcp_socket.h
+++ b/l7vsd/include/tcp_socket.h
@@ -139,7 +139,7 @@ public:
139139 }
140140 }
141141
142-#ifdef IP_TRANSPARENT
142+#if defined(IP_TRANSPARENT) || defined(IPV6_TRANSPARENT)
143143 virtual void set_transparent(const boost::asio::ip::tcp::endpoint &client_endpoint, boost::system::error_code &error_code) {
144144 int ip_socket_level;
145145 client_endpoint.address().is_v4()
@@ -147,7 +147,12 @@ public:
147147 : ip_socket_level = SOL_IPV6;
148148 // set IP_TRANSPARENT
149149 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+ }
151156 if (err) {
152157 error_code = boost::system::error_code(errno, boost::asio::error::get_system_category());
153158 return;
@@ -157,6 +162,7 @@ public:
157162 my_socket->bind(client_endpoint, error_code);
158163 }
159164 #endif
165+
160166 protected:
161167 virtual void set_quickack(boost::system::error_code &error_code) {
162168 int err = ::setsockopt(my_socket->native(), IPPROTO_TCP, TCP_QUICKACK, &opt_info.quickack_val, sizeof(opt_info.quickack_val));
--- a/l7vsd/include/tcp_socket_option.h
+++ b/l7vsd/include/tcp_socket_option.h
@@ -25,11 +25,21 @@
2525 #ifndef TCP_SOCKET_OPTION_H
2626 #define TCP_SOCKET_OPTION_H
2727
28+#include <sys/socket.h>
2829 #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
3034 #define IP_TRANSPARENT 19
3135 #endif
3236
37+#if HAVE_IN6_H
38+#include <linux/in6.h>
39+#else
40+#define IPV6_TRANSPARENT 75
41+#endif
42+
3343 namespace l7vs
3444 {
3545 //! tcp_socket_option