diff options
author | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2009-11-11 20:29:31 +0100 |
---|---|---|
committer | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2009-11-11 20:29:31 +0100 |
commit | c896b069e6c9cd229119a791c51d19e8f11c853c (patch) | |
tree | fbdd1c62f0153acd75afa392d47aa8888b975dc0 /kernel | |
parent | a8231be7ebf6086d21a25ea6d4a46a5117697189 (diff) |
4.1 version releasedv4.1
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/ChangeLog | 5 | ||||
-rw-r--r-- | kernel/include/linux/netfilter_ipv4/ip_set_hashes.h | 22 | ||||
-rw-r--r-- | kernel/ip_set.c | 3 | ||||
-rw-r--r-- | kernel/ip_set_ipportiphash.c | 3 | ||||
-rw-r--r-- | kernel/ip_set_ipportnethash.c | 3 |
5 files changed, 25 insertions, 11 deletions
diff --git a/kernel/ChangeLog b/kernel/ChangeLog index d1b525e..f613c94 100644 --- a/kernel/ChangeLog +++ b/kernel/ChangeLog @@ -1,3 +1,8 @@ +4.1 + - Do not use init_MUTEX either (Jan Engelhardt) + - Improve listing/saving hash type of sets by not copying empty + entries unnecessarily to userspace. + 4.0 - Compilation of ip_set_iptree.c fails with kernel 2.6.20 due to missing include of linux/jiffies.h (Jan Engelhardt) diff --git a/kernel/include/linux/netfilter_ipv4/ip_set_hashes.h b/kernel/include/linux/netfilter_ipv4/ip_set_hashes.h index f62ae37..8eeced3 100644 --- a/kernel/include/linux/netfilter_ipv4/ip_set_hashes.h +++ b/kernel/include/linux/netfilter_ipv4/ip_set_hashes.h @@ -186,7 +186,7 @@ type##_list_members_size(const struct ip_set *set, char dont_align) \ { \ const struct ip_set_##type *map = set->data; \ \ - return (map->hashsize * IPSET_VALIGN(sizeof(dtype), dont_align));\ + return (map->elements * IPSET_VALIGN(sizeof(dtype), dont_align));\ } #define HASH_LIST_MEMBERS(type, dtype) \ @@ -195,27 +195,33 @@ type##_list_members(const struct ip_set *set, void *data, char dont_align)\ { \ const struct ip_set_##type *map = set->data; \ dtype *elem, *d; \ - uint32_t i; \ + uint32_t i, n = 0; \ \ for (i = 0; i < map->hashsize; i++) { \ elem = HARRAY_ELEM(map->members, dtype *, i); \ - d = data + i * IPSET_VALIGN(sizeof(dtype), dont_align); \ - *d = *elem; \ + if (*elem) { \ + d = data + n * IPSET_VALIGN(sizeof(dtype), dont_align);\ + *d = *elem; \ + n++; \ + } \ } \ } -#define HASH_LIST_MEMBERS_MEMCPY(type, dtype) \ +#define HASH_LIST_MEMBERS_MEMCPY(type, dtype, nonzero) \ static void \ type##_list_members(const struct ip_set *set, void *data, char dont_align)\ { \ const struct ip_set_##type *map = set->data; \ dtype *elem; \ - uint32_t i; \ + uint32_t i, n = 0; \ \ for (i = 0; i < map->hashsize; i++) { \ elem = HARRAY_ELEM(map->members, dtype *, i); \ - memcpy(data + i * IPSET_VALIGN(sizeof(dtype), dont_align),\ - elem, sizeof(dtype)); \ + if (nonzero) { \ + memcpy(data + n * IPSET_VALIGN(sizeof(dtype), dont_align),\ + elem, sizeof(dtype)); \ + n++; \ + } \ } \ } diff --git a/kernel/ip_set.c b/kernel/ip_set.c index 30185c5..0ce9d3f 100644 --- a/kernel/ip_set.c +++ b/kernel/ip_set.c @@ -1474,7 +1474,8 @@ ip_set_init(void) { int res; - init_MUTEX(&ip_set_app_mutex); + /* For the -rt branch, DECLARE_MUTEX/init_MUTEX avoided */ + sema_init(&ip_set_app_mutex, 1); if (max_sets) ip_set_max = max_sets; diff --git a/kernel/ip_set_ipportiphash.c b/kernel/ip_set_ipportiphash.c index 5fe00f1..8b8f2a2 100644 --- a/kernel/ip_set_ipportiphash.c +++ b/kernel/ip_set_ipportiphash.c @@ -200,7 +200,8 @@ __ipportiphash_list_header(const struct ip_set_ipportiphash *map, HASH_LIST_HEADER(ipportiphash) HASH_LIST_MEMBERS_SIZE(ipportiphash, struct ipportip) -HASH_LIST_MEMBERS_MEMCPY(ipportiphash, struct ipportip) +HASH_LIST_MEMBERS_MEMCPY(ipportiphash, struct ipportip, + (elem->ip || elem->ip1)) IP_SET_RTYPE(ipportiphash, IPSET_TYPE_IP | IPSET_TYPE_PORT | IPSET_TYPE_IP1 | IPSET_DATA_TRIPLE) diff --git a/kernel/ip_set_ipportnethash.c b/kernel/ip_set_ipportnethash.c index 9179184..f328972 100644 --- a/kernel/ip_set_ipportnethash.c +++ b/kernel/ip_set_ipportnethash.c @@ -284,7 +284,8 @@ __ipportnethash_list_header(const struct ip_set_ipportnethash *map, HASH_LIST_HEADER(ipportnethash) HASH_LIST_MEMBERS_SIZE(ipportnethash, struct ipportip) -HASH_LIST_MEMBERS_MEMCPY(ipportnethash, struct ipportip) +HASH_LIST_MEMBERS_MEMCPY(ipportnethash, struct ipportip, + (elem->ip || elem->ip1)) IP_SET_RTYPE(ipportnethash, IPSET_TYPE_IP | IPSET_TYPE_PORT | IPSET_TYPE_IP1 | IPSET_DATA_TRIPLE) |