#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>
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 */
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;
}
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;