summaryrefslogtreecommitdiff
path: root/src/cache_iterators.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2009-01-25 17:53:02 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2009-01-25 17:53:02 +0100
commit1c9faf8c218bc7ff4617557383e4116f1adb11e5 (patch)
treef189019456f3399d3a47d3471f406956381c65b7 /src/cache_iterators.c
parenteec8fdf57f34fe0d80b884ad0e376ed24c63ffcc (diff)
downloadconntrack-tools-1c9faf8c218bc7ff4617557383e4116f1adb11e5.tar.gz
conntrack-tools-1c9faf8c218bc7ff4617557383e4116f1adb11e5.zip
cache: move lifetime feature to main cache code
The lifetime feature is used by all working modes, it is useful to know how long it has been an entry living in the cache. This patch moves the lifetime feature to the main caching code. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/cache_iterators.c')
-rw-r--r--src/cache_iterators.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cache_iterators.c b/src/cache_iterators.c
index 4bf518a..3a1ec72 100644
--- a/src/cache_iterators.c
+++ b/src/cache_iterators.c
@@ -26,6 +26,7 @@
#include <sched.h>
#include <errno.h>
#include <string.h>
+#include <time.h>
struct __dump_container {
int fd;
@@ -75,6 +76,11 @@ static int do_dump(void *data1, struct hashtable_node *n)
data += obj->cache->features[i]->size;
}
}
+ if (container->type != NFCT_O_XML) {
+ long tm = time(NULL);
+ size += sprintf(buf+size, " [active since %lds]",
+ tm - obj->lifetime);
+ }
size += sprintf(buf+size, "\n");
if (send(container->fd, buf, size, 0) == -1) {
if (errno != EPIPE)