diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2012-07-05 00:17:48 +0200 |
---|---|---|
committer | Gaurav Sinha <gaurav.sinha@vyatta.com> | 2012-07-06 17:03:18 -0700 |
commit | 141fb636bc0bea8e31b65414ce962b06c56028f2 (patch) | |
tree | e4ba42cf773fad7a60f89743dbcba7ea9ef29cec | |
parent | 5bbd235a4a30b26f477b73b2779619a5f20ad73b (diff) | |
download | conntrack-tools-141fb636bc0bea8e31b65414ce962b06c56028f2.tar.gz conntrack-tools-141fb636bc0bea8e31b65414ce962b06c56028f2.zip |
conntrackd: add bugtrap notice in case of flush while commit in progress
Flushing the external cache, ie. conntrackd -f, while commit is in progress
is not allowed anymore, ie. conntrackd -c.
Note that conntrackd -c is synchronous. Thus, it returns control to the
caller once the commit has finished.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
(cherry picked from commit 8648ae6d08bb84030c2c3519454532f6e04e31d9)
(cherry picked from commit 3611b5f5992837224205361c25cfed55c47af8c4)
-rw-r--r-- | src/sync-mode.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/sync-mode.c b/src/sync-mode.c index b5707d5..430a9b3 100644 --- a/src/sync-mode.c +++ b/src/sync-mode.c @@ -613,6 +613,12 @@ static int local_handler_sync(int fd, int type, void *data) } break; case CT_FLUSH_CACHE: + /* if we're still committing, abort this command */ + if (STATE_SYNC(commit).clientfd != -1) { + dlog(LOG_ERR, "ignoring flush command, " + "commit still in progress"); + break; + } /* inmediate flush, remove pending flush scheduled if any */ del_alarm(&STATE_SYNC(reset_cache_alarm)); dlog(LOG_NOTICE, "flushing caches"); @@ -626,6 +632,12 @@ static int local_handler_sync(int fd, int type, void *data) STATE(mode)->internal->ct.flush(); break; case CT_FLUSH_EXT_CACHE: + /* if we're still committing, abort this command */ + if (STATE_SYNC(commit).clientfd != -1) { + dlog(LOG_ERR, "ignoring flush command, " + "commit still in progress"); + break; + } dlog(LOG_NOTICE, "flushing external cache"); STATE_SYNC(external)->ct.flush(); break; @@ -689,6 +701,12 @@ static int local_handler_sync(int fd, int type, void *data) local_commit(fd); break; case ALL_FLUSH_CACHE: + /* if we're still committing, abort this command */ + if (STATE_SYNC(commit).clientfd != -1) { + dlog(LOG_ERR, "ignoring flush command, " + "commit still in progress"); + break; + } dlog(LOG_NOTICE, "flushing caches"); STATE(mode)->internal->ct.flush(); STATE_SYNC(external)->ct.flush(); |