diff options
Diffstat (limited to 'sys/compat/linuxkpi/common/include/linux/etherdevice.h')
-rw-r--r-- | sys/compat/linuxkpi/common/include/linux/etherdevice.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/etherdevice.h b/sys/compat/linuxkpi/common/include/linux/etherdevice.h index 89cd4c8e0ba0..1f2d6cf22d7e 100644 --- a/sys/compat/linuxkpi/common/include/linux/etherdevice.h +++ b/sys/compat/linuxkpi/common/include/linux/etherdevice.h @@ -53,19 +53,27 @@ struct ethtool_modinfo { static inline bool is_zero_ether_addr(const u8 * addr) { - return ((addr[0] + addr[1] + addr[2] + addr[3] + addr[4] + addr[5]) == 0x00); + return ((addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]) == + 0x00); +} + +static inline bool +is_unicast_ether_addr(const u8 * addr) +{ + return ((addr[0] & 0x01) == 0x00); } static inline bool is_multicast_ether_addr(const u8 * addr) { - return (0x01 & addr[0]); + return ((addr[0] & 0x01) == 0x01); } static inline bool is_broadcast_ether_addr(const u8 * addr) { - return ((addr[0] + addr[1] + addr[2] + addr[3] + addr[4] + addr[5]) == (6 * 0xff)); + return ((addr[0] & addr[1] & addr[2] & addr[3] & addr[4] & addr[5]) == + 0xff); } static inline bool |