From 834227ba6e80dc0899d2372ae8986241f5658c4e Mon Sep 17 00:00:00 2001 From: "Bjoern A. Zeeb" Date: Mon, 24 May 2021 18:09:37 +0000 Subject: [PATCH] LinuxKPI: add ether_addr_equal_unaligned() Replace the implementation for ether_addr_equal() with ether_addr_equal_unaligned() and add a define for ether_addr_equal() pointing to the now ether_addr_equal_unaligned() implementation. This way ether_addr_equal_unaligned() cannot be broken by accident [1]. Suggested by: emaste [1] Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D30425 --- sys/compat/linuxkpi/common/include/linux/etherdevice.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/etherdevice.h b/sys/compat/linuxkpi/common/include/linux/etherdevice.h index 392f395a5feb..9062cd562347 100644 --- a/sys/compat/linuxkpi/common/include/linux/etherdevice.h +++ b/sys/compat/linuxkpi/common/include/linux/etherdevice.h @@ -82,10 +82,11 @@ ether_addr_copy(u8 * dst, const u8 * src) } static inline bool -ether_addr_equal(const u8 *pa, const u8 *pb) +ether_addr_equal_unaligned(const u8 *pa, const u8 *pb) { return (memcmp(pa, pb, 6) == 0); } +#define ether_addr_equal(_pa, _pb) ether_addr_equal_unaligned(_pa, _pb) static inline bool ether_addr_equal_64bits(const u8 *pa, const u8 *pb)