net: add ETHER_IS_IPV6_MULTICAST

This can be used to detect if an ethernet address is specifically an
IPv6 multicast address, defined in accordance to RFC 2464.

ETHER_IS_MULTICAST is still preferred in the general case.

Reviewed by:	ae
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D26611
This commit is contained in:
Mitchell Horne 2020-10-30 13:32:58 +00:00
parent 4bfebc8d2c
commit ced0f52457
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=367163

View File

@ -71,6 +71,8 @@ struct ether_addr {
} __packed;
#define ETHER_IS_MULTICAST(addr) (*(addr) & 0x01) /* is address mcast/bcast? */
#define ETHER_IS_IPV6_MULTICAST(addr) \
(((addr)[0] == 0x33) && ((addr)[1] == 0x33))
#define ETHER_IS_BROADCAST(addr) \
(((addr)[0] & (addr)[1] & (addr)[2] & \
(addr)[3] & (addr)[4] & (addr)[5]) == 0xff)