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_ipporthash.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'kernel/ip_set_ipporthash.c') diff --git a/kernel/ip_set_ipporthash.c b/kernel/ip_set_ipporthash.c index 1dd39c3..97b2323 100644 --- a/kernel/ip_set_ipporthash.c +++ b/kernel/ip_set_ipporthash.c @@ -39,8 +39,11 @@ ipporthash_id(struct ip_set *set, ip_set_ip_t *hash_ip, ip_set_ip_t *elem; *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) + return UINT_MAX; for (i = 0; i < map->probes; i++) { id = jhash_ip(map, i, *hash_ip) % map->hashsize; @@ -113,6 +116,9 @@ ipporthash_add(struct ip_set *set, ip_set_ip_t *hash_ip, return -ERANGE; *hash_ip = pack_ip_port(map, ip, port); + + if (!*hash_ip) + return -ERANGE; return __ipporthash_add(map, hash_ip); } -- cgit v1.2.3