summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2008-12-21 19:47:02 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2008-12-21 19:47:02 +0100
commit036a0a65c6a3ba95cff48035a25e0bdba6aa0452 (patch)
tree008c4c4f641457dddb126484d84025b507cd7a63 /include
parent7b3f57d5007dd2cf4127c2c3a9a7cd0f64d5d6e9 (diff)
src: add cache statistics via `-s cache'
This patch adds cache statistics that you can check via `conntrackd -s cache'. This information is useful for trouble-shooting. This patch replaces several log messages that can be triggered in runtime. The idea behind this patch is to avoid log message flooding under errors. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include')
-rw-r--r--include/cache.h38
-rw-r--r--include/conntrackd.h1
2 files changed, 24 insertions, 15 deletions
diff --git a/include/cache.h b/include/cache.h
index 45c3b7e..ebed70a 100644
--- a/include/cache.h
+++ b/include/cache.h
@@ -50,21 +50,28 @@ struct cache {
unsigned int extra_offset;
/* statistics */
- unsigned int active;
-
- unsigned int add_ok;
- unsigned int del_ok;
- unsigned int upd_ok;
-
- unsigned int add_fail;
- unsigned int del_fail;
- unsigned int upd_fail;
-
- unsigned int commit_ok;
- unsigned int commit_exist;
- unsigned int commit_fail;
-
- unsigned int flush;
+ struct {
+ uint32_t active;
+
+ uint32_t add_ok;
+ uint32_t del_ok;
+ uint32_t upd_ok;
+
+ uint32_t add_fail;
+ uint32_t del_fail;
+ uint32_t upd_fail;
+
+ uint32_t add_fail_enomem;
+ uint32_t add_fail_enospc;
+ uint32_t del_fail_enoent;
+ uint32_t upd_fail_enoent;
+
+ uint32_t commit_ok;
+ uint32_t commit_exist;
+ uint32_t commit_fail;
+
+ uint32_t flush;
+ } stats;
};
struct cache_extra {
@@ -88,6 +95,7 @@ int __cache_del_timer(struct cache *c, struct us_conntrack *u, int timeout);
struct us_conntrack *cache_find(struct cache *c, struct nf_conntrack *ct);
int cache_test(struct cache *c, struct nf_conntrack *ct);
void cache_stats(const struct cache *c, int fd);
+void cache_stats_extended(const struct cache *c, int fd);
struct us_conntrack *cache_get_conntrack(struct cache *, void *);
void *cache_get_extra(struct cache *, void *);
void cache_iterate(struct cache *c, void *data, int (*iterate)(void *data1, void *data2));
diff --git a/include/conntrackd.h b/include/conntrackd.h
index 7199985..98934ce 100644
--- a/include/conntrackd.h
+++ b/include/conntrackd.h
@@ -27,6 +27,7 @@
#define RESET_TIMERS 26 /* reset kernel timers */
#define DEBUG_INFO 27 /* show debug info (if any) */
#define STATS_NETWORK 28 /* extended network stats */
+#define STATS_CACHE 29 /* extended cache stats */
#define DEFAULT_CONFIGFILE "/etc/conntrackd/conntrackd.conf"
#define DEFAULT_LOCKFILE "/var/lock/conntrackd.lock"