summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2008-10-20 14:17:13 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2008-10-20 14:17:13 +0200
commit5000afe7e1a3ae4a14995e051d3ee716d8a6c784 (patch)
treee35da6beee8c5fc3b08de968d255bd131a7d9802
parent9c2fd73489f516eb56f8fe216913ea70e3b4a76a (diff)
notrack: fix double receival of resync requests
This patch fixes double insertion in the tx_list if we receive two (or more) consecutive resync request in short time. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--src/sync-notrack.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/sync-notrack.c b/src/sync-notrack.c
index 2b1bc13..c7ac9b5 100644
--- a/src/sync-notrack.c
+++ b/src/sync-notrack.c
@@ -36,8 +36,26 @@ struct cache_notrack {
struct list_head tx_list;
};
+static void cache_notrack_add(struct us_conntrack *u, void *data)
+{
+ struct cache_notrack *cn = data;
+ INIT_LIST_HEAD(&cn->tx_list);
+}
+
+static void cache_notrack_del(struct us_conntrack *u, void *data)
+{
+ struct cache_notrack *cn = data;
+
+ if (!list_empty(&cn->tx_list)) {
+ list_del(&cn->tx_list);
+ tx_list_len--;
+ }
+}
+
static struct cache_extra cache_notrack_extra = {
.size = sizeof(struct cache_notrack),
+ .add = cache_notrack_add,
+ .destroy = cache_notrack_del
};
static void tx_queue_add_ctlmsg(uint32_t flags, uint32_t from, uint32_t to)
@@ -73,6 +91,9 @@ static int do_cache_to_tx(void *data1, void *data2)
struct us_conntrack *u = data2;
struct cache_notrack *cn = cache_get_extra(STATE_SYNC(internal), u);
+ if (!list_empty(&cn->tx_list))
+ return 0;
+
/* add to tx list */
list_add_tail(&cn->tx_list, &tx_list);
tx_list_len++;