[netfilter-cvslog] r6438 - branches/ulog/ulogd2/input/flow

laforge at netfilter.org laforge at netfilter.org
Thu Jan 26 10:12:20 CET 2006


Author: laforge at netfilter.org
Date: 2006-01-26 10:12:19 +0100 (Thu, 26 Jan 2006)
New Revision: 6438

Modified:
   branches/ulog/ulogd2/input/flow/ulogd_inpflow_NFCT.c
Log:
fix some hahstable related bugs:
1) correctly name flow.end.usec
2) initialize 'idle' list_head
3) don't allocate hash table in case hash_use=0
4) fix invalid pointer arithmetic


Modified: branches/ulog/ulogd2/input/flow/ulogd_inpflow_NFCT.c
===================================================================
--- branches/ulog/ulogd2/input/flow/ulogd_inpflow_NFCT.c	2006-01-25 17:01:02 UTC (rev 6437)
+++ branches/ulog/ulogd2/input/flow/ulogd_inpflow_NFCT.c	2006-01-26 09:12:19 UTC (rev 6438)
@@ -238,7 +238,7 @@
 	{
 		.type	= ULOGD_RET_UINT32,
 		.flags	= ULOGD_RETF_NONE,
-		.name	= "flow.end.sec",
+		.name	= "flow.end.usec",
 		.ipfix	= {
 			.vendor		= IPFIX_VENDOR_IETF,
 			.field_id	= IPFIX_flowEndSeconds,
@@ -260,6 +260,7 @@
 	htable->buckets = (void *)htable + sizeof(*htable);
 	htable->num_buckets = htable_size;
 	htable->prealloc = prealloc;
+	INIT_LLIST_HEAD(&htable->idle);
 
 	for (i = 0; i < htable->num_buckets; i++)
                 INIT_LLIST_HEAD(&htable->buckets[i]);
@@ -447,7 +448,8 @@
 {
 	struct nfct_conntrack *ct = arg;
 	struct ulogd_pluginstance *upi = data;
-	struct nfct_pluginstance *cpi = (struct nfct_pluginstance *) data;
+	struct nfct_pluginstance *cpi = 
+				(struct nfct_pluginstance *) upi->private;
 
 	if (type == NFCT_MSG_NEW) {
 		if (usehash_ce(upi->config_kset).u.value != 0)
@@ -546,12 +548,14 @@
 	else
 		prealloc = 0;
 
-	cpi->ct_active = htable_alloc(buckets_ce(upi->config_kset).u.value,
-				      prealloc);
-	if (!cpi->ct_active) {
-		ulogd_log(ULOGD_FATAL, "error allocating hash\n");
-		nfct_close(cpi->cth);
-		return -1;
+	if (usehash_ce(upi->config_kset).u.value != 0) {
+		cpi->ct_active = htable_alloc(buckets_ce(upi->config_kset).u.value,
+					      prealloc);
+		if (!cpi->ct_active) {
+			ulogd_log(ULOGD_FATAL, "error allocating hash\n");
+			nfct_close(cpi->cth);
+			return -1;
+		}
 	}
 	
 	return 0;




More information about the netfilter-cvslog mailing list