From: Joe Perches Date: Tue, 8 May 2012 18:56:45 +0000 (+0000) Subject: etherdevice.h: Add ether_addr_equal X-Git-Tag: for-linus-20120531~84^2~137 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=a599b0f54d233d0f63d6be9a2ff0049d24751669;p=linux-2.6-block.git etherdevice.h: Add ether_addr_equal Add a boolean function to check if 2 ethernet addresses are the same. This is to avoid any confusion about compare_ether_addr returning an unsigned, and not being able to use the compare_ether_addr function for sorting ala memcmp. Signed-off-by: Joe Perches Signed-off-by: David S. Miller --- diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index c47631fac229..f3301140d28a 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h @@ -171,6 +171,18 @@ static inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2) return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0; } +/** + * ether_addr_equal - Compare two Ethernet addresses + * @addr1: Pointer to a six-byte array containing the Ethernet address + * @addr2: Pointer other six-byte array containing the Ethernet address + * + * Compare two ethernet addresses, returns true if equal + */ +static inline bool ether_addr_equal(const u8 *addr1, const u8 *addr2) +{ + return !compare_ether_addr(addr1, addr2); +} + static inline unsigned long zap_last_2bytes(unsigned long value) { #ifdef __BIG_ENDIAN