Method: NetAddr::IPv4#multicast_mac
- Defined in:
- lib/ipv4.rb
#multicast_mac ⇒ Object
multicast_mac returns the EUI48 multicast mac-address for this IP. It will return the zero address for IPs outside of the multicast range 224.0.0.0/4.
45 46 47 48 49 50 51 52 |
# File 'lib/ipv4.rb', line 45 def multicast_mac mac = 0 if (@addr&0xf0000000 == 0xe0000000) # within 224.0.0.0/4 ? # map lower 23-bits of ip to 01:00:5e:00:00:00 mac = (@addr&0x007fffff) | 0x01005e000000 end return EUI48.new(mac) end |