diff options
author | Lennert Buytenhek <buytenh@wantstofly.org> | 2015-05-28 15:38:32 +0300 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2015-05-31 13:40:53 +0200 |
commit | 3b369bd212d5cabb46cff0e863298971b382bbd6 (patch) | |
tree | 250dc9be6bfaa82e624626d4b70e60e3333716cf /net/mac802154 | |
parent | a9ab2184f451ec78af245ebb8b663d8700d44672 (diff) | |
download | linux-3b369bd212d5cabb46cff0e863298971b382bbd6.tar.gz linux-3b369bd212d5cabb46cff0e863298971b382bbd6.tar.bz2 linux-3b369bd212d5cabb46cff0e863298971b382bbd6.zip |
ieee802154: Fix generation of random EUI-64 addresses.
Currently, ieee802154_random_extended_addr() has a 50% chance of
generating a group (multicast) address, while this function is used
for generating station addresses (which can't be group addresses)
for interfaces that don't have a hardware-provided address.
Also, in case get_random_bytes() generates the EUI-64 address
00:00:00:00:00:00:00:00 (extremely unlikely), which is an invalid
address, ieee802154_random_extended_addr() reacts by changing it
to 01:00:00:00:00:00:00:00, which is an invalid station address as
well, as it is a group address.
This patch changes the address generation procedure to grab eight
random bytes, treat that as an EUI-64, and then clear the Group
address bit and set the Locally Administered bit, which is in
line with how eth_random_addr() generates random EUI-48s.
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/mac802154')
0 files changed, 0 insertions, 0 deletions