Everything I've found on the 'net says that any MAC address with 0x1 in byte 0 is a multicast address. Which obviously includes the broadcast address. I think is_multicast_ether_addr() should implement that logic, if not we should call it something else, otherwise we're asking for confusion.
I've updated is_valid_ether_addr() so it's logic is unchanged, it's not clear to me why it has that logic, but Jeff said changing it would break wireless. Given that, I've added is_unicast_ether_addr() which implements the logic that is_valid_ether_addr() used to. I've been through the rest of the code and there's currently no callers that will be affected by the change to is_multicast_ether_addr(). Some callers are checking for is_multicast || is_broadcast, I'll post another patch to remove the redundant is_broadcast checks. Others really want is_unicast. Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]> --- include/linux/etherdevice.h | 23 +++++++++++++++++------ 1 files changed, 17 insertions(+), 6 deletions(-) Index: linux/include/linux/etherdevice.h =================================================================== --- linux.orig/include/linux/etherdevice.h +++ linux/include/linux/etherdevice.h @@ -66,7 +66,7 @@ static inline int is_zero_ether_addr(con */ static inline int is_multicast_ether_addr(const u8 *addr) { - return ((addr[0] != 0xff) && (0x01 & addr[0])); + return 0x01 & addr[0]; } /** @@ -81,19 +81,30 @@ static inline int is_broadcast_ether_add } /** + * is_unicast_ether_addr - Determine if the given Ethernet address is unicast + * @addr: Pointer to a six-byte array containing the Ethernet address + * + * Return true if the address is a unicast addresss. + */ +static inline int is_unicast_ether_addr(const u8 *addr) +{ + return !is_multicast_ether_addr(addr); +} + +/** * is_valid_ether_addr - Determine if the given Ethernet address is valid * @addr: Pointer to a six-byte array containing the Ethernet address * - * Check that the Ethernet address (MAC) is not 00:00:00:00:00:00, is not - * a multicast address, and is not FF:FF:FF:FF:FF:FF. + * Check that the Ethernet address (MAC) is not 00:00:00:00:00:00 and is not + * a multicast address, or that it matches FF:xx:xx:xx:xx:xx. * * Return true if the address is valid. */ static inline int is_valid_ether_addr(const u8 *addr) { - /* FF:FF:FF:FF:FF:FF is a multicast address so we don't need to - * explicitly check for it here. */ - return !is_multicast_ether_addr(addr) && !is_zero_ether_addr(addr); + /* XXX Why are we checking for 0xff here ? */ + return (addr[0] == 0xff) || (!is_multicast_ether_addr(addr) + && !is_zero_ether_addr(addr)); } /** - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html