summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2018-08-30 10:46:18 +0200
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2018-08-30 10:46:18 +0200
commit831c1b709c8834a47419a0f77fd8636145ed05be (patch)
tree944f7eb47ee3b4b9b241dd6d6d8df80419ea0662
parent9998f795bac2611e2a8fabd5dd9c264077c9a980 (diff)
Add compatibility to support is_zero_ether_addr()
-rw-r--r--configure.ac10
-rw-r--r--kernel/include/linux/netfilter/ipset/ip_set_compat.h.in14
2 files changed, 23 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 3f51720..73a2f8c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -230,6 +230,16 @@ else
AC_SUBST(HAVE_ETHER_ADDR_EQUAL, undef)
fi
+AC_MSG_CHECKING([kernel source for is_zero_ether_addr])
+if test -f $ksourcedir/include/linux/etherdevice.h && \
+ $GREP -q 'is_zero_ether_addr' $ksourcedir/include/linux/etherdevice.h; then
+ AC_MSG_RESULT(yes)
+ AC_SUBST(HAVE_IS_ZERO_ETHER_ADDR, define)
+else
+ AC_MSG_RESULT(no)
+ AC_SUBST(HAVE_IS_ZERO_ETHER_ADDR, undef)
+fi
+
AC_MSG_CHECKING([kernel source for nla_put_be16])
if test -f $ksourcedir/include/net/netlink.h && \
$GREP -q 'nla_put_be16' $ksourcedir/include/net/netlink.h; then
diff --git a/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in b/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in
index c78867d..72b77b3 100644
--- a/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in
+++ b/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in
@@ -8,6 +8,7 @@
#@HAVE_STRUCT_XT_ACTION_PARAM@ HAVE_STRUCT_XT_ACTION_PARAM
#@HAVE_VZALLOC@ HAVE_VZALLOC
#@HAVE_ETHER_ADDR_EQUAL@ HAVE_ETHER_ADDR_EQUAL
+#@HAVE_IS_ZERO_ETHER_ADDR@ HAVE_IS_ZERO_ETHER_ADDR
#@HAVE_NLA_PUT_BE16@ HAVE_NLA_PUT_BE16
#@HAVE_NLA_PUT_BE64@ HAVE_NLA_PUT_BE64
#@HAVE_NLA_PUT_64BIT@ HAVE_NLA_PUT_64BIT
@@ -152,15 +153,26 @@ do { \
PAGE_KERNEL)
#endif
-#ifndef HAVE_ETHER_ADDR_EQUAL
+#if !defined(HAVE_ETHER_ADDR_EQUAL) || !defined(HAVE_IS_ZERO_ETHER_ADDR)
#include <linux/etherdevice.h>
+#ifndef HAVE_ETHER_ADDR_EQUAL
static inline bool ether_addr_equal(const u8 *addr1, const u8 *addr2)
{
return !compare_ether_addr(addr1, addr2);
}
#endif
+#ifndef HAVE_IS_ZERO_ETHER_ADDR
+static inline bool is_zero_ether_addr(const u8 *addr)
+{
+ return (*(const u16 *)(addr + 0) |
+ *(const u16 *)(addr + 2) |
+ *(const u16 *)(addr + 4)) == 0;
+}
+#endif
+#endif
+
#ifndef HAVE_NLA_PUT_BE64
static inline int nla_put_be64(struct sk_buff *skb, int attrtype, __be64 value)
{