summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2012-09-08 18:37:21 +0200
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2012-09-10 20:53:55 +0200
commitd1e9a7a4a187a19af9a3c2d3089f0dfabc42b61e (patch)
tree8adc71895e2f6004d0e515f0161a484ce3951197
parentb71dea6a0c7761117b192ffa60d6e06833db06c7 (diff)
Backport ether_addr_equal
-rw-r--r--kernel/net/netfilter/ipset/ip_set_bitmap_ipmac.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/kernel/net/netfilter/ipset/ip_set_bitmap_ipmac.c b/kernel/net/netfilter/ipset/ip_set_bitmap_ipmac.c
index 0bb16c4..637c834 100644
--- a/kernel/net/netfilter/ipset/ip_set_bitmap_ipmac.c
+++ b/kernel/net/netfilter/ipset/ip_set_bitmap_ipmac.c
@@ -19,6 +19,7 @@
#include <linux/netlink.h>
#include <linux/jiffies.h>
#include <linux/timer.h>
+#include <linux/version.h>
#include <net/netlink.h>
#include <linux/netfilter/ipset/pfxlen.h>
@@ -31,6 +32,14 @@ MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>");
MODULE_DESCRIPTION("bitmap:ip,mac type of IP sets");
MODULE_ALIAS("ip_set_bitmap:ip,mac");
+/* Backport ether_addr_equal */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 5, 0)
+static inline bool ether_addr_equal(const u8 *addr1, const u8 *addr2)
+{
+ return !compare_ether_addr(addr1, addr2);
+}
+#endif
+
enum {
MAC_EMPTY, /* element is not set */
MAC_FILLED, /* element is set with MAC */
@@ -111,7 +120,7 @@ bitmap_ipmac_test(struct ip_set *set, void *value, u32 timeout, u32 flags)
return -EAGAIN;
case MAC_FILLED:
return data->ether == NULL ||
- compare_ether_addr(data->ether, elem->ether) == 0;
+ ether_addr_equal(data->ether, elem->ether);
}
return 0;
}
@@ -225,7 +234,7 @@ bitmap_ipmac_ttest(struct ip_set *set, void *value, u32 timeout, u32 flags)
return -EAGAIN;
case MAC_FILLED:
return (data->ether == NULL ||
- compare_ether_addr(data->ether, elem->ether) == 0) &&
+ ether_addr_equal(data->ether, elem->ether)) &&
!bitmap_expired(map, data->id);
}
return 0;