]> git.baikalelectronics.ru Git - kernel.git/commit
wifi: brcmfmac: Replace default (not configured) MAC with a random MAC
authorHans de Goede <hdegoede@redhat.com>
Fri, 8 Jul 2022 13:37:12 +0000 (15:37 +0200)
committerKalle Valo <kvalo@kernel.org>
Thu, 28 Jul 2022 09:58:11 +0000 (12:58 +0300)
commitc74cd36713f6be0c456e923b121ee88e78707bd9
tree9e54fbb28c34f125a283b40ce513126e9f425875
parent8fe088a6179d898ec53b263166e8a42211e2ec4c
wifi: brcmfmac: Replace default (not configured) MAC with a random MAC

On some boards there is no eeprom to hold the nvram, in this case instead
a board specific nvram is loaded from /lib/firmware. On most boards the
macaddr=... setting in the /lib/firmware nvram file is ignored because
the wifi/bt chip has a unique MAC programmed into the chip itself.

But in some cases the actual MAC from the /lib/firmware nvram file gets
used, leading to MAC conflicts.

The MAC addresses in the troublesome nvram files seem to all come from
the same nvram file template, so we can detect this by checking for
the template nvram file MAC.

Detect that the default MAC address is being used and replace it
with a random MAC address to avoid MAC address conflicts.

Note that udev will detect this is a random MAC based on
/sys/class/net/wlan0/addr_assign_type and then replace this with
a MAC based on hashing the netdev-name + the machine-id. So that
the MAC address is both guaranteed to be unique per machine while
it is still the same/persistent at each boot (assuming the
default Link.MACAddressPolicy=persistent udev setting).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220708133712.102179-2-hdegoede@redhat.com
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c