summaryrefslogtreecommitdiffstats
path: root/src/sync-mode.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2009-01-17 18:03:50 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2009-01-17 18:03:50 +0100
commitb1d00262f999a597fa24af3298195db9cf52b790 (patch)
tree1d4219c35ff62fa663339e0c6a514f954f60f8b4 /src/sync-mode.c
parent786f37040cdcb64b24eb0b437307ed5e208f717f (diff)
sync: enqueue state updates to tx_queue
With this patch, all the states updates are enqueued in the tx_queue. Thus, there's a single output path. This patch adds a simple refcounting mechanism to note when an object is sitting in the txqueue. This patch also removes the alarm that is required by the ftfw approach. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/sync-mode.c')
-rw-r--r--src/sync-mode.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/sync-mode.c b/src/sync-mode.c
index 5ae9062..00e2f7b 100644
--- a/src/sync-mode.c
+++ b/src/sync-mode.c
@@ -442,14 +442,7 @@ static void dump_sync(struct nf_conntrack *ct)
static void mcast_send_sync(struct cache_object *obj, int query)
{
- struct nethdr *net;
-
- net = BUILD_NETMSG(obj->ct, query);
-
- if (STATE_SYNC(sync)->send)
- STATE_SYNC(sync)->send(net, obj);
-
- mcast_buffered_send_netmsg(STATE_SYNC(mcast_client), net);
+ STATE_SYNC(sync)->enqueue(obj, query);
}
static int purge_step(void *data1, void *data2)
@@ -461,8 +454,11 @@ static int purge_step(void *data1, void *data2)
ret = nfct_query(h, NFCT_Q_GET, obj->ct);
if (ret == -1 && errno == ENOENT) {
debug_ct(obj->ct, "overrun purge resync");
- mcast_send_sync(obj, NET_T_STATE_DEL);
- cache_del_timer(STATE_SYNC(internal), obj, CONFIG(del_timeout));
+ if (obj->status != C_OBJ_DEAD) {
+ cache_object_set_status(obj, C_OBJ_DEAD);
+ mcast_send_sync(obj, NET_T_STATE_DEL);
+ cache_object_put(obj);
+ }
}
return 0;
@@ -552,8 +548,11 @@ static int event_destroy_sync(struct nf_conntrack *ct)
debug_ct(ct, "can't destroy");
return 0;
}
- mcast_send_sync(obj, NET_T_STATE_DEL);
- cache_del_timer(STATE_SYNC(internal), obj, CONFIG(del_timeout));
+ if (obj->status != C_OBJ_DEAD) {
+ cache_object_set_status(obj, C_OBJ_DEAD);
+ mcast_send_sync(obj, NET_T_STATE_DEL);
+ cache_object_put(obj);
+ }
debug_ct(ct, "internal destroy");
return 1;
}