From 831c1b709c8834a47419a0f77fd8636145ed05be Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Thu, 30 Aug 2018 10:46:18 +0200 Subject: Add compatibility to support is_zero_ether_addr() --- kernel/include/linux/netfilter/ipset/ip_set_compat.h.in | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'kernel') 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 +#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) { -- cgit v1.2.3