summaryrefslogtreecommitdiffstats
path: root/src/log.c
diff options
context:
space:
mode:
author/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org>2008-04-16 15:37:39 +0000
committer/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org>2008-04-16 15:37:39 +0000
commit07a3a6fe92c98e251a464a5744421ce211030003 (patch)
tree17a3188f6032b03f9ccfb607e09e6589839de7b2 /src/log.c
parent92d2cadbac3e51f6da0a1628e0544ccbdea107ba (diff)
add more verbose error notification when the injection of a conntrack fails
Diffstat (limited to 'src/log.c')
-rw-r--r--src/log.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/log.c b/src/log.c
index 51e757f..d97a69f 100644
--- a/src/log.c
+++ b/src/log.c
@@ -104,18 +104,30 @@ void dlog(int priority, const char *format, ...)
}
}
-void dlog_ct(struct nf_conntrack *ct)
+void dlog_ct(FILE *fd, struct nf_conntrack *ct, unsigned int type)
{
- FILE *fd = STATE(stats_log);
time_t t;
char buf[1024];
char *tmp;
-
- t = time(NULL);
- ctime_r(&t, buf);
- tmp = buf + strlen(buf);
- buf[strlen(buf)-1]='\t';
- nfct_snprintf(buf+strlen(buf), 1024-strlen(buf), ct, 0, 0, 0);
+ unsigned int flags = 0;
+
+ buf[0]='\0';
+
+ switch(type) {
+ case NFCT_O_PLAIN:
+ t = time(NULL);
+ ctime_r(&t, buf);
+ tmp = buf + strlen(buf);
+ buf[strlen(buf)-1]='\t';
+ break;
+ case NFCT_O_XML:
+ tmp = buf;
+ flags |= NFCT_OF_TIME;
+ break;
+ default:
+ return;
+ }
+ nfct_snprintf(buf+strlen(buf), 1024-strlen(buf), ct, 0, type, flags);
if (fd) {
snprintf(buf+strlen(buf), 1024-strlen(buf), "\n");