]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[NETFILTER]: nf_conntrack: export hash allocation/destruction functions
authorPatrick McHardy <kaber@trash.net>
Sun, 8 Jul 2007 05:30:08 +0000 (22:30 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Wed, 11 Jul 2007 05:17:42 +0000 (22:17 -0700)
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/netfilter/nf_conntrack.h
net/netfilter/nf_conntrack_core.c

index ef4a403878a323eb7c7499ff6f4ed17c3226e8c8..8f2cbb965f3df84e1a6f339ca6d521f3525ec9df 100644 (file)
@@ -172,6 +172,10 @@ static inline void nf_ct_put(struct nf_conn *ct)
 extern int nf_ct_l3proto_try_module_get(unsigned short l3proto);
 extern void nf_ct_l3proto_module_put(unsigned short l3proto);
 
+extern struct hlist_head *nf_ct_alloc_hashtable(int *sizep, int *vmalloced);
+extern void nf_ct_free_hashtable(struct hlist_head *hash, int vmalloced,
+                                int size);
+
 extern struct nf_conntrack_tuple_hash *
 __nf_conntrack_find(const struct nf_conntrack_tuple *tuple,
                    const struct nf_conn *ignored_conntrack);
index 8ed761cc0819d7008711b6350106d572ff6eb887..f4c3039728dcc2ca3e8a674e2874e06afcf47e2b 100644 (file)
@@ -920,8 +920,7 @@ static int kill_all(struct nf_conn *i, void *data)
        return 1;
 }
 
-static void free_conntrack_hash(struct hlist_head *hash, int vmalloced,
-                               int size)
+void nf_ct_free_hashtable(struct hlist_head *hash, int vmalloced, int size)
 {
        if (vmalloced)
                vfree(hash);
@@ -929,6 +928,7 @@ static void free_conntrack_hash(struct hlist_head *hash, int vmalloced,
                free_pages((unsigned long)hash,
                           get_order(sizeof(struct hlist_head) * size));
 }
+EXPORT_SYMBOL_GPL(nf_ct_free_hashtable);
 
 void nf_conntrack_flush(void)
 {
@@ -962,14 +962,14 @@ void nf_conntrack_cleanup(void)
 
        kmem_cache_destroy(nf_conntrack_cachep);
        kmem_cache_destroy(nf_conntrack_expect_cachep);
-       free_conntrack_hash(nf_conntrack_hash, nf_conntrack_vmalloc,
-                           nf_conntrack_htable_size);
+       nf_ct_free_hashtable(nf_conntrack_hash, nf_conntrack_vmalloc,
+                            nf_conntrack_htable_size);
 
        nf_conntrack_proto_fini();
        nf_conntrack_helper_fini();
 }
 
-static struct hlist_head *alloc_hashtable(int *sizep, int *vmalloced)
+struct hlist_head *nf_ct_alloc_hashtable(int *sizep, int *vmalloced)
 {
        struct hlist_head *hash;
        unsigned int size, i;
@@ -992,6 +992,7 @@ static struct hlist_head *alloc_hashtable(int *sizep, int *vmalloced)
 
        return hash;
 }
+EXPORT_SYMBOL_GPL(nf_ct_alloc_hashtable);
 
 int set_hashsize(const char *val, struct kernel_param *kp)
 {
@@ -1009,7 +1010,7 @@ int set_hashsize(const char *val, struct kernel_param *kp)
        if (!hashsize)
                return -EINVAL;
 
-       hash = alloc_hashtable(&hashsize, &vmalloced);
+       hash = nf_ct_alloc_hashtable(&hashsize, &vmalloced);
        if (!hash)
                return -ENOMEM;
 
@@ -1037,7 +1038,7 @@ int set_hashsize(const char *val, struct kernel_param *kp)
        nf_conntrack_hash_rnd = rnd;
        write_unlock_bh(&nf_conntrack_lock);
 
-       free_conntrack_hash(old_hash, old_vmalloced, old_size);
+       nf_ct_free_hashtable(old_hash, old_vmalloced, old_size);
        return 0;
 }
 
@@ -1066,8 +1067,8 @@ int __init nf_conntrack_init(void)
                 * entries. */
                max_factor = 4;
        }
-       nf_conntrack_hash = alloc_hashtable(&nf_conntrack_htable_size,
-                                           &nf_conntrack_vmalloc);
+       nf_conntrack_hash = nf_ct_alloc_hashtable(&nf_conntrack_htable_size,
+                                                 &nf_conntrack_vmalloc);
        if (!nf_conntrack_hash) {
                printk(KERN_ERR "Unable to create nf_conntrack_hash\n");
                goto err_out;
@@ -1122,8 +1123,8 @@ out_free_expect_slab:
 err_free_conntrack_slab:
        kmem_cache_destroy(nf_conntrack_cachep);
 err_free_hash:
-       free_conntrack_hash(nf_conntrack_hash, nf_conntrack_vmalloc,
-                           nf_conntrack_htable_size);
+       nf_ct_free_hashtable(nf_conntrack_hash, nf_conntrack_vmalloc,
+                            nf_conntrack_htable_size);
 err_out:
        return -ENOMEM;
 }