@@ -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;
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(-)