summaryrefslogtreecommitdiff
path: root/src/sync-mode.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2009-02-14 21:26:26 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2009-02-14 21:26:26 +0100
commitcedd1976acefbbf85d95a67a23c72ff011466d62 (patch)
tree2b4cc1ecf8290093418a4cfc7d80be955d71fc83 /src/sync-mode.c
parent22aa75829c56d06e8c4964ce84553af5d053664a (diff)
downloadconntrack-tools-cedd1976acefbbf85d95a67a23c72ff011466d62.tar.gz
conntrack-tools-cedd1976acefbbf85d95a67a23c72ff011466d62.zip
src: use resync handler for polling instead of dump handler
This patch moves the polling logic into the resync handler. The dump handler action depended on the daemon working mode (polling or event-driven) resulting in an inconsistent behaviour. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/sync-mode.c')
-rw-r--r--src/sync-mode.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/sync-mode.c b/src/sync-mode.c
index 63948f1..74eb36e 100644
--- a/src/sync-mode.c
+++ b/src/sync-mode.c
@@ -507,8 +507,6 @@ static void mcast_send_sync(struct cache_object *obj, int query)
static void dump_sync(struct nf_conntrack *ct)
{
- struct cache_object *obj;
-
/* This is required by kernels < 2.6.20 */
nfct_attr_unset(ct, ATTR_ORIG_COUNTER_BYTES);
nfct_attr_unset(ct, ATTR_ORIG_COUNTER_PACKETS);
@@ -516,13 +514,8 @@ static void dump_sync(struct nf_conntrack *ct)
nfct_attr_unset(ct, ATTR_REPL_COUNTER_PACKETS);
nfct_attr_unset(ct, ATTR_USE);
- obj = cache_update_force(STATE_SYNC(internal), ct);
- if ((CONFIG(flags) & CTD_POLL)) {
- if (obj != NULL && obj->status == C_OBJ_NEW) {
- debug_ct(ct, "poll");
- mcast_send_sync(obj, NET_T_STATE_NEW);
- }
- }
+ if (cache_update_force(STATE_SYNC(internal), ct))
+ debug_ct(ct, "dump");
}
static int purge_step(void *data1, void *data2)
@@ -566,11 +559,20 @@ static int resync_sync(enum nf_conntrack_msg_type type,
nfct_attr_unset(ct, ATTR_REPL_COUNTER_PACKETS);
nfct_attr_unset(ct, ATTR_USE);
- if ((obj = cache_update_force(STATE_SYNC(internal), ct))) {
- debug_ct(obj->ct, "resync");
+ obj = cache_update_force(STATE_SYNC(internal), ct);
+ if (obj == NULL)
+ return NFCT_CB_CONTINUE;
+
+ switch (obj->status) {
+ case C_OBJ_NEW:
+ debug_ct(ct, "resync");
+ mcast_send_sync(obj, NET_T_STATE_NEW);
+ break;
+ case C_OBJ_ALIVE:
+ debug_ct(ct, "resync");
mcast_send_sync(obj, NET_T_STATE_UPD);
+ break;
}
-
return NFCT_CB_CONTINUE;
}