net: add ETHER_IS_ZERO macro similar to ETHER_IS_BROADCAST
Some places in network code may need to verify that an ethernet address is not the 'zero' address. Provide a standard macro ETHER_IS_ZERO for this purpose, similar to the ETHER_IS_BROADCAST macro already available. This patch also removes previous ETHER_IS_ZERO definitions in several USB ethernet drivers, in favor of this centrally-located macro. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Submitted by: Jacob Keller <jacob.e.keller@intel.com> Reviewed by: erj@ Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D21240
This commit is contained in:
parent
db8e8f1ede
commit
74954211d6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=354345
@ -157,9 +157,6 @@ do { \
|
||||
#define muge_err_printf(sc, fmt, args...) \
|
||||
device_printf((sc)->sc_ue.ue_dev, "error: " fmt, ##args)
|
||||
|
||||
#define ETHER_IS_ZERO(addr) \
|
||||
(!(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]))
|
||||
|
||||
#define ETHER_IS_VALID(addr) \
|
||||
(!ETHER_IS_MULTICAST(addr) && !ETHER_IS_ZERO(addr))
|
||||
|
||||
|
@ -171,9 +171,6 @@ static const struct usb_device_id smsc_devs[] = {
|
||||
device_printf((sc)->sc_ue.ue_dev, "error: " fmt, ##args)
|
||||
|
||||
|
||||
#define ETHER_IS_ZERO(addr) \
|
||||
(!(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]))
|
||||
|
||||
#define ETHER_IS_VALID(addr) \
|
||||
(!ETHER_IS_MULTICAST(addr) && !ETHER_IS_ZERO(addr))
|
||||
|
||||
|
@ -68,9 +68,6 @@ SYSCTL_INT(_hw_usb_ure, OID_AUTO, debug, CTLFLAG_RWTUN, &ure_debug, 0,
|
||||
"Debug level");
|
||||
#endif
|
||||
|
||||
#define ETHER_IS_ZERO(addr) \
|
||||
(!(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]))
|
||||
|
||||
/*
|
||||
* Various supported device vendors/products.
|
||||
*/
|
||||
|
@ -74,6 +74,9 @@ struct ether_addr {
|
||||
#define ETHER_IS_BROADCAST(addr) \
|
||||
(((addr)[0] & (addr)[1] & (addr)[2] & \
|
||||
(addr)[3] & (addr)[4] & (addr)[5]) == 0xff)
|
||||
#define ETHER_IS_ZERO(addr) \
|
||||
(((addr)[0] | (addr)[1] | (addr)[2] | \
|
||||
(addr)[3] | (addr)[4] | (addr)[5]) == 0x00)
|
||||
|
||||
/*
|
||||
* 802.1q Virtual LAN header.
|
||||
|
Loading…
Reference in New Issue
Block a user