[conntrack-tools] conntrackd: fix `conntrackd -c' if external cache is disabled

Pablo Neira netfilter-cvslog-bounces at lists.netfilter.org
Wed Feb 17 00:47:34 CET 2010


Gitweb:		http://git.netfilter.org/cgi-bin/gitweb.cgi?p=conntrack-tools.git;a=commit;h=13c612efc51cf5f8d58423c59323df13739315d6
commit 13c612efc51cf5f8d58423c59323df13739315d6
Author:     Pablo Neira Ayuso <pablo at netfilter.org>
AuthorDate: Wed Feb 17 00:39:44 2010 +0100
Commit:     Pablo Neira Ayuso <pablo at netfilter.org>
CommitDate: Wed Feb 17 00:39:44 2010 +0100

    conntrackd: fix `conntrackd -c' if external cache is disabled
    
    This patch fixes a hung that occurs if you invoke `conntrackd -c'
    and you have disabled the external cache.
    
    Note that `conntrackd -c' does nothing since there is no entries
    in the external cache to be committed.
    
    Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>
       via  13c612efc51cf5f8d58423c59323df13739315d6 (commit)
      from  8c88b695289c1f3fca604a30e3ca59dd1c957377 (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 13c612efc51cf5f8d58423c59323df13739315d6
Author: Pablo Neira Ayuso <pablo at netfilter.org>
Date:   Wed Feb 17 00:39:44 2010 +0100

    conntrackd: fix `conntrackd -c' if external cache is disabled
    
    This patch fixes a hung that occurs if you invoke `conntrackd -c'
    and you have disabled the external cache.
    
    Note that `conntrackd -c' does nothing since there is no entries
    in the external cache to be committed.
    
    Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>

-----------------------------------------------------------------------

 include/external.h    |    2 +-
 src/external_cache.c  |    4 +++-
 src/external_inject.c |    4 +++-
 src/sync-mode.c       |    4 +---
 4 files changed, 8 insertions(+), 6 deletions(-)
This patch fixes a hung that occurs if you invoke `conntrackd -c'
and you have disabled the external cache.

Note that `conntrackd -c' does nothing since there is no entries
in the external cache to be committed.

Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>

diff --git a/include/external.h b/include/external.h
index 938941a..6619967 100644
--- a/include/external.h
+++ b/include/external.h
@@ -13,7 +13,7 @@ struct external_handler {
 
 	void	(*dump)(int fd, int type);
 	void	(*flush)(void);
-	void	(*commit)(struct nfct_handle *h, int fd);
+	int	(*commit)(struct nfct_handle *h, int fd);
 	void	(*stats)(int fd);
 	void	(*stats_ext)(int fd);
 };
diff --git a/src/external_cache.c b/src/external_cache.c
index c70c818..c1181dc 100644
--- a/src/external_cache.c
+++ b/src/external_cache.c
@@ -88,9 +88,11 @@ static void external_cache_dump(int fd, int type)
 	cache_dump(external, fd, type);
 }
 
-static void external_cache_commit(struct nfct_handle *h, int fd)
+static int external_cache_commit(struct nfct_handle *h, int fd)
 {
 	cache_commit(external, h, fd);
+	/* Keep the client socket open, we want synchronous commits. */
+	return LOCAL_RET_STOLEN;
 }
 
 static void external_cache_flush(void)
diff --git a/src/external_inject.c b/src/external_inject.c
index a54bb13..56e24a3 100644
--- a/src/external_inject.c
+++ b/src/external_inject.c
@@ -145,8 +145,10 @@ static void external_inject_dump(int fd, int type)
 {
 }
 
-static void external_inject_commit(struct nfct_handle *h, int fd)
+static int external_inject_commit(struct nfct_handle *h, int fd)
 {
+	/* close the commit socket. */
+	return LOCAL_RET_OK;
 }
 
 static void external_inject_flush(void)
diff --git a/src/sync-mode.c b/src/sync-mode.c
index ecc2f0d..c12a34a 100644
--- a/src/sync-mode.c
+++ b/src/sync-mode.c
@@ -497,9 +497,7 @@ static int local_handler_sync(int fd, int type, void *data)
 		del_alarm(&STATE_SYNC(reset_cache_alarm));
 
 		dlog(LOG_NOTICE, "committing external cache");
-		STATE_SYNC(external)->commit(STATE_SYNC(commit).h, fd);
-		/* Keep the client socket open, we want synchronous commits. */
-		ret = LOCAL_RET_STOLEN;
+		ret = STATE_SYNC(external)->commit(STATE_SYNC(commit).h, fd);
 		break;
 	case RESET_TIMERS:
 		if (!alarm_pending(&STATE_SYNC(reset_cache_alarm))) {



More information about the netfilter-cvslog mailing list