]> git.ipfire.org Git - thirdparty/ulogd2.git/commitdiff
fix some hahstable related bugs:
author/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org </C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org>
Thu, 26 Jan 2006 09:12:19 +0000 (09:12 +0000)
committer/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org </C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org>
Thu, 26 Jan 2006 09:12:19 +0000 (09:12 +0000)
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

input/flow/ulogd_inpflow_NFCT.c

index 02526a3455719048687a9d1aecfcb56fd462c2a3..c97c7bc8398277704dbacee9fbc076abe93951ac 100644 (file)
@@ -238,7 +238,7 @@ static struct ulogd_key nfct_okeys[] = {
        {
                .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 @@ static struct ct_htable *htable_alloc(int htable_size, int prealloc)
        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 @@ static int event_handler(void *arg, unsigned int flags, int type,
 {
        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 @@ static int constructor_nfct(struct ulogd_pluginstance *upi)
        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;