summaryrefslogtreecommitdiffstats
path: root/src/stats-mode.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2009-10-21 01:43:07 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2009-10-21 01:43:07 +0200
commit8ad5df6121c46753a6d12fafa5ab9da309ddb721 (patch)
tree28562a78fe688e03c066ffcc70524cc1f778a322 /src/stats-mode.c
parent6e7166b7d396884eedbaf250f8a06864f63c07fc (diff)
conntrackd: add `DisableInternalCache' clause
This patch adds the clause `DisableInternalCache' that allows you to bypass the internal cache. This clause can only be used with the notrack synchronization mode. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/stats-mode.c')
-rw-r--r--src/stats-mode.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/stats-mode.c b/src/stats-mode.c
index 5cfb638..0403ce2 100644
--- a/src/stats-mode.c
+++ b/src/stats-mode.c
@@ -21,6 +21,7 @@
#include "cache.h"
#include "log.h"
#include "conntrackd.h"
+#include "internal.h"
#include <errno.h>
#include <string.h>
@@ -87,7 +88,7 @@ static int local_handler_stats(int fd, int type, void *data)
return ret;
}
-static void dump_stats(struct nf_conntrack *ct)
+static void populate_stats(struct nf_conntrack *ct)
{
nfct_attr_unset(ct, ATTR_ORIG_COUNTER_BYTES);
nfct_attr_unset(ct, ATTR_ORIG_COUNTER_PACKETS);
@@ -134,11 +135,9 @@ static int purge_step(void *data1, void *data2)
return 0;
}
-static int purge_stats(void)
+static void purge_stats(void)
{
cache_iterate(STATE_STATS(cache), NULL, purge_step);
-
- return 0;
}
static void
@@ -188,15 +187,20 @@ event_destroy_stats(struct nf_conntrack *ct, int origin)
return 0;
}
+static struct internal_handler internal_cache_stats = {
+ .flags = INTERNAL_F_POPULATE | INTERNAL_F_RESYNC,
+ .populate = populate_stats,
+ .resync = resync_stats,
+ .purge = purge_stats,
+ .new = event_new_stats,
+ .update = event_update_stats,
+ .destroy = event_destroy_stats
+};
+
struct ct_mode stats_mode = {
.init = init_stats,
.run = NULL,
.local = local_handler_stats,
.kill = kill_stats,
- .dump = dump_stats,
- .resync = resync_stats,
- .purge = purge_stats,
- .event_new = event_new_stats,
- .event_upd = event_update_stats,
- .event_dst = event_destroy_stats
+ .internal = &internal_cache_stats,
};