]> granicus.if.org Git - ipset/commitdiff
Backport ether_addr_equal
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Sat, 8 Sep 2012 16:37:21 +0000 (18:37 +0200)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Mon, 10 Sep 2012 18:53:55 +0000 (20:53 +0200)
kernel/net/netfilter/ipset/ip_set_bitmap_ipmac.c

index 0bb16c469a89ee49248b0827bcf7e9331542eccf..637c8344e10a2f562742ec2934eb80d99ef18996 100644 (file)
@@ -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;