All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH v3 3/5] netdev: honor handshake->spa if set
Date: Thu, 19 Mar 2020 15:59:00 -0700	[thread overview]
Message-ID: <20200319225902.16249-3-prestwoj@gmail.com> (raw)
In-Reply-To: <20200319225902.16249-1-prestwoj@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1019 bytes --]

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.
---
 src/netdev.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/netdev.c b/src/netdev.c
index e1c775be..e1afeb63 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -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
-- 
2.21.1

  parent reply	other threads:[~2020-03-19 22:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-19 22:58 [PATCH v3 1/5] util: add util_is_valid_sta_address James Prestwood
2020-03-19 22:58 ` [PATCH v3 2/5] station: support full MAC randomization and override James Prestwood
2020-03-19 22:59 ` James Prestwood [this message]
2020-03-19 22:59 ` [PATCH v3 4/5] doc: document AlwaysRandomizeAddress and AddressOverride James Prestwood
2020-03-19 22:59 ` [PATCH v3 5/5] auto-t: add test for AddressRandomization option James Prestwood
2020-03-19 23:02 ` [PATCH v3 1/5] util: add util_is_valid_sta_address Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200319225902.16249-3-prestwoj@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=iwd@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.