Skip to content

Commit

Permalink
etherdevice.h: Add is_unicast_ether_addr function
Browse files Browse the repository at this point in the history
From a check for !is_multicast_ether_addr it is not always obvious that
we're checking for a unicast address. So add this helper function to
make those code paths easier to read.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Acked-by: Chris Metcalf <cmetcalf@tilera.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Tobias Klauser authored and David S. Miller committed Jan 14, 2011
1 parent 5cd8a77 commit 51e7eed
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions include/linux/etherdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,17 @@ static inline int is_broadcast_ether_addr(const u8 *addr)
return (addr[0] & addr[1] & addr[2] & addr[3] & addr[4] & addr[5]) == 0xff;
}

/**
* is_unicast_ether_addr - Determine if the Ethernet address is unicast
* @addr: Pointer to a six-byte array containing the Ethernet address
*
* Return true if the address is a unicast address.
*/
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
Expand Down

0 comments on commit 51e7eed

Please sign in to comment.