netdev: honor handshake->spa if set

In order to support AlwaysRandomizeAddress and AddressOverride, station will
set the desired address into the handshake object. Then, netdev checks if
this was done and will use that address rather than generate one.
This commit is contained in:
James Prestwood 2020-03-19 15:59:00 -07:00 committed by Denis Kenzior
parent e7777c3422
commit f13fd9d61f
1 changed files with 6 additions and 1 deletions

View File

@ -2560,8 +2560,13 @@ static int netdev_start_powered_mac_change(struct netdev *netdev,
struct rtnl_data *req;
uint8_t new_addr[6];
wiphy_generate_address_from_ssid(netdev->wiphy, (const char *)bss->ssid,
/* No address set in handshake, use per-network MAC generation */
if (util_mem_is_zero(netdev->handshake->spa, ETH_ALEN))
wiphy_generate_address_from_ssid(netdev->wiphy,
(const char *)bss->ssid,
new_addr);
else
memcpy(new_addr, netdev->handshake->spa, ETH_ALEN);
/*
* MAC has already been changed previously, no need to again