summaryrefslogtreecommitdiff
path: root/kernel/ip_set_macipmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/ip_set_macipmap.c')
-rw-r--r--kernel/ip_set_macipmap.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/kernel/ip_set_macipmap.c b/kernel/ip_set_macipmap.c
index 61ea6d5..464106e 100644
--- a/kernel/ip_set_macipmap.c
+++ b/kernel/ip_set_macipmap.c
@@ -22,7 +22,7 @@
#include <linux/netfilter_ipv4/ip_set_macipmap.h>
static int
-macipmap_utest(struct ip_set *set, const void *data, size_t size,
+macipmap_utest(struct ip_set *set, const void *data, u_int32_t size,
ip_set_ip_t *hash_ip)
{
const struct ip_set_macipmap *map = set->data;
@@ -35,8 +35,7 @@ macipmap_utest(struct ip_set *set, const void *data, size_t size,
*hash_ip = req->ip;
DP("set: %s, ip:%u.%u.%u.%u, %u.%u.%u.%u",
set->name, HIPQUAD(req->ip), HIPQUAD(*hash_ip));
- if (test_bit(IPSET_MACIP_ISSET,
- (void *) &table[req->ip - map->first_ip].flags)) {
+ if (table[req->ip - map->first_ip].match) {
return (memcmp(req->ethernet,
&table[req->ip - map->first_ip].ethernet,
ETH_ALEN) == 0);
@@ -64,8 +63,7 @@ macipmap_ktest(struct ip_set *set,
*hash_ip = ip;
DP("set: %s, ip:%u.%u.%u.%u, %u.%u.%u.%u",
set->name, HIPQUAD(ip), HIPQUAD(*hash_ip));
- if (test_bit(IPSET_MACIP_ISSET,
- (void *) &table[ip - map->first_ip].flags)) {
+ if (table[ip - map->first_ip].match) {
/* Is mac pointer valid?
* If so, compare... */
return (skb_mac_header(skb) >= skb->head
@@ -88,13 +86,13 @@ macipmap_add(struct ip_set *set, ip_set_ip_t *hash_ip,
if (ip < map->first_ip || ip > map->last_ip)
return -ERANGE;
- if (test_and_set_bit(IPSET_MACIP_ISSET,
- (void *) &table[ip - map->first_ip].flags))
+ if (table[ip - map->first_ip].match)
return -EEXIST;
*hash_ip = ip;
DP("%u.%u.%u.%u, %u.%u.%u.%u", HIPQUAD(ip), HIPQUAD(*hash_ip));
memcpy(&table[ip - map->first_ip].ethernet, ethernet, ETH_ALEN);
+ table[ip - map->first_ip].match = IPSET_MACIP_ISSET;
return 0;
}
@@ -114,11 +112,11 @@ macipmap_del(struct ip_set *set, ip_set_ip_t *hash_ip, ip_set_ip_t ip)
if (ip < map->first_ip || ip > map->last_ip)
return -ERANGE;
- if (!test_and_clear_bit(IPSET_MACIP_ISSET,
- (void *)&table[ip - map->first_ip].flags))
+ if (!table[ip - map->first_ip].match)
return -EEXIST;
*hash_ip = ip;
+ table[ip - map->first_ip].match = 0;
DP("%u.%u.%u.%u, %u.%u.%u.%u", HIPQUAD(ip), HIPQUAD(*hash_ip));
return 0;
}