Skip to content

Commit dd6adc7

Browse files
echistyakovkartben
authored andcommitted
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>
1 parent efbe756 commit dd6adc7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

subsys/net/l2/virtual/virtual.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ static void random_linkaddr(uint8_t *linkaddr, size_t len)
212212
{
213213
sys_rand_get(linkaddr, len);
214214

215-
linkaddr[0] |= 0x02; /* force LAA bit */
215+
linkaddr[0] |= 0x02; /* force LAA bit */
216+
linkaddr[0] &= ~0x01; /* clear multicast bit */
216217
}
217218

218219
int net_virtual_interface_attach(struct net_if *virtual_iface,

0 commit comments

Comments
 (0)