Search Linux Wireless

[PATCH v3 3/3] wifi: mac80211_hwsim: Add support for randomizing auth and deauth frames TA

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add changes to support randomizing TA of the authentication and
deauthentication frames and indicate the support to upper layers.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@xxxxxxxxxxx>
---
 drivers/net/wireless/mac80211_hwsim.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index c57c8903b7c0..40469d2723e5 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -720,6 +720,9 @@ struct mac80211_hwsim_data {
 	int rx_rssi;
 
 	struct mac80211_hwsim_link_data link_data[IEEE80211_MLD_MAX_NUM_LINKS];
+
+	/* Ack the frames with RA as configured temporary address */
+	u8 temp_addr[ETH_ALEN];
 };
 
 static const struct rhashtable_params hwsim_rht_params = {
@@ -1237,6 +1240,10 @@ static bool mac80211_hwsim_addr_match(struct mac80211_hwsim_data *data,
 	if (data->scanning && memcmp(addr, data->scan_addr, ETH_ALEN) == 0)
 		return true;
 
+	if (!is_zero_ether_addr(data->temp_addr) &&
+	    ether_addr_equal(addr, data->temp_addr))
+		return true;
+
 	memcpy(md.addr, addr, ETH_ALEN);
 
 	ieee80211_iterate_active_interfaces_atomic(data->hw,
@@ -2285,6 +2292,7 @@ static void mac80211_hwsim_vif_info_changed(struct ieee80211_hw *hw,
 					    u64 changed)
 {
 	struct hwsim_vif_priv *vp = (void *)vif->drv_priv;
+	struct mac80211_hwsim_data *hwsim = hw->priv;
 
 	hwsim_check_magic(vif);
 
@@ -2297,6 +2305,22 @@ static void mac80211_hwsim_vif_info_changed(struct ieee80211_hw *hw,
 		vp->assoc = vif->cfg.assoc;
 		vp->aid = vif->cfg.aid;
 	}
+
+	if (changed & BSS_CHANGED_TEMP_ADDR) {
+		wiphy_dbg(hw->wiphy, "  TMP_ADDR: vif->cfg.temp_addr=%pM\n",
+			  vif->cfg.temp_addr);
+
+		if (!is_zero_ether_addr(hwsim->temp_addr))
+			mac80211_hwsim_config_mac_nl(hw, hwsim->temp_addr,
+						     false);
+		if (!is_zero_ether_addr(vif->cfg.temp_addr)) {
+			ether_addr_copy(hwsim->temp_addr, vif->cfg.temp_addr);
+			mac80211_hwsim_config_mac_nl(hw, hwsim->temp_addr,
+						     true);
+		} else {
+			eth_zero_addr(hwsim->temp_addr);
+		}
+	}
 }
 
 static void mac80211_hwsim_link_info_changed(struct ieee80211_hw *hw,
@@ -4445,6 +4469,8 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
 			      NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS);
 	wiphy_ext_feature_set(hw->wiphy,
 			      NL80211_EXT_FEATURE_BEACON_RATE_LEGACY);
+	wiphy_ext_feature_set(hw->wiphy,
+			      NL80211_EXT_FEATURE_AUTH_AND_DEAUTH_RANDOM_TA);
 
 	hw->wiphy->interface_modes = param->iftypes;
 
-- 
2.25.1




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux