[conntrack-tools] conntrackd: fix re-connect with multiple TCP channels
Pablo Neira
netfilter-cvslog-bounces at lists.netfilter.org
Wed Sep 23 15:19:15 CEST 2009
Gitweb: http://git.netfilter.org/cgi-bin/gitweb.cgi?p=conntrack-tools.git;a=commit;h=da1160ad2c6e05c9e5594e17e5e35cbb461871e4
commit da1160ad2c6e05c9e5594e17e5e35cbb461871e4
Author: Pablo Neira Ayuso <pablo at netfilter.org>
AuthorDate: Wed Sep 23 15:18:30 2009 +0200
Commit: Pablo Neira Ayuso <pablo at netfilter.org>
CommitDate: Wed Sep 23 15:18:30 2009 +0200
conntrackd: fix re-connect with multiple TCP channels
This patch fixes a bug in the TCP support that breaks
re-connections of the client side if several TCP
channels are used in the configuration file.
Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>
via da1160ad2c6e05c9e5594e17e5e35cbb461871e4 (commit)
from fc61453d3f30b440e04bb6b3781e1e2348c85cfb (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit da1160ad2c6e05c9e5594e17e5e35cbb461871e4
Author: Pablo Neira Ayuso <pablo at netfilter.org>
Date: Wed Sep 23 15:18:30 2009 +0200
conntrackd: fix re-connect with multiple TCP channels
This patch fixes a bug in the TCP support that breaks
re-connections of the client side if several TCP
channels are used in the configuration file.
Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>
-----------------------------------------------------------------------
include/tcp.h | 1 +
src/tcp.c | 10 +++++-----
2 files changed, 6 insertions(+), 5 deletions(-)
This patch fixes a bug in the TCP support that breaks
re-connections of the client side if several TCP
channels are used in the configuration file.
Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>
diff --git a/include/tcp.h b/include/tcp.h
index 1b1d391..2f0fd0a 100644
--- a/include/tcp.h
+++ b/include/tcp.h
@@ -49,6 +49,7 @@ struct tcp_sock {
} addr;
socklen_t sockaddr_len;
struct tcp_stats stats;
+ struct tcp_conf *conf;
};
struct tcp_sock *tcp_server_create(struct tcp_conf *conf);
diff --git a/src/tcp.c b/src/tcp.c
index 2b7ca19..ce2cd6f 100644
--- a/src/tcp.c
+++ b/src/tcp.c
@@ -35,6 +35,8 @@ struct tcp_sock *tcp_server_create(struct tcp_conf *c)
if (m == NULL)
return NULL;
+ m->conf = c;
+
switch(c->ipproto) {
case AF_INET:
m->addr.ipv4.sin_family = AF_INET;
@@ -222,18 +224,16 @@ tcp_client_init(struct tcp_sock *m, struct tcp_conf *c)
return 0;
}
-static struct tcp_conf *tcp_client_conf; /* XXX: need this to re-connect. */
-
struct tcp_sock *tcp_client_create(struct tcp_conf *c)
{
struct tcp_sock *m;
- tcp_client_conf = c;
-
m = calloc(sizeof(struct tcp_sock), 1);
if (m == NULL)
return NULL;
+ m->conf = c;
+
if (tcp_client_init(m, c) == -1) {
free(m);
return NULL;
@@ -318,7 +318,7 @@ ssize_t tcp_send(struct tcp_sock *m, const void *data, int size)
if (ret == -1) {
if (errno == EPIPE || errno == ECONNRESET) {
close(m->fd);
- tcp_client_init(m, tcp_client_conf);
+ tcp_client_init(m, m->conf);
m->state = TCP_CLIENT_DISCONNECTED;
m->stats.error++;
} else {
More information about the netfilter-cvslog
mailing list