[netfilter-cvslog] r7499 - in trunk/conntrack-tools: . include src
pablo at netfilter.org
pablo at netfilter.org
Wed Apr 16 17:37:39 CEST 2008
Author: pablo at netfilter.org
Date: 2008-04-16 17:37:39 +0200 (Wed, 16 Apr 2008)
New Revision: 7499
Modified:
trunk/conntrack-tools/ChangeLog
trunk/conntrack-tools/include/log.h
trunk/conntrack-tools/src/cache_iterators.c
trunk/conntrack-tools/src/cache_wt.c
trunk/conntrack-tools/src/log.c
trunk/conntrack-tools/src/stats-mode.c
Log:
add more verbose error notification when the injection of a conntrack fails
Modified: trunk/conntrack-tools/ChangeLog
===================================================================
--- trunk/conntrack-tools/ChangeLog 2008-04-16 15:08:32 UTC (rev 7498)
+++ trunk/conntrack-tools/ChangeLog 2008-04-16 15:37:39 UTC (rev 7499)
@@ -23,6 +23,7 @@
= conntrackd =
o fix asymmetric path support (reported by Gary Richards)
o improve netlink overrun handling
+o add more verbose error notification when we fail to inject a conntrack
version 0.9.6 (2008/03/08)
------------------------------
Modified: trunk/conntrack-tools/include/log.h
===================================================================
--- trunk/conntrack-tools/include/log.h 2008-04-16 15:08:32 UTC (rev 7498)
+++ trunk/conntrack-tools/include/log.h 2008-04-16 15:37:39 UTC (rev 7499)
@@ -7,7 +7,7 @@
int init_log(void);
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);
void close_log(void);
#endif
Modified: trunk/conntrack-tools/src/cache_iterators.c
===================================================================
--- trunk/conntrack-tools/src/cache_iterators.c 2008-04-16 15:08:32 UTC (rev 7498)
+++ trunk/conntrack-tools/src/cache_iterators.c 2008-04-16 15:37:39 UTC (rev 7499)
@@ -98,6 +98,8 @@
c->commit_exist++;
break;
default:
+ dlog(LOG_ERR, "commit: %s", strerror(errno));
+ dlog_ct(STATE(log), u->ct, NFCT_O_PLAIN);
c->commit_fail++;
break;
}
Modified: trunk/conntrack-tools/src/cache_wt.c
===================================================================
--- trunk/conntrack-tools/src/cache_wt.c 2008-04-16 15:08:32 UTC (rev 7498)
+++ trunk/conntrack-tools/src/cache_wt.c 2008-04-16 15:37:39 UTC (rev 7499)
@@ -35,16 +35,21 @@
switch (ret) {
case -1:
dlog(LOG_ERR, "cache_wt problem: %s", strerror(errno));
+ dlog_ct(STATE(log), u->ct, NFCT_O_PLAIN);
break;
case 0:
memcpy(ct, u->ct, nfct_maxsize());
- if (nl_create_conntrack(ct) == -1)
+ if (nl_create_conntrack(ct) == -1) {
dlog(LOG_ERR, "cache_wt create: %s", strerror(errno));
+ dlog_ct(STATE(log), u->ct, NFCT_O_PLAIN);
+ }
break;
case 1:
memcpy(ct, u->ct, nfct_maxsize());
- if (nl_update_conntrack(ct) == -1)
+ if (nl_update_conntrack(ct) == -1) {
dlog(LOG_ERR, "cache_wt crt-upd: %s", strerror(errno));
+ dlog_ct(STATE(log), u->ct, NFCT_O_PLAIN);
+ }
break;
}
}
@@ -56,8 +61,10 @@
memcpy(ct, u->ct, nfct_maxsize());
- if (nl_update_conntrack(ct) == -1)
+ if (nl_update_conntrack(ct) == -1) {
dlog(LOG_ERR, "cache_wt update:%s", strerror(errno));
+ dlog_ct(STATE(log), u->ct, NFCT_O_PLAIN);
+ }
}
static void writethrough_add(struct us_conntrack *u, void *data)
Modified: trunk/conntrack-tools/src/log.c
===================================================================
--- trunk/conntrack-tools/src/log.c 2008-04-16 15:08:32 UTC (rev 7498)
+++ trunk/conntrack-tools/src/log.c 2008-04-16 15:37:39 UTC (rev 7499)
@@ -104,19 +104,31 @@
}
}
-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");
fputs(buf, fd);
Modified: trunk/conntrack-tools/src/stats-mode.c
===================================================================
--- trunk/conntrack-tools/src/stats-mode.c 2008-04-16 15:08:32 UTC (rev 7498)
+++ trunk/conntrack-tools/src/stats-mode.c 2008-04-16 15:37:39 UTC (rev 7499)
@@ -170,7 +170,7 @@
if (cache_del(STATE_STATS(cache), ct)) {
debug_ct(ct, "cache destroy");
- dlog_ct(ct);
+ dlog_ct(STATE(stats_log), ct, NFCT_O_PLAIN);
return 1;
} else {
debug_ct(ct, "can't destroy!");
More information about the netfilter-cvslog
mailing list