ipset: upgrade to ipset 2.4.9

This commit is contained in:
Jan Engelhardt
2009-02-11 16:51:40 +01:00
parent 36dab67658
commit 47a34e0ccf
8 changed files with 154 additions and 132 deletions

View File

@@ -11,7 +11,7 @@
#include <linux/moduleparam.h>
#include <linux/ip.h>
#include <linux/skbuff.h>
#include <linux/jhash.h>
#include "ip_set_jhash.h"
#include <linux/errno.h>
#include <asm/uaccess.h>
#include <asm/bitops.h>
@@ -42,8 +42,7 @@ iphash_id(struct ip_set *set, ip_set_ip_t *hash_ip, ip_set_ip_t ip)
elem = HARRAY_ELEM(map->members, ip_set_ip_t *, id);
if (*elem == *hash_ip)
return id;
/* No shortcut at testing - there can be deleted
* entries. */
/* No shortcut - there can be deleted entries. */
}
return UINT_MAX;
}
@@ -64,18 +63,21 @@ __iphash_add(struct ip_set_iphash *map, ip_set_ip_t *ip)
{
__u32 probe;
u_int16_t i;
ip_set_ip_t *elem;
ip_set_ip_t *elem, *slot = NULL;
for (i = 0; i < map->probes; i++) {
probe = jhash_ip(map, i, *ip) % map->hashsize;
elem = HARRAY_ELEM(map->members, ip_set_ip_t *, probe);
if (*elem == *ip)
return -EEXIST;
if (!*elem) {
*elem = *ip;
map->elements++;
return 0;
}
if (!(slot || *elem))
slot = elem;
/* There can be deleted entries, must check all slots */
}
if (slot) {
*slot = *ip;
map->elements++;
return 0;
}
/* Trigger rehashing */
return -EAGAIN;