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
This commit is contained in:
Bjoern A. Zeeb 2021-05-24 18:09:37 +00:00
parent ff09f9133f
commit 834227ba6e

View File

@ -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)