mirror of
git://git.code.sf.net/p/xtables-addons/xtables-addons
synced 2025-09-20 19:44:56 +02:00
ipset: upgrade to ipset 2.4.9
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
#include <linux/tcp.h>
|
||||
#include <linux/udp.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>
|
||||
@@ -51,8 +51,7 @@ ipportiphash_id(struct ip_set *set, ip_set_ip_t *hash_ip,
|
||||
elem = HARRAY_ELEM(map->members, struct ipportip *, id);
|
||||
if (elem->ip == *hash_ip && elem->ip1 == ip1)
|
||||
return id;
|
||||
/* No shortcut at testing - there can be deleted
|
||||
* entries. */
|
||||
/* No shortcut - there can be deleted entries. */
|
||||
}
|
||||
return UINT_MAX;
|
||||
}
|
||||
@@ -90,19 +89,22 @@ __ipportip_add(struct ip_set_ipportiphash *map,
|
||||
{
|
||||
__u32 probe;
|
||||
u_int16_t i;
|
||||
struct ipportip *elem;
|
||||
struct ipportip *elem, *slot = NULL;
|
||||
|
||||
for (i = 0; i < map->probes; i++) {
|
||||
probe = jhash_ip2(map, i, hash_ip, ip1) % map->hashsize;
|
||||
elem = HARRAY_ELEM(map->members, struct ipportip *, probe);
|
||||
if (elem->ip == hash_ip && elem->ip1 == ip1)
|
||||
return -EEXIST;
|
||||
if (!(elem->ip || elem->ip1)) {
|
||||
elem->ip = hash_ip;
|
||||
elem->ip1 = ip1;
|
||||
map->elements++;
|
||||
return 0;
|
||||
}
|
||||
if (!(slot || elem->ip || elem->ip1))
|
||||
slot = elem;
|
||||
/* There can be deleted entries, must check all slots */
|
||||
}
|
||||
if (slot) {
|
||||
slot->ip = hash_ip;
|
||||
slot->ip1 = ip1;
|
||||
map->elements++;
|
||||
return 0;
|
||||
}
|
||||
/* Trigger rehashing */
|
||||
return -EAGAIN;
|
||||
|
Reference in New Issue
Block a user