mirror of
https://github.com/yggdrasil-network/water.git
synced 2025-05-19 16:35:10 +03:00
added some functions for TAP that detect whether a MAC address is a broadcast or IPv4 multicast address
This commit is contained in:
parent
06bc3cd87f
commit
0195689109
1 changed files with 8 additions and 0 deletions
|
@ -38,3 +38,11 @@ func MACEthertype(macFrame []byte) Ethertype {
|
|||
func MACPayload(macFrame []byte) []byte {
|
||||
return macFrame[12+MACTagging(macFrame)+2:]
|
||||
}
|
||||
|
||||
func IsBroadcast(addr net.HardwareAddr) bool {
|
||||
return addr[0] == 0xff && addr[1] == 0xff && addr[2] == 0xff && addr[3] == 0xff && addr[4] == 0xff && addr[5] == 0xff
|
||||
}
|
||||
|
||||
func IsIPv4Multicast(addr net.HardwareAddr) bool {
|
||||
return addr[0] == 0x01 && addr[1] == 0x00 && addr[2] == 0x5e
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue