[netfilter-cvslog] r6889 - in trunk/conntrack-tools: . src

pablo at netfilter.org pablo at netfilter.org
Mon Jun 25 16:55:18 CEST 2007


Author: pablo at netfilter.org
Date: 2007-06-25 16:55:18 +0200 (Mon, 25 Jun 2007)
New Revision: 6889

Modified:
   trunk/conntrack-tools/ChangeLog
   trunk/conntrack-tools/src/cache_iterators.c
   trunk/conntrack-tools/src/sync-mode.c
Log:
fork when internal/external dump and commit requests are received


Modified: trunk/conntrack-tools/ChangeLog
===================================================================
--- trunk/conntrack-tools/ChangeLog	2007-06-25 14:33:07 UTC (rev 6888)
+++ trunk/conntrack-tools/ChangeLog	2007-06-25 14:55:18 UTC (rev 6889)
@@ -15,7 +15,7 @@
 o commit phase: if conntrack exists, update it
 o local requests return EXIT_FAILURE if it can't connect to the daemon
 o remove several debug statements
-o fork when internal/external dump cache requests are received
+o fork when internal/external dump and commit requests are received
 o lots of cleanups
 
 = conntrack =

Modified: trunk/conntrack-tools/src/cache_iterators.c
===================================================================
--- trunk/conntrack-tools/src/cache_iterators.c	2007-06-25 14:33:07 UTC (rev 6888)
+++ trunk/conntrack-tools/src/cache_iterators.c	2007-06-25 14:55:18 UTC (rev 6889)
@@ -71,9 +71,8 @@
 		.type	= type
 	};
 
-	lock();
+	/* does not require locking: called inside fork() */
 	hashtable_iterate(c->h, (void *) &tmp, do_dump);
-	unlock();
 }
 
 static int do_commit(void *data1, void *data2)
@@ -147,9 +146,8 @@
 	unsigned int commit_exist = c->commit_exist;
 	unsigned int commit_fail = c->commit_fail;
 
-	lock();
+	/* does not require locking: called inside fork() */
 	hashtable_iterate(c->h, c, do_commit);
-	unlock();
 
 	/* calculate new entries committed */
 	commit_ok = c->commit_ok - commit_ok;

Modified: trunk/conntrack-tools/src/sync-mode.c
===================================================================
--- trunk/conntrack-tools/src/sync-mode.c	2007-06-25 14:33:07 UTC (rev 6888)
+++ trunk/conntrack-tools/src/sync-mode.c	2007-06-25 14:55:18 UTC (rev 6889)
@@ -244,8 +244,12 @@
 		}
 		break;
 	case COMMIT:
-		dlog(STATE(log), "[REQ] commit external cache to master table");
-		cache_commit(STATE_SYNC(external));
+		ret = fork();
+		if (ret == 0) {
+			dlog(STATE(log), "[REQ] committing external cache");
+			cache_commit(STATE_SYNC(external));
+			exit(EXIT_SUCCESS);
+		}
 		break;
 	case FLUSH_CACHE:
 		dlog(STATE(log), "[REQ] flushing caches");




More information about the netfilter-cvslog mailing list