From b8d6cfc169bf79b72faaab6ef7940798dbfe9328 Mon Sep 17 00:00:00 2001 From: "/C=EU/ST=EU/CN=Jozsef Kadlecsik/emailAddress=kadlec@blackhole.kfki.hu" Date: Tue, 21 Oct 2008 12:09:05 +0000 Subject: As the manpage says, zero valued set entries cannot be used with hash type of sets. Enforce the restriction. --- kernel/ip_set_ipportiphash.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'kernel/ip_set_ipportiphash.c') 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); } -- cgit v1.2.3