mirror of
https://github.com/fumiama/water.git
synced 2026-06-05 02:00:29 +08:00
added some functions for TAP that detect whether a MAC address is a broadcast or IPv4 multicast address
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user