net: virtual: Clear multicast bit when generating link address

The least significant bit of the first octet of a MAC address is a
unicast/multicast bit. The bit should be cleared when generating a
random link address for a virtual interface. Any frames from such
interface/address will be dropped by the network as invalid if
the multicast bit is set.

Signed-off-by: Jack Chistyakov <jack.chistyakov@outlook.com>
This commit is contained in:
Jack Chistyakov 2025-03-27 22:51:18 -07:00 committed by Benjamin Cabé
commit dd6adc7cad

View file

@ -212,7 +212,8 @@ static void random_linkaddr(uint8_t *linkaddr, size_t len)
{
sys_rand_get(linkaddr, len);
linkaddr[0] |= 0x02; /* force LAA bit */
linkaddr[0] |= 0x02; /* force LAA bit */
linkaddr[0] &= ~0x01; /* clear multicast bit */
}
int net_virtual_interface_attach(struct net_if *virtual_iface,