From 5bcdf7f10ea732a06b8732fe815ee94820e6b7e7 Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Sat, 4 Dec 2010 14:38:31 +0100 Subject: [PATCH] ipset: update to 4.5 --- doc/changelog.txt | 3 +++ extensions/ipset/ip_set_iptreemap.c | 31 +++++++++++++------------- extensions/ipset/ipset.c | 2 +- extensions/ipset/ipset_iphash.c | 2 +- extensions/ipset/ipset_ipporthash.c | 2 +- extensions/ipset/ipset_ipportiphash.c | 2 +- extensions/ipset/ipset_ipportnethash.c | 2 +- extensions/ipset/ipset_nethash.c | 2 +- 8 files changed, 24 insertions(+), 22 deletions(-) diff --git a/doc/changelog.txt b/doc/changelog.txt index 280beb3..ffcc27c 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -1,6 +1,9 @@ HEAD ==== +Fixes: +- Update to ipset 4.5 + * the iptreemap type used wrong gfp flags when deleting entries v1.31 (November 05 2010) diff --git a/extensions/ipset/ip_set_iptreemap.c b/extensions/ipset/ip_set_iptreemap.c index f13924e..70d3dd1 100644 --- a/extensions/ipset/ip_set_iptreemap.c +++ b/extensions/ipset/ip_set_iptreemap.c @@ -102,13 +102,13 @@ static struct ip_set_iptreemap_b *fullbitmap_b; } \ } -#define DELIP_WALK(map, elem, branch, cachep, full, flags) \ +#define DELIP_WALK(map, elem, branch, cachep, full) \ do { \ branch = (map)->tree[elem]; \ if (!branch) { \ return -EEXIST; \ } else if (branch == full) { \ - branch = kmem_cache_alloc(cachep, flags); \ + branch = kmem_cache_alloc(cachep, GFP_ATOMIC); \ if (!branch) \ return -ENOMEM; \ memcpy(branch, full, sizeof(*full)); \ @@ -116,7 +116,7 @@ static struct ip_set_iptreemap_b *fullbitmap_b; } \ } while (0) -#define DELIP_RANGE_LOOP(map, a, a1, a2, hint, branch, full, cachep, free, flags) \ +#define DELIP_RANGE_LOOP(map, a, a1, a2, hint, branch, full, cachep, free) \ for (a = a1; a <= a2; a++) { \ branch = (map)->tree[a]; \ if (branch) { \ @@ -126,7 +126,7 @@ static struct ip_set_iptreemap_b *fullbitmap_b; (map)->tree[a] = NULL; \ continue; \ } else if (branch == full) { \ - branch = kmem_cache_alloc(cachep, flags); \ + branch = kmem_cache_alloc(cachep, GFP_ATOMIC); \ if (!branch) \ return -ENOMEM; \ memcpy(branch, full, sizeof(*branch)); \ @@ -331,7 +331,7 @@ UADT0(iptreemap, add, min(req->ip, req->end), max(req->ip, req->end)) KADT(iptreemap, add, ipaddr, ip) static inline int -__delip_single(struct ip_set *set, ip_set_ip_t ip, gfp_t flags) +__delip_single(struct ip_set *set, ip_set_ip_t ip) { struct ip_set_iptreemap *map = set->data; struct ip_set_iptreemap_b *btree; @@ -341,9 +341,9 @@ __delip_single(struct ip_set *set, ip_set_ip_t ip, gfp_t flags) ABCD(a, b, c, d, &ip); - DELIP_WALK(map, a, btree, cachep_b, fullbitmap_b, flags); - DELIP_WALK(btree, b, ctree, cachep_c, fullbitmap_c, flags); - DELIP_WALK(ctree, c, dtree, cachep_d, fullbitmap_d, flags); + DELIP_WALK(map, a, btree, cachep_b, fullbitmap_b); + DELIP_WALK(btree, b, ctree, cachep_c, fullbitmap_c); + DELIP_WALK(ctree, c, dtree, cachep_d, fullbitmap_d); if (!__test_and_clear_bit(d, (void *) dtree->bitmap)) return -EEXIST; @@ -354,8 +354,7 @@ __delip_single(struct ip_set *set, ip_set_ip_t ip, gfp_t flags) } static inline int -iptreemap_del(struct ip_set *set, - ip_set_ip_t start, ip_set_ip_t end, gfp_t flags) +iptreemap_del(struct ip_set *set, ip_set_ip_t start, ip_set_ip_t end) { struct ip_set_iptreemap *map = set->data; struct ip_set_iptreemap_b *btree; @@ -366,15 +365,15 @@ iptreemap_del(struct ip_set *set, unsigned char a2, b2, c2, d2; if (start == end) - return __delip_single(set, start, flags); + return __delip_single(set, start); ABCD(a1, b1, c1, d1, &start); ABCD(a2, b2, c2, d2, &end); /* This is sooo ugly... */ - DELIP_RANGE_LOOP(map, a, a1, a2, CHECK1(a, a1, a2, b1, b2, c1, c2, d1, d2), btree, fullbitmap_b, cachep_b, free_b, flags) { - DELIP_RANGE_LOOP(btree, b, GETVALUE1(a, a1, b1, 0), GETVALUE1(a, a2, b2, 255), CHECK2(a, b, a1, a2, b1, b2, c1, c2, d1, d2), ctree, fullbitmap_c, cachep_c, free_c, flags) { - DELIP_RANGE_LOOP(ctree, c, GETVALUE2(a, b, a1, b1, c1, 0), GETVALUE2(a, b, a2, b2, c2, 255), CHECK3(a, b, c, a1, a2, b1, b2, c1, c2, d1, d2), dtree, fullbitmap_d, cachep_d, free_d, flags) { + DELIP_RANGE_LOOP(map, a, a1, a2, CHECK1(a, a1, a2, b1, b2, c1, c2, d1, d2), btree, fullbitmap_b, cachep_b, free_b) { + DELIP_RANGE_LOOP(btree, b, GETVALUE1(a, a1, b1, 0), GETVALUE1(a, a2, b2, 255), CHECK2(a, b, a1, a2, b1, b2, c1, c2, d1, d2), ctree, fullbitmap_c, cachep_c, free_c) { + DELIP_RANGE_LOOP(ctree, c, GETVALUE2(a, b, a1, b1, c1, 0), GETVALUE2(a, b, a2, b2, c2, 255), CHECK3(a, b, c, a1, a2, b1, b2, c1, c2, d1, d2), dtree, fullbitmap_d, cachep_d, free_d) { for (d = GETVALUE3(a, b, c, a1, b1, c1, d1, 0); d <= GETVALUE3(a, b, c, a2, b2, c2, d2, 255); d++) __clear_bit(d, (void *) dtree->bitmap); __set_bit(b, (void *) btree->dirty); @@ -385,8 +384,8 @@ iptreemap_del(struct ip_set *set, return 0; } -UADT0(iptreemap, del, min(req->ip, req->end), max(req->ip, req->end), GFP_KERNEL) -KADT(iptreemap, del, ipaddr, ip, GFP_ATOMIC) +UADT0(iptreemap, del, min(req->ip, req->end), max(req->ip, req->end)) +KADT(iptreemap, del, ipaddr, ip) /* Check the status of the bitmap * -1 == all bits cleared diff --git a/extensions/ipset/ipset.c b/extensions/ipset/ipset.c index 255b458..50bcddc 100644 --- a/extensions/ipset/ipset.c +++ b/extensions/ipset/ipset.c @@ -30,7 +30,7 @@ #define PROC_SYS_MODPROBE "/proc/sys/kernel/modprobe" #endif -#define IPSET_VERSION "4.4" +#define IPSET_VERSION "4.5" char program_name[] = "ipset"; char program_version[] = IPSET_VERSION; diff --git a/extensions/ipset/ipset_iphash.c b/extensions/ipset/ipset_iphash.c index feb089b..f0f999d 100644 --- a/extensions/ipset/ipset_iphash.c +++ b/extensions/ipset/ipset_iphash.c @@ -39,7 +39,7 @@ iphash_create_init(void *data) DP("create INIT"); /* Default create parameters */ - mydata->hashsize = 1024; + mydata->hashsize = IP_NF_SET_HASHSIZE; mydata->probes = 8; mydata->resize = 50; diff --git a/extensions/ipset/ipset_ipporthash.c b/extensions/ipset/ipset_ipporthash.c index f03f36c..98bd864 100644 --- a/extensions/ipset/ipset_ipporthash.c +++ b/extensions/ipset/ipset_ipporthash.c @@ -39,7 +39,7 @@ ipporthash_create_init(void *data) DP("create INIT"); /* Default create parameters */ - mydata->hashsize = 1024; + mydata->hashsize = IP_NF_SET_HASHSIZE; mydata->probes = 8; mydata->resize = 50; } diff --git a/extensions/ipset/ipset_ipportiphash.c b/extensions/ipset/ipset_ipportiphash.c index 73739bf..efdd10f 100644 --- a/extensions/ipset/ipset_ipportiphash.c +++ b/extensions/ipset/ipset_ipportiphash.c @@ -39,7 +39,7 @@ ipportiphash_create_init(void *data) DP("create INIT"); /* Default create parameters */ - mydata->hashsize = 1024; + mydata->hashsize = IP_NF_SET_HASHSIZE; mydata->probes = 8; mydata->resize = 50; } diff --git a/extensions/ipset/ipset_ipportnethash.c b/extensions/ipset/ipset_ipportnethash.c index 036719e..d8fcedb 100644 --- a/extensions/ipset/ipset_ipportnethash.c +++ b/extensions/ipset/ipset_ipportnethash.c @@ -39,7 +39,7 @@ ipportnethash_create_init(void *data) DP("create INIT"); /* Default create parameters */ - mydata->hashsize = 1024; + mydata->hashsize = IP_NF_SET_HASHSIZE; mydata->probes = 8; mydata->resize = 50; } diff --git a/extensions/ipset/ipset_nethash.c b/extensions/ipset/ipset_nethash.c index 4f6f156..852319e 100644 --- a/extensions/ipset/ipset_nethash.c +++ b/extensions/ipset/ipset_nethash.c @@ -38,7 +38,7 @@ nethash_create_init(void *data) DP("create INIT"); /* Default create parameters */ - mydata->hashsize = 1024; + mydata->hashsize = IP_NF_SET_HASHSIZE; mydata->probes = 4; mydata->resize = 50; }