summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2013-10-07 11:55:08 +0000
committerChristian Pointner <equinox@spreadspace.org>2013-10-07 11:55:08 +0000
commit6c40ae29a879eb7d7a70cbea9e3ff16e643ccce7 (patch)
tree4c05ef3d015aa4747668cccc00238de88d1e25af
parentfixed build with -Wall (diff)
whitespace cleanups
updated copyright notice git-svn-id: https://svn.spreadspace.org/tcpproxy/trunk@68 e61f0598-a718-4e21-a8f0-0aadfa62ad6b
-rw-r--r--ChangeLog6
-rw-r--r--LICENSE12
-rw-r--r--README6
-rw-r--r--doc/Makefile14
-rw-r--r--doc/tcpproxy.821
-rw-r--r--doc/tcpproxy.8.txt34
-rw-r--r--src/Makefile12
-rw-r--r--src/cfg_parser.h12
-rw-r--r--src/cfg_parser.rl2
-rw-r--r--src/clients.c2
-rw-r--r--src/clients.h12
-rwxr-xr-xsrc/configure2
-rw-r--r--src/daemon.h13
-rw-r--r--src/datatypes.h12
-rw-r--r--src/listener.c2
-rw-r--r--src/listener.h12
-rw-r--r--src/log.c16
-rw-r--r--src/log.h12
-rw-r--r--src/log_targets.h28
-rw-r--r--src/options.c18
-rw-r--r--src/options.h12
-rw-r--r--src/sig_handler.c12
-rw-r--r--src/sig_handler.h12
-rw-r--r--src/slist.c28
-rw-r--r--src/slist.h12
-rw-r--r--src/string_list.c16
-rw-r--r--src/string_list.h12
-rw-r--r--src/tcp.c16
-rw-r--r--src/tcp.h12
-rw-r--r--src/tcpproxy.c4
30 files changed, 198 insertions, 186 deletions
diff --git a/ChangeLog b/ChangeLog
index 545b488..891a501 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,12 @@
+2013.10.07 -- Version 1.1
+
+* fixed build for clang
+
2010.12.25 -- Version 1.0
* print some info in SIGUSR1 and SIGUSR2
* fixed problematic usage of strndup at new parser
-
+
2010.12.11 -- Version 0.2
* added TCP_NODELAY option for client fd's
diff --git a/LICENSE b/LICENSE
index 63d266c..b3f95c6 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,14 +1,14 @@
/*
* tcpproxy
*
- * tcpproxy is a simple tcp connection proxy which combines the
- * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
- * IPv6 and also supports connections from IPv6 to IPv4
+ * tcpproxy is a simple tcp connection proxy which combines the
+ * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
+ * IPv6 and also supports connections from IPv6 to IPv4
* endpoints and vice versa.
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@spreadspace.org>
- *
+ *
+ * Copyright (C) 2010-2013 Christian Pointner <equinox@spreadspace.org>
+ *
* This file is part of tcpproxy.
*
* tcpproxy is free software: you can redistribute it and/or modify
diff --git a/README b/README
index 608c43e..3d77137 100644
--- a/README
+++ b/README
@@ -1,9 +1,9 @@
Introduction
============
-tcpproxy is a simple tcp connection proxy which combines the
-features of rinetd and 6tunnel. tcpproxy supports IPv4 and
-IPv6 and also supports connections from IPv6 to IPv4
+tcpproxy is a simple tcp connection proxy which combines the
+features of rinetd and 6tunnel. tcpproxy supports IPv4 and
+IPv6 and also supports connections from IPv6 to IPv4
endpoints and vice versa.
Dependencies
diff --git a/doc/Makefile b/doc/Makefile
index d094e90..404da2d 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -1,14 +1,14 @@
##
## tcpproxy
##
-## tcpproxy is a simple tcp connection proxy which combines the
-## features of rinetd and 6tunnel. tcpproxy supports IPv4 and
-## IPv6 and also supports connections from IPv6 to IPv4
+## tcpproxy is a simple tcp connection proxy which combines the
+## features of rinetd and 6tunnel. tcpproxy supports IPv4 and
+## IPv6 and also supports connections from IPv6 to IPv4
## endpoints and vice versa.
-##
##
-## Copyright (C) 2010-2011 Christian Pointner <equinox@spreadspace.org>
-##
+##
+## Copyright (C) 2010-2013 Christian Pointner <equinox@spreadspace.org>
+##
## This file is part of tcpproxy.
##
## tcpproxy is free software: you can redistribute it and/or modify
@@ -27,7 +27,7 @@
VERSION=$(shell cat ../version)
-.PHONY: clean
+.PHONY: clean
all: manpage
diff --git a/doc/tcpproxy.8 b/doc/tcpproxy.8
index 1eab26a..090d818 100644
--- a/doc/tcpproxy.8
+++ b/doc/tcpproxy.8
@@ -1,13 +1,22 @@
'\" t
.\" Title: tcpproxy
.\" Author: [see the "AUTHORS" section]
-.\" Generator: DocBook XSL Stylesheets v1.75.1 <http://docbook.sf.net/>
-.\" Date: 12/14/2010
-.\" Manual: tcpproxy user manual
-.\" Source: tcpproxy trunk
+.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
+.\" Date: 10/07/2013
+.\" Manual: \ \&
+.\" Source: \ \&
.\" Language: English
.\"
-.TH "TCPPROXY" "8" "12/14/2010" "tcpproxy trunk" "tcpproxy user manual"
+.TH "TCPPROXY" "8" "10/07/2013" "\ \&" "\ \&"
+.\" -----------------------------------------------------------------
+.\" * 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 '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -213,4 +222,4 @@ Christian Pointner <equinox@spreadspace\&.org>
Main web site: http://www\&.spreadspace\&.org/tcpproxy/
.SH "COPYING"
.sp
-Copyright (C) 2010 Christian Pointner\&. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version\&.
+Copyright (C) 2010\-2013 Christian Pointner\&. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version\&.
diff --git a/doc/tcpproxy.8.txt b/doc/tcpproxy.8.txt
index c727c69..85bb7f6 100644
--- a/doc/tcpproxy.8.txt
+++ b/doc/tcpproxy.8.txt
@@ -35,9 +35,9 @@ tcpproxy
DESCRIPTION
-----------
-*tcpproxy* is a simple tcp connection proxy which combines the
-features of rinetd and 6tunnel. *tcpproxy* supports IPv4 and
-IPv6 and also supports connections from IPv6 to IPv4 endpoints
+*tcpproxy* is a simple tcp connection proxy which combines the
+features of rinetd and 6tunnel. *tcpproxy* supports IPv4 and
+IPv6 and also supports connections from IPv6 to IPv4 endpoints
and vice versa.
OPTIONS
@@ -50,7 +50,7 @@ The following options can be passed to the *tcpproxy* daemon:
instead of becoming a daemon which is the default.
*-u, --username <username>*::
- run as this user. If no group is specified (*-g*) the default group of
+ run as this user. If no group is specified (*-g*) the default group of
the user is used. The default is to not drop privileges.
*-g, --groupname <groupname>*::
@@ -58,20 +58,20 @@ The following options can be passed to the *tcpproxy* daemon:
The default is to not drop privileges.
*-C, --chroot <path>*::
- Instruct *tcpproxy* to run in a chroot jail. The default is
+ Instruct *tcpproxy* to run in a chroot jail. The default is
to not run in chroot.
*-P, --write-pid <filename>*::
- Instruct *tcpproxy* to write it's pid to this file. The default is
+ Instruct *tcpproxy* to write it's pid to this file. The default is
to not create a pid file.
*-L, --log <target>:<level>[,<param1>[,<param2>[..]]]*::
add log target to logging system. This can be invoked several times
- in order to log to different targets at the same time. Every target
+ in order to log to different targets at the same time. Every target
has its own log level which is a number between 0 and 5. Where 0 means
disabling log and 5 means debug messages are enabled. +
The file target can be used more than once with different levels.
- If no target is provided at the command line a single target with the
+ If no target is provided at the command line a single target with the
config *syslog:3,tcpproxy,daemon* is added. +
The following targets are supported:
@@ -81,7 +81,7 @@ The following options can be passed to the *tcpproxy* daemon:
*stderr*;; log to standard error, parameters <level>
*-U, --debug*::
- This option instructs *tcpproxy* to run in debug mode. It implicits *-D*
+ This option instructs *tcpproxy* to run in debug mode. It implicits *-D*
(don't daemonize) and adds a log target with the configuration
*stdout:5* (logging with maximum level). In future releases there might
be additional output when this option is supplied.
@@ -95,7 +95,7 @@ The following options can be passed to the *tcpproxy* daemon:
to resolv both.
*-p, --local-port <service>*::
- The local port to bind to. By default there is no port defined in which case
+ The local port to bind to. By default there is no port defined in which case
*tcpproxy* will try to read the configuration file.
*-r, --remote-addr <host>*::
@@ -116,7 +116,7 @@ The following options can be passed to the *tcpproxy* daemon:
By default *tcpproxy* uses the default source address for the defined remote host.
*-b, --buffer-size <size>*::
- The size of the transmit buffers to use. *tcpproxy* will allocate two buffers of this
+ 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.
*-c, --config <file>*::
@@ -148,12 +148,12 @@ SIGNALS
After receiving the HUP signal *tcpproxy* tries to reload the configuration file. It only
reopens a listen socket if the local address and or port has changed. Therefore reloading the
configuration after the daemon has dropped privileges is safe as long as there are no changes
-in the local address and port. However this is only of concern if any of the listen ports is
+in the local address and port. However this is only of concern if any of the listen ports is
a privileged port (<1024). If there is a syntax error at the configuration file all changes
are discarded.
On SIGUSR1 *tcpproxy* prints some information about the listening sockets and after SIGUSR2
-information about open client connections is printed. This is sent to all configured log
-targets at a level of 3.
+information about open client connections is printed. This is sent to all configured log
+targets at a level of 3.
BUGS
@@ -182,7 +182,7 @@ Main web site: http://www.spreadspace.org/tcpproxy/
COPYING
-------
-Copyright \(C) 2010 Christian Pointner. This program is free
-software: you can redistribute it and/or modify it under the terms
-of the GNU General Public License as published by the Free Software
+Copyright \(C) 2010-2013 Christian Pointner. This program is free
+software: you can redistribute it and/or modify it under the terms
+of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or any later version.
diff --git a/src/Makefile b/src/Makefile
index 4c5fe37..4524b29 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,14 +1,14 @@
##
## tcpproxy
##
-## tcpproxy is a simple tcp connection proxy which combines the
-## features of rinetd and 6tunnel. tcpproxy supports IPv4 and
-## IPv6 and also supports connections from IPv6 to IPv4
+## tcpproxy is a simple tcp connection proxy which combines the
+## features of rinetd and 6tunnel. tcpproxy supports IPv4 and
+## IPv6 and also supports connections from IPv6 to IPv4
## endpoints and vice versa.
-##
##
-## Copyright (C) 2010-2011 Christian Pointner <equinox@spreadspace.org>
-##
+##
+## Copyright (C) 2010-2013 Christian Pointner <equinox@spreadspace.org>
+##
## This file is part of tcpproxy.
##
## tcpproxy is free software: you can redistribute it and/or modify
diff --git a/src/cfg_parser.h b/src/cfg_parser.h
index d96c705..a373154 100644
--- a/src/cfg_parser.h
+++ b/src/cfg_parser.h
@@ -1,14 +1,14 @@
/*
* tcpproxy
*
- * tcpproxy is a simple tcp connection proxy which combines the
- * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
- * IPv6 and also supports connections from IPv6 to IPv4
+ * tcpproxy is a simple tcp connection proxy which combines the
+ * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
+ * IPv6 and also supports connections from IPv6 to IPv4
* endpoints and vice versa.
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@spreadspace.org>
- *
+ *
+ * Copyright (C) 2010-2013 Christian Pointner <equinox@spreadspace.org>
+ *
* This file is part of tcpproxy.
*
* tcpproxy is free software: you can redistribute it and/or modify
diff --git a/src/cfg_parser.rl b/src/cfg_parser.rl
index 03adbcc..918501c 100644
--- a/src/cfg_parser.rl
+++ b/src/cfg_parser.rl
@@ -7,7 +7,7 @@
* endpoints and vice versa.
*
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@spreadspace.org>
+ * Copyright (C) 2010-2013 Christian Pointner <equinox@spreadspace.org>
*
* This file is part of tcpproxy.
*
diff --git a/src/clients.c b/src/clients.c
index 869733b..7dd6a85 100644
--- a/src/clients.c
+++ b/src/clients.c
@@ -7,7 +7,7 @@
* endpoints and vice versa.
*
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@spreadspace.org>
+ * Copyright (C) 2010-2013 Christian Pointner <equinox@spreadspace.org>
*
* This file is part of tcpproxy.
*
diff --git a/src/clients.h b/src/clients.h
index 8085b97..febc91c 100644
--- a/src/clients.h
+++ b/src/clients.h
@@ -1,14 +1,14 @@
/*
* tcpproxy
*
- * tcpproxy is a simple tcp connection proxy which combines the
- * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
- * IPv6 and also supports connections from IPv6 to IPv4
+ * tcpproxy is a simple tcp connection proxy which combines the
+ * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
+ * IPv6 and also supports connections from IPv6 to IPv4
* endpoints and vice versa.
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@spreadspace.org>
- *
+ *
+ * Copyright (C) 2010-2013 Christian Pointner <equinox@spreadspace.org>
+ *
* This file is part of tcpproxy.
*
* tcpproxy is free software: you can redistribute it and/or modify
diff --git a/src/configure b/src/configure
index aa9cb83..482c894 100755
--- a/src/configure
+++ b/src/configure
@@ -8,7 +8,7 @@
# endpoints and vice versa.
#
#
-# Copyright (C) 2010-2011 Christian Pointner <equinox@spreadspace.org>
+# Copyright (C) 2010-2013 Christian Pointner <equinox@spreadspace.org>
#
# This file is part of tcpproxy.
#
diff --git a/src/daemon.h b/src/daemon.h
index ebb7780..42f59a6 100644
--- a/src/daemon.h
+++ b/src/daemon.h
@@ -1,14 +1,14 @@
/*
* tcpproxy
*
- * tcpproxy is a simple tcp connection proxy which combines the
- * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
- * IPv6 and also supports connections from IPv6 to IPv4
+ * tcpproxy is a simple tcp connection proxy which combines the
+ * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
+ * IPv6 and also supports connections from IPv6 to IPv4
* endpoints and vice versa.
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@spreadspace.org>
- *
+ *
+ * Copyright (C) 2010-2013 Christian Pointner <equinox@spreadspace.org>
+ *
* This file is part of tcpproxy.
*
* tcpproxy is free software: you can redistribute it and/or modify
@@ -164,4 +164,3 @@ void daemonize()
}
#endif
-
diff --git a/src/datatypes.h b/src/datatypes.h
index deac84d..328829b 100644
--- a/src/datatypes.h
+++ b/src/datatypes.h
@@ -1,14 +1,14 @@
/*
* tcpproxy
*
- * tcpproxy is a simple tcp connection proxy which combines the
- * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
- * IPv6 and also supports connections from IPv6 to IPv4
+ * tcpproxy is a simple tcp connection proxy which combines the
+ * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
+ * IPv6 and also supports connections from IPv6 to IPv4
* endpoints and vice versa.
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@spreadspace.org>
- *
+ *
+ * Copyright (C) 2010-2013 Christian Pointner <equinox@spreadspace.org>
+ *
* This file is part of tcpproxy.
*
* tcpproxy is free software: you can redistribute it and/or modify
diff --git a/src/listener.c b/src/listener.c
index abb0f6f..02dd149 100644
--- a/src/listener.c
+++ b/src/listener.c
@@ -7,7 +7,7 @@
* endpoints and vice versa.
*
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@spreadspace.org>
+ * Copyright (C) 2010-2013 Christian Pointner <equinox@spreadspace.org>
*
* This file is part of tcpproxy.
*
diff --git a/src/listener.h b/src/listener.h
index 6b95498..d7319c2 100644
--- a/src/listener.h
+++ b/src/listener.h
@@ -1,14 +1,14 @@
/*
* tcpproxy
*
- * tcpproxy is a simple tcp connection proxy which combines the
- * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
- * IPv6 and also supports connections from IPv6 to IPv4
+ * tcpproxy is a simple tcp connection proxy which combines the
+ * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
+ * IPv6 and also supports connections from IPv6 to IPv4
* endpoints and vice versa.
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@spreadspace.org>
- *
+ *
+ * Copyright (C) 2010-2013 Christian Pointner <equinox@spreadspace.org>
+ *
* This file is part of tcpproxy.
*
* tcpproxy is free software: you can redistribute it and/or modify
diff --git a/src/log.c b/src/log.c
index dd75cea..9354ffa 100644
--- a/src/log.c
+++ b/src/log.c
@@ -1,14 +1,14 @@
/*
* tcpproxy
*
- * tcpproxy is a simple tcp connection proxy which combines the
- * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
- * IPv6 and also supports connections from IPv6 to IPv4
+ * tcpproxy is a simple tcp connection proxy which combines the
+ * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
+ * IPv6 and also supports connections from IPv6 to IPv4
* endpoints and vice versa.
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@spreadspace.org>
- *
+ *
+ * Copyright (C) 2010-2013 Christian Pointner <equinox@spreadspace.org>
+ *
* This file is part of tcpproxy.
*
* tcpproxy is free software: you can redistribute it and/or modify
@@ -77,7 +77,7 @@ int log_targets_target_exists(log_targets_t* targets, log_target_type_t type)
if(tmp->type_ == type)
return 1;
tmp = tmp->next_;
- }
+ }
return 0;
}
@@ -140,7 +140,7 @@ int log_targets_add(log_targets_t* targets, const char* conf)
log_target_t* tmp = targets->first_;
while(tmp->next_)
tmp = tmp->next_;
-
+
tmp->next_ = new_target;
}
return 0;
diff --git a/src/log.h b/src/log.h
index cde20ac..e7f2e75 100644
--- a/src/log.h
+++ b/src/log.h
@@ -1,14 +1,14 @@
/*
* tcpproxy
*
- * tcpproxy is a simple tcp connection proxy which combines the
- * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
- * IPv6 and also supports connections from IPv6 to IPv4
+ * tcpproxy is a simple tcp connection proxy which combines the
+ * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
+ * IPv6 and also supports connections from IPv6 to IPv4
* endpoints and vice versa.
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@spreadspace.org>
- *
+ *
+ * Copyright (C) 2010-2013 Christian Pointner <equinox@spreadspace.org>
+ *
* This file is part of tcpproxy.
*
* tcpproxy is free software: you can redistribute it and/or modify
diff --git a/src/log_targets.h b/src/log_targets.h
index 5ee3a39..8257a2d 100644
--- a/src/log_targets.h
+++ b/src/log_targets.h
@@ -1,14 +1,14 @@
/*
* tcpproxy
*
- * tcpproxy is a simple tcp connection proxy which combines the
- * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
- * IPv6 and also supports connections from IPv6 to IPv4
+ * tcpproxy is a simple tcp connection proxy which combines the
+ * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
+ * IPv6 and also supports connections from IPv6 to IPv4
* endpoints and vice versa.
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@spreadspace.org>
- *
+ *
+ * Copyright (C) 2010-2013 Christian Pointner <equinox@spreadspace.org>
+ *
* This file is part of tcpproxy.
*
* tcpproxy is free software: you can redistribute it and/or modify
@@ -34,7 +34,7 @@ static char* get_time_formatted()
{
char* time_string;
time_t t = time(NULL);
- if(t < 0)
+ if(t < 0)
time_string = "<time read error>";
else {
time_string = ctime(&t);
@@ -72,7 +72,7 @@ int log_target_syslog_init(log_target_t* self, const char* conf)
{
if(!self || (conf && conf[0] == 0))
return -1;
-
+
self->param_ = malloc(sizeof(log_target_syslog_param_t));
if(!self->param_)
return -2;
@@ -88,7 +88,7 @@ int log_target_syslog_init(log_target_t* self, const char* conf)
if(!len) {
free(self->param_);
return -1;
- }
+ }
logname = malloc(len+1);
if(logname) {
strncpy(logname, conf, len);
@@ -109,13 +109,13 @@ int log_target_syslog_init(log_target_t* self, const char* conf)
((log_target_syslog_param_t*)(self->param_))->facility_ = DAEMON;
return 0;
}
-
+
if(end[1] == 0 || end[1] == ',') {
free(logname);
free(self->param_);
return -1;
}
-
+
const char* start = end + 1;
end = strchr(start, ',');
int i;
@@ -150,7 +150,7 @@ void log_target_syslog_log(log_target_t* self, log_prio_t prio, const char* msg)
if(!self || !self->param_ || !self->opened_)
return;
- syslog((prio + 2) | ((log_target_syslog_param_t*)(self->param_))->facility_, "%s", msg);
+ syslog((prio + 2) | ((log_target_syslog_param_t*)(self->param_))->facility_, "%s", msg);
}
void log_target_syslog_close(log_target_t* self)
@@ -202,7 +202,7 @@ int log_target_file_init(log_target_t* self, const char* conf)
{
if(!self || (conf && conf[0] == 0))
return -1;
-
+
self->param_ = malloc(sizeof(log_target_file_param_t));
if(!self->param_)
return -2;
@@ -217,7 +217,7 @@ int log_target_file_init(log_target_t* self, const char* conf)
if(!len) {
free(self->param_);
return -1;
- }
+ }
logfilename = malloc(len+1);
if(logfilename) {
strncpy(logfilename, conf, len);
diff --git a/src/options.c b/src/options.c
index 116cb52..f2fc0b6 100644
--- a/src/options.c
+++ b/src/options.c
@@ -1,14 +1,14 @@
/*
* tcpproxy
*
- * tcpproxy is a simple tcp connection proxy which combines the
- * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
- * IPv6 and also supports connections from IPv6 to IPv4
+ * tcpproxy is a simple tcp connection proxy which combines the
+ * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
+ * IPv6 and also supports connections from IPv6 to IPv4
* endpoints and vice versa.
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@spreadspace.org>
- *
+ *
+ * Copyright (C) 2010-2013 Christian Pointner <equinox@spreadspace.org>
+ *
* This file is part of tcpproxy.
*
* tcpproxy is free software: you can redistribute it and/or modify
@@ -142,9 +142,9 @@ int options_parse_hex_string(const char* hex, buffer_t* buffer)
if(hex_len%2)
return 1;
- if(buffer->buf_)
+ if(buffer->buf_)
free(buffer->buf_);
-
+
buffer->length_ = hex_len/2;
buffer->buf_ = malloc(buffer->length_);
if(!buffer->buf_) {
@@ -206,7 +206,7 @@ int options_parse(options_t* opt, int argc, char* argv[])
PARSE_STRING_PARAM("-s","--source-addr", opt->source_addr_)
PARSE_STRING_PARAM("-c","--config", opt->config_file_)
PARSE_INT_PARAM("-b","--buffer-size", opt->buffer_size_)
- else
+ else
return i;
}
diff --git a/src/options.h b/src/options.h
index 9a45c47..8d17bba 100644
--- a/src/options.h
+++ b/src/options.h
@@ -1,14 +1,14 @@
/*
* tcpproxy
*
- * tcpproxy is a simple tcp connection proxy which combines the
- * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
- * IPv6 and also supports connections from IPv6 to IPv4
+ * tcpproxy is a simple tcp connection proxy which combines the
+ * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
+ * IPv6 and also supports connections from IPv6 to IPv4
* endpoints and vice versa.
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@spreadspace.org>
- *
+ *
+ * Copyright (C) 2010-2013 Christian Pointner <equinox@spreadspace.org>
+ *
* This file is part of tcpproxy.
*
* tcpproxy is free software: you can redistribute it and/or modify
diff --git a/src/sig_handler.c b/src/sig_handler.c
index 9ee05c4..cc7276d 100644
--- a/src/sig_handler.c
+++ b/src/sig_handler.c
@@ -1,14 +1,14 @@
/*
* tcpproxy
*
- * tcpproxy is a simple tcp connection proxy which combines the
- * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
- * IPv6 and also supports connections from IPv6 to IPv4
+ * tcpproxy is a simple tcp connection proxy which combines the
+ * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
+ * IPv6 and also supports connections from IPv6 to IPv4
* endpoints and vice versa.
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@spreadspace.org>
- *
+ *
+ * Copyright (C) 2010-2013 Christian Pointner <equinox@spreadspace.org>
+ *
* This file is part of tcpproxy.
*
* tcpproxy is free software: you can redistribute it and/or modify
diff --git a/src/sig_handler.h b/src/sig_handler.h
index eb19abf..efcdf66 100644
--- a/src/sig_handler.h
+++ b/src/sig_handler.h
@@ -1,14 +1,14 @@
/*
* tcpproxy
*
- * tcpproxy is a simple tcp connection proxy which combines the
- * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
- * IPv6 and also supports connections from IPv6 to IPv4
+ * tcpproxy is a simple tcp connection proxy which combines the
+ * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
+ * IPv6 and also supports connections from IPv6 to IPv4
* endpoints and vice versa.
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@spreadspace.org>
- *
+ *
+ * Copyright (C) 2010-2013 Christian Pointner <equinox@spreadspace.org>
+ *
* This file is part of tcpproxy.
*
* tcpproxy is free software: you can redistribute it and/or modify
diff --git a/src/slist.c b/src/slist.c
index 24da141..3195833 100644
--- a/src/slist.c
+++ b/src/slist.c
@@ -1,14 +1,14 @@
/*
* tcpproxy
*
- * tcpproxy is a simple tcp connection proxy which combines the
- * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
- * IPv6 and also supports connections from IPv6 to IPv4
+ * tcpproxy is a simple tcp connection proxy which combines the
+ * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
+ * IPv6 and also supports connections from IPv6 to IPv4
* endpoints and vice versa.
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@spreadspace.org>
- *
+ *
+ * Copyright (C) 2010-2013 Christian Pointner <equinox@spreadspace.org>
+ *
* This file is part of tcpproxy.
*
* tcpproxy is free software: you can redistribute it and/or modify
@@ -36,10 +36,10 @@ slist_element_t* slist_get_last(slist_element_t* first)
{
if(!first)
return NULL;
-
+
while(first->next_)
first = first->next_;
-
+
return first;
}
@@ -62,7 +62,7 @@ slist_element_t* slist_add(slist_t* lst, void* data)
slist_element_t* new_element = malloc(sizeof(slist_element_t));
if(!new_element)
return NULL;
-
+
new_element->data_ = data;
new_element->next_ = NULL;
@@ -70,7 +70,7 @@ slist_element_t* slist_add(slist_t* lst, void* data)
lst->first_ = new_element;
else
slist_get_last(lst->first_)->next_ = new_element;
-
+
return new_element;
}
@@ -104,7 +104,7 @@ void slist_clear(slist_t* lst)
{
if(!lst || !lst->first_)
return;
-
+
do {
slist_element_t* deletee = lst->first_;
lst->first_ = lst->first_->next_;
@@ -112,7 +112,7 @@ void slist_clear(slist_t* lst)
free(deletee);
}
while(lst->first_);
-
+
lst->first_ = NULL;
}
@@ -120,11 +120,11 @@ int slist_length(slist_t* lst)
{
if(!lst || !lst->first_)
return 0;
-
+
int len = 0;
slist_element_t* tmp;
for(tmp = lst->first_; tmp; tmp = tmp->next_)
len++;
-
+
return len;
}
diff --git a/src/slist.h b/src/slist.h
index f036bf3..bf6b394 100644
--- a/src/slist.h
+++ b/src/slist.h
@@ -1,14 +1,14 @@
/*
* tcpproxy
*
- * tcpproxy is a simple tcp connection proxy which combines the
- * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
- * IPv6 and also supports connections from IPv6 to IPv4
+ * tcpproxy is a simple tcp connection proxy which combines the
+ * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
+ * IPv6 and also supports connections from IPv6 to IPv4
* endpoints and vice versa.
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@spreadspace.org>
- *
+ *
+ * Copyright (C) 2010-2013 Christian Pointner <equinox@spreadspace.org>
+ *
* This file is part of tcpproxy.
*
* tcpproxy is free software: you can redistribute it and/or modify
diff --git a/src/string_list.c b/src/string_list.c
index e197749..8715f65 100644
--- a/src/string_list.c
+++ b/src/string_list.c
@@ -1,14 +1,14 @@
/*
* tcpproxy
*
- * tcpproxy is a simple tcp connection proxy which combines the
- * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
- * IPv6 and also supports connections from IPv6 to IPv4
+ * tcpproxy is a simple tcp connection proxy which combines the
+ * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
+ * IPv6 and also supports connections from IPv6 to IPv4
* endpoints and vice versa.
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@spreadspace.org>
- *
+ *
+ * Copyright (C) 2010-2013 Christian Pointner <equinox@spreadspace.org>
+ *
* This file is part of tcpproxy.
*
* tcpproxy is free software: you can redistribute it and/or modify
@@ -46,7 +46,7 @@ int string_list_add(string_list_t* list, const char* string)
{
if(!list)
return -1;
-
+
char* tmp = strdup(string);
if(slist_add(list, tmp) == NULL) {
free(tmp);
@@ -60,7 +60,7 @@ void string_list_print(string_list_t* list, const char* head, const char* tail)
{
if(!list)
return;
-
+
slist_element_t* tmp = list->first_;
while(tmp) {
printf("%s%s%s", head, (char*)(tmp->data_), tail);
diff --git a/src/string_list.h b/src/string_list.h
index e748e43..b60e7db 100644
--- a/src/string_list.h
+++ b/src/string_list.h
@@ -1,14 +1,14 @@
/*
* tcpproxy
*
- * tcpproxy is a simple tcp connection proxy which combines the
- * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
- * IPv6 and also supports connections from IPv6 to IPv4
+ * tcpproxy is a simple tcp connection proxy which combines the
+ * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
+ * IPv6 and also supports connections from IPv6 to IPv4
* endpoints and vice versa.
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@spreadspace.org>
- *
+ *
+ * Copyright (C) 2010-2013 Christian Pointner <equinox@spreadspace.org>
+ *
* This file is part of tcpproxy.
*
* tcpproxy is free software: you can redistribute it and/or modify
diff --git a/src/tcp.c b/src/tcp.c
index 1ab751c..77dbf26 100644
--- a/src/tcp.c
+++ b/src/tcp.c
@@ -1,14 +1,14 @@
/*
* tcpproxy
*
- * tcpproxy is a simple tcp connection proxy which combines the
- * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
- * IPv6 and also supports connections from IPv6 to IPv4
+ * tcpproxy is a simple tcp connection proxy which combines the
+ * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
+ * IPv6 and also supports connections from IPv6 to IPv4
* endpoints and vice versa.
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@spreadspace.org>
- *
+ *
+ * Copyright (C) 2010-2013 Christian Pointner <equinox@spreadspace.org>
+ *
* This file is part of tcpproxy.
*
* tcpproxy is free software: you can redistribute it and/or modify
@@ -43,13 +43,13 @@ char* tcp_endpoint_to_string(tcp_endpoint_t e)
{
char addrstr[INET6_ADDRSTRLEN + 1], portstr[6], *ret;
char addrport_sep = ':';
-
+
switch(e.addr_.ss_family)
{
case AF_INET: addrport_sep = ':'; break;
case AF_INET6: addrport_sep = '.'; break;
case AF_UNSPEC: return NULL;
- default: return strdup("unknown address type");
+ default: return strdup("unknown address type");
}
int errcode = getnameinfo((struct sockaddr *)&(e.addr_), e.len_, addrstr, sizeof(addrstr), portstr, sizeof(portstr), NI_NUMERICHOST | NI_NUMERICSERV);
diff --git a/src/tcp.h b/src/tcp.h
index a81bd3a..677d1c2 100644
--- a/src/tcp.h
+++ b/src/tcp.h
@@ -1,14 +1,14 @@
/*
* tcpproxy
*
- * tcpproxy is a simple tcp connection proxy which combines the
- * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
- * IPv6 and also supports connections from IPv6 to IPv4
+ * tcpproxy is a simple tcp connection proxy which combines the
+ * features of rinetd and 6tunnel. tcpproxy supports IPv4 and
+ * IPv6 and also supports connections from IPv6 to IPv4
* endpoints and vice versa.
- *
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@spreadspace.org>
- *
+ *
+ * Copyright (C) 2010-2013 Christian Pointner <equinox@spreadspace.org>
+ *
* This file is part of tcpproxy.
*
* tcpproxy is free software: you can redistribute it and/or modify
diff --git a/src/tcpproxy.c b/src/tcpproxy.c
index 382b8eb..baa5214 100644
--- a/src/tcpproxy.c
+++ b/src/tcpproxy.c
@@ -7,7 +7,7 @@
* endpoints and vice versa.
*
*
- * Copyright (C) 2010-2011 Christian Pointner <equinox@spreadspace.org>
+ * Copyright (C) 2010-2013 Christian Pointner <equinox@spreadspace.org>
*
* This file is part of tcpproxy.
*
@@ -238,5 +238,5 @@ int main(int argc, char* argv[])
log_close();
- return ret;
+ return ret;
}