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:
parent
efbe756b62
commit
dd6adc7cad
1 changed files with 2 additions and 1 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue