From d1e9a7a4a187a19af9a3c2d3089f0dfabc42b61e Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Sat, 8 Sep 2012 18:37:21 +0200 Subject: [PATCH] Backport ether_addr_equal --- kernel/net/netfilter/ipset/ip_set_bitmap_ipmac.c | 13 +++++++++++-- 1 file 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 #include #include +#include #include #include @@ -31,6 +32,14 @@ MODULE_AUTHOR("Jozsef Kadlecsik "); 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; -- 2.40.0