summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2010-12-02 22:25:46 +0000
committerChristian Pointner <equinox@spreadspace.org>2010-12-02 22:25:46 +0000
commiteb2b719951d3bb2994142f2821073f7f052cdd13 (patch)
tree622f96853e2de218d9911674d0cd3f19e4802d60
parentfixed handling of client read (diff)
removed useless source address resolving type option
git-svn-id: https://svn.spreadspace.org/tcpproxy/trunk@23 e61f0598-a718-4e21-a8f0-0aadfa62ad6b
-rw-r--r--doc/tcpproxy.825
-rw-r--r--doc/tcpproxy.8.txt8
-rw-r--r--src/listener.c4
-rw-r--r--src/listener.h2
-rw-r--r--src/options.c8
-rw-r--r--src/options.h1
-rw-r--r--src/tcpproxy.c2
7 files changed, 12 insertions, 38 deletions
diff --git a/doc/tcpproxy.8 b/doc/tcpproxy.8
index d4bcb42..b4ea062 100644
--- a/doc/tcpproxy.8
+++ b/doc/tcpproxy.8
@@ -1,22 +1,13 @@
'\" t
.\" Title: tcpproxy
.\" Author: [see the "AUTHORS" section]
-.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\" Generator: DocBook XSL Stylesheets v1.75.1 <http://docbook.sf.net/>
.\" Date: 12/02/2010
-.\" Manual: \ \&
-.\" Source: \ \&
+.\" Manual: tcpproxy user manual
+.\" Source: tcpproxy trunk
.\" Language: English
.\"
-.TH "TCPPROXY" "8" "12/02/2010" "\ \&" "\ \&"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
+.TH "TCPPROXY" "8" "12/02/2010" "tcpproxy trunk" "tcpproxy user manual"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -48,7 +39,6 @@ tcpproxy \- IPv4/IPv6 tcp connection proxy
[ \fB\-R|\-\-remote\-resolv\fR (ipv4|4|ipv6|6) ]
[ \fB\-o|\-\-remote\-port\fR <service> ]
[ \fB\-s|\-\-source\-addr\fR <host> ]
- [ \fB\-S|\-\-source\-resolv\fR (ipv4|4|ipv6|6) ]
[ \fB\-b|\-\-buffer\-size\fR <size> ]
[ \fB\-c|\-\-config\fR <file> ]
.fi
@@ -158,7 +148,7 @@ The remote address to connect to\&. Unless the configuration file should be used
.PP
\fB\-R|\-\-remote\-resolv (ipv4|4|ipv6|6)\fR
.RS 4
-When resolving the remote address (see above) use only IPv4 or IPv6\&. The default is to resolv both\&.
+When resolving the remote address (see above) use only IPv4 or IPv6\&. The default is to resolv both\&. Mind that this also effects resolving of the source address (see below) as the remote and source addresses must be of the same protocol familiy\&.
.RE
.PP
\fB\-o, \-\-remote\-port <service>\fR
@@ -174,11 +164,6 @@ Instruct tcpproxy to use this source address for connections to
uses the default source address for the defined remote host\&.
.RE
.PP
-\fB\-S|\-\-source\-resolv (ipv4|4|ipv6|6)\fR
-.RS 4
-When resolving the source address (see above) use only IPv4 or IPv6\&. The default is to resolv both\&.
-.RE
-.PP
\fB\-b, \-\-buffer\-size <size>\fR
.RS 4
The size of the transmit buffers to use\&.
diff --git a/doc/tcpproxy.8.txt b/doc/tcpproxy.8.txt
index 8da0b98..14a12af 100644
--- a/doc/tcpproxy.8.txt
+++ b/doc/tcpproxy.8.txt
@@ -27,7 +27,6 @@ tcpproxy
[ -R|--remote-resolv (ipv4|4|ipv6|6) ]
[ -o|--remote-port <service> ]
[ -s|--source-addr <host> ]
- [ -S|--source-resolv (ipv4|4|ipv6|6) ]
[ -b|--buffer-size <size> ]
[ -c|--config <file> ]
....
@@ -105,7 +104,8 @@ The following options can be passed to the *tcpproxy* daemon:
*-R|--remote-resolv (ipv4|4|ipv6|6)*::
When resolving the remote address (see above) use only IPv4 or IPv6. The default is
- to resolv both.
+ to resolv both. Mind that this also effects resolving of the source address (see below)
+ as the remote and source addresses must be of the same protocol familiy.
*-o, --remote-port <service>*::
The remote port to connect to. Unless the configuration file should be used this
@@ -115,10 +115,6 @@ The following options can be passed to the *tcpproxy* daemon:
Instruct tcpproxy to use this source address for connections to *-R|--remote-address*.
By default *tcpproxy* uses the default source address for the defined remote host.
-*-S|--source-resolv (ipv4|4|ipv6|6)*::
- When resolving the source address (see above) use only IPv4 or IPv6. The default is
- to resolv both.
-
*-b, --buffer-size <size>*::
The size of the transmit buffers to use. *tcpproxy* will allocate two buffers of this
size for any client which is connected. By default a value of 10Kbytes is used.
diff --git a/src/listener.c b/src/listener.c
index a9cfa1e..a396ea4 100644
--- a/src/listener.c
+++ b/src/listener.c
@@ -66,7 +66,7 @@ void listener_clear(listeners_t* list)
slist_clear(list);
}
-int listener_add(listeners_t* list, const char* laddr, resolv_type_t lrt, const char* lport, const char* raddr, resolv_type_t rrt, const char* rport, const char* saddr, resolv_type_t srt)
+int listener_add(listeners_t* list, const char* laddr, resolv_type_t lrt, const char* lport, const char* raddr, resolv_type_t rrt, const char* rport, const char* saddr)
{
if(!list)
return -1;
@@ -78,7 +78,7 @@ int listener_add(listeners_t* list, const char* laddr, resolv_type_t lrt, const
struct addrinfo* se = NULL;
if(saddr) {
- se = tcp_resolve_endpoint(saddr, NULL, srt);
+ se = tcp_resolve_endpoint(saddr, NULL, rrt);
if(!se) {
freeaddrinfo(re);
return -1;
diff --git a/src/listener.h b/src/listener.h
index fc3feed..91b527f 100644
--- a/src/listener.h
+++ b/src/listener.h
@@ -47,7 +47,7 @@ typedef slist_t listeners_t;
int listener_init(listeners_t* list);
void listener_clear(listeners_t* list);
-int listener_add(listeners_t* list, const char* laddr, resolv_type_t lrt, const char* lport, const char* raddr, resolv_type_t rrt, const char* rport, const char* saddr, resolv_type_t srt);
+int listener_add(listeners_t* list, const char* laddr, resolv_type_t lrt, const char* lport, const char* raddr, resolv_type_t rrt, const char* rport, const char* saddr);
void listener_remove(listeners_t* list, int fd);
listener_t* listener_find(listeners_t* list, int fd);
void listener_print(listeners_t* list);
diff --git a/src/options.c b/src/options.c
index 1f10b5c..bc49a44 100644
--- a/src/options.c
+++ b/src/options.c
@@ -204,7 +204,6 @@ int options_parse(options_t* opt, int argc, char* argv[])
PARSE_RESOLV_TYPE("-R","--remote-resolv", opt->rresolv_type_)
PARSE_STRING_PARAM("-o","--remote-port", opt->remote_port_)
PARSE_STRING_PARAM("-s","--source-addr", opt->source_addr_)
- PARSE_RESOLV_TYPE("-S","--source-resolv", opt->sresolv_type_)
PARSE_STRING_PARAM("-c","--config", opt->config_file_)
PARSE_INT_PARAM("-b","--buffer-size", opt->buffer_size_)
else
@@ -252,7 +251,6 @@ void options_default(options_t* opt)
opt->rresolv_type_ = ANY;
opt->remote_port_ = NULL;
opt->source_addr_ = NULL;
- opt->sresolv_type_ = ANY;
opt->config_file_ = strdup(CONFFILE);
string_list_init(&opt->log_targets_);
opt->buffer_size_ = 10 * 1024;
@@ -306,10 +304,9 @@ void options_print_usage()
printf(" [-t|--local-resolv] (ipv4|4|ipv6|6) set IPv4 or IPv6 only resolving for the local address\n");
printf(" [-p|--local-port] <service> local port to listen on\n");
printf(" [-r|--remote-addr] <host> remote address to connect to\n");
- printf(" [-R|--remote-resolv] (ipv4|4|ipv6|6) set IPv4 or IPv6 only resolving for the remote address\n");
+ printf(" [-R|--remote-resolv] (ipv4|4|ipv6|6) set IPv4 or IPv6 only resolving for remote and source address\n");
printf(" [-o|--remote-port] <service> remote port to connect to\n");
printf(" [-s|--source-addr] <host> source address to connect from\n");
- printf(" [-S|--source-resolv] (ipv4|4|ipv6|6) set IPv4 or IPv6 only resolving for the source address\n");
printf(" [-b|--buffer-size] <size> size of transmit buffers\n");
printf(" [-c|--config] <file> configuration file\n");
}
@@ -344,9 +341,6 @@ void options_print(options_t* opt)
else printf("rresolv_type: Both\n");
printf("remote_port: '%s'\n", opt->remote_port_);
printf("source_addr: '%s'\n", opt->source_addr_);
- if(opt->sresolv_type_ == IPV4_ONLY) printf("sresolv_type: IPv4\n");
- else if(opt->sresolv_type_ == IPV6_ONLY) printf("sresolv_type: IPv6\n");
- else printf("sresolv_type: Both\n");
printf("buffer-size: %d\n", opt->buffer_size_);
printf("config_file: '%s'\n", opt->config_file_);
printf("debug: %s\n", !opt->debug_ ? "false" : "true");
diff --git a/src/options.h b/src/options.h
index 085544c..9a45c47 100644
--- a/src/options.h
+++ b/src/options.h
@@ -47,7 +47,6 @@ struct options_struct {
resolv_type_t rresolv_type_;
char* remote_port_;
char* source_addr_;
- resolv_type_t sresolv_type_;
char* config_file_;
int32_t buffer_size_;
int debug_;
diff --git a/src/tcpproxy.c b/src/tcpproxy.c
index 5423036..149fdf0 100644
--- a/src/tcpproxy.c
+++ b/src/tcpproxy.c
@@ -145,7 +145,7 @@ int main(int argc, char* argv[])
log_close();
exit(-1);
}
- ret = listener_add(&listeners, opt.local_addr_, opt.lresolv_type_, opt.local_port_, opt.remote_addr_, opt.rresolv_type_, opt.remote_port_, opt.source_addr_, opt.sresolv_type_);
+ ret = listener_add(&listeners, opt.local_addr_, opt.lresolv_type_, opt.local_port_, opt.remote_addr_, opt.rresolv_type_, opt.remote_port_, opt.source_addr_);
if(ret) {
listener_clear(&listeners);
options_clear(&opt);