From patchwork Sun Jan 8 07:15:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Veerendranath Jakkam X-Patchwork-Id: 641239 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3B81C54EBE for ; Sun, 8 Jan 2023 07:16:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232002AbjAHHQ3 (ORCPT ); Sun, 8 Jan 2023 02:16:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231584AbjAHHQ2 (ORCPT ); Sun, 8 Jan 2023 02:16:28 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCB251A38A for ; Sat, 7 Jan 2023 23:16:27 -0800 (PST) Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3087BFDp020071; Sun, 8 Jan 2023 07:16:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=UO96Uw4BEMBBuMbf/pDEd3SPzLFgwpGvtMFqid7G4uw=; b=eVnVifKLbNccGq2WqQMaoSZbBQlcfKzjfmwrG5Du00Sy2yeohwXjXOrEWMcJSc52mb7J THzx/x0ho6fAEPfJwMMz0undp7w+Wuz0YXV0OHVJsDqd7BZeF9sauJZX7ttAAZTTM+Ni 1cM9E8zCtDr/xVe3dds/l3l9BGBgTKn6em3kcDSsAfQHuoZcU0Yt4JltaDjWFOJSeYf2 /Rap0Fiht9I0iVvKYOwcZRpXKggS74+RLZqZ8oJOyPBmOlLte9SRreZToOulP9YshgRY 9i76fURXTeX+GGxoSBtg0C+V8Uc4SJzFSXvV981/liaU2wGXsDRE8CpUBOU/q77fGfvU bw== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3mxx3w1e30-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 08 Jan 2023 07:16:22 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3087GLSS029308 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 8 Jan 2023 07:16:21 GMT Received: from cnss-mw-linux.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Sat, 7 Jan 2023 23:16:20 -0800 From: Veerendranath Jakkam To: CC: , Subject: [PATCH v2 3/3] wifi: mac80211_hwsim: Add support for randomizing auth and deauth frames TA Date: Sun, 8 Jan 2023 12:45:52 +0530 Message-ID: <20230108071552.2646591-3-quic_vjakkam@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230108071552.2646591-1-quic_vjakkam@quicinc.com> References: <20230108071552.2646591-1-quic_vjakkam@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: CfCfKLGgdRqdx4DIx9g_CJLIcRAtzmU1 X-Proofpoint-GUID: CfCfKLGgdRqdx4DIx9g_CJLIcRAtzmU1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-08_03,2023-01-06_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 lowpriorityscore=0 adultscore=0 priorityscore=1501 malwarescore=0 clxscore=1015 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 impostorscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301080049 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Add changes to support randomizing TA of the authentication and deauthentication frames and indicate the support to upper layers. Signed-off-by: Veerendranath Jakkam --- 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;