summaryrefslogtreecommitdiffstats
path: root/kernel/ip_set_ipportiphash.c
diff options
context:
space:
mode:
author/C=EU/ST=EU/CN=Jozsef Kadlecsik/emailAddress=kadlec@blackhole.kfki.hu </C=EU/ST=EU/CN=Jozsef Kadlecsik/emailAddress=kadlec@blackhole.kfki.hu>2008-10-21 12:09:05 +0000
committer/C=EU/ST=EU/CN=Jozsef Kadlecsik/emailAddress=kadlec@blackhole.kfki.hu </C=EU/ST=EU/CN=Jozsef Kadlecsik/emailAddress=kadlec@blackhole.kfki.hu>2008-10-21 12:09:05 +0000
commitb8d6cfc169bf79b72faaab6ef7940798dbfe9328 (patch)
tree0bcc128ad3bcfdfca6849cea318e3de51673c6c6 /kernel/ip_set_ipportiphash.c
parenta96e4fca10506462df4ee4035f0f86f09bd9dc34 (diff)
As the manpage says, zero valued set entries cannot be used with
hash type of sets. Enforce the restriction.
Diffstat (limited to 'kernel/ip_set_ipportiphash.c')
-rw-r--r--kernel/ip_set_ipportiphash.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/ip_set_ipportiphash.c b/kernel/ip_set_ipportiphash.c
index 1755c57..74e8f7e 100644
--- a/kernel/ip_set_ipportiphash.c
+++ b/kernel/ip_set_ipportiphash.c
@@ -44,6 +44,8 @@ ipportiphash_id(struct ip_set *set, ip_set_ip_t *hash_ip,
*hash_ip = pack_ip_port(map, ip, port);
DP("set: %s, ipport:%u.%u.%u.%u:%u, %u.%u.%u.%u",
set->name, HIPQUAD(ip), port, HIPQUAD(*hash_ip));
+ if (!(*hash_ip || ip1))
+ return UINT_MAX;
for (i = 0; i < map->probes; i++) {
id = jhash_ip2(map, i, *hash_ip, ip1) % map->hashsize;
@@ -127,6 +129,8 @@ ipportiphash_add(struct ip_set *set, ip_set_ip_t *hash_ip,
return -ERANGE;
*hash_ip = pack_ip_port(map, ip, port);
+ if (!(*hash_ip || ip1))
+ return -ERANGE;
return __ipportip_add(map, *hash_ip, ip1);
}