Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 58990
b: refs/heads/master
c: ac565e5
h: refs/heads/master
v: v3
  • Loading branch information
Patrick McHardy authored and David S. Miller committed Jul 11, 2007
1 parent d336ab1 commit 324db0f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 330f7db5e578e1e298ba3a41748e5ea333a64a2b
refs/heads/master: ac565e5fc104fe1842a87f2206fcfb7b6dda903d
4 changes: 4 additions & 0 deletions trunk/include/net/netfilter/nf_conntrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
23 changes: 12 additions & 11 deletions trunk/net/netfilter/nf_conntrack_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -920,15 +920,15 @@ 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);
else
free_pages((unsigned long)hash,
get_order(sizeof(struct hlist_head) * size));
}
EXPORT_SYMBOL_GPL(nf_ct_free_hashtable);

void nf_conntrack_flush(void)
{
Expand Down Expand Up @@ -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;
Expand All @@ -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)
{
Expand All @@ -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;

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -1122,8 +1123,8 @@ int __init nf_conntrack_init(void)
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;
}

0 comments on commit 324db0f

Please sign in to comment.