]> granicus.if.org Git - ipset/commitdiff
Add compatibility to support is_zero_ether_addr()
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Thu, 30 Aug 2018 08:46:18 +0000 (10:46 +0200)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Thu, 30 Aug 2018 08:46:18 +0000 (10:46 +0200)
configure.ac
kernel/include/linux/netfilter/ipset/ip_set_compat.h.in

index 3f517204b4c1e61bacab5ee0f82bdfbd838526c6..73a2f8c6d3b990655b48c363cf079ff3eb81d2a9 100644 (file)
@@ -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
index c78867d4a9e406885366f38b0155fafa2a0bbfd7..72b77b3963b7f29e575dee46e438ab7fdd3d7353 100644 (file)
@@ -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)
 {