From: Jouni Malinen <jouni@codeaurora.org>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org, Jouni Malinen <jouni@codeaurora.org>
Subject: [PATCH 2/5] mac80211_hwsim: Random MAC address for a Management frame exchange
Date: Sat, 25 Apr 2020 18:57:10 +0300 [thread overview]
Message-ID: <20200425155713.25687-2-jouni@codeaurora.org> (raw)
In-Reply-To: <20200425155713.25687-1-jouni@codeaurora.org>
Allow a temporary random MAC address to be used for a Management frame
exchange. This can be used to test pre-association GAS/ANQP exchanges
with random addresses.
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
---
drivers/net/wireless/mac80211_hwsim.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 05e8203aa6d9..a05e9c778f21 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -535,6 +535,7 @@ struct mac80211_hwsim_data {
unsigned long next_start, start, end;
} survey_data[ARRAY_SIZE(hwsim_channels_2ghz) +
ARRAY_SIZE(hwsim_channels_5ghz)];
+ u8 mgmt_tx_rand_addr[ETH_ALEN];
struct ieee80211_channel *channel;
u64 beacon_int /* beacon interval in us */;
@@ -1006,7 +1007,9 @@ static bool mac80211_hwsim_addr_match(struct mac80211_hwsim_data *data,
.ret = false,
};
- if (data->scanning && memcmp(addr, data->scan_addr, ETH_ALEN) == 0)
+ if ((data->scanning && ether_addr_equal(addr, data->scan_addr)) ||
+ (is_valid_ether_addr(data->mgmt_tx_rand_addr) &&
+ ether_addr_equal(addr, data->mgmt_tx_rand_addr)))
return true;
memcpy(md.addr, addr, ETH_ALEN);
@@ -1507,6 +1510,12 @@ static void mac80211_hwsim_tx(struct ieee80211_hw *hw,
return;
}
+ if (txi->control.vif &&
+ !ether_addr_equal(hdr->addr2, txi->control.vif->addr))
+ memcpy(data->mgmt_tx_rand_addr, hdr->addr2, ETH_ALEN);
+ else
+ eth_zero_addr(data->mgmt_tx_rand_addr);
+
if (txi->control.vif)
hwsim_check_magic(txi->control.vif);
if (control->sta)
@@ -3060,6 +3069,7 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR;
wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_VHT_IBSS);
wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_BEACON_PROTECTION);
+ wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA);
hw->wiphy->interface_modes = param->iftypes;
--
2.20.1
next prev parent reply other threads:[~2020-04-25 15:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-25 15:57 [PATCH 1/5] mac80211: Random MAC address for a Management frame exchange Jouni Malinen
2020-04-25 15:57 ` Jouni Malinen [this message]
2020-04-25 15:57 ` [PATCH 3/5] mac80211_hwsim: Advertise support for multicast RX registration Jouni Malinen
2020-04-25 15:57 ` [PATCH 4/5] mac80211: TX legacy rate control for Beacon frames Jouni Malinen
2020-04-25 15:57 ` [PATCH 5/5] mac80211_hwsim: Claim support for setting Beacon frame TX legacy rate Jouni Malinen
2020-04-29 14:18 ` Johannes Berg
2020-04-29 14:14 ` [PATCH 1/5] mac80211: Random MAC address for a Management frame exchange Johannes Berg
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=20200425155713.25687-2-jouni@codeaurora.org \
--to=jouni@codeaurora.org \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).