Implement the functionality for converting multicast IP addresses to Ethernet MAC addresses in the Rust Mac struct. The specific requirements to complete this task are as follows:
Implement From Trait:
Create a From implementation that allows converting a multicast IP address (both IPv4 and IPv6) to a corresponding MAC address. You should modify the existing From<&'a MulticastAddr<A>> for Mac implementation to ensure it follows the correct mapping per [RFC 7042]:
For IPv4 addresses in the range 224.0.0.0 to 239.255.255.255:
The first three bytes of the MAC should be fixed values 0x01:0x00:0x5E, and the last three bytes should be derived from the last three bytes of the IPv4 address.
For IPv6 multicast addresses:
The first two bytes should be fixed values 0x33:0x33, and the last four bytes should be derived from the last four bytes of the IPv6 address.
Testing:
Ensure that the changes pass the existing test cases defined in the tests module, particularly focusing on the tests under test_map_multicast_ip_to_ethernet_mac, which validate the conversion from multicast IP addresses to MAC addresses.
Solution Placement:
Place your implementation in the /app directory of the project.
By meeting these requirements, the functionality for translating multicast IP addresses to Ethernet MAC addresses will be correctly implemented and validated.