From 027dc5fb9021ce3f814a345b17c56d899733569a Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Sat, 16 May 2009 21:10:02 +0200 Subject: ipset 3.0 release The main change is full bigendian and 64/32bit enviroment support - in consequence the kernel-userspace protocol version was bumped. --- kernel/ip_set_macipmap.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'kernel/ip_set_macipmap.c') 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 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; } -- cgit v1.2.3