From patchwork Thu Mar 28 18:16:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Kumar Singh X-Patchwork-Id: 1917537 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=xaljiTb/; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=quicinc.com header.i=@quicinc.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=goxzNla4; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V5BcJ6V28z1yYR for ; Fri, 29 Mar 2024 05:18:24 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oxNUFDGC28xDw8W/nqVE2ufQ3yoVG9z5ZMji8UkfIXM=; b=xaljiTb/pDbwDi F2X3RUiq8Hb9LdozTkNLDIUpYEpL9qCno0PXmAgAq8H21U7QJGnzjqBi3z1s0V8FKzKm7VhdxwtBf 6hd0MLZbquNJKOMdC0Hx+giZS6pxUXKdrIo5fspiHNb2bnmEzZ3zfh9vOVuKuwjId1RChvtzZLZmD zcyURyBB0jq07yr4Nre0glI5cSXwrsZX1U8Lz4QKOs9BsdQ+uApAQc+xl1c+5NOSZVE8bDF+IEPGZ Gb8iJ5RueX/aNPaNEwlGUbV9jhklisPV+fMbVwiRsxD+VgskrRvRCwcLAb4Nt0V2by4dCczeGiDPs M78RpRvZ4F/PM063I29Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpuK2-0000000F7Ft-0sIT; Thu, 28 Mar 2024 18:17:54 +0000 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpuJi-0000000F729-1Ym6 for hostap@lists.infradead.org; Thu, 28 Mar 2024 18:17:35 +0000 Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42SI9ohM029086 for ; Thu, 28 Mar 2024 18:17:34 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=vDyLHUbWv/Ecs+dR11T6ERdLn5yVADj1K0wR0IWd+C4=; b=go xzNla4GyS/heZ1tXR+Nx1qlakUfBXiHufkNFQfmxC5Arx8XAXWwEBDnA2ex+PD9D TRSDBHRFyAl8sojKm6818BzdXIjXzlbcdbRxJTFJ2UCr0TDWpCq17a/qr+O5VWKV ejh186/iJmvtgD/KqFeFxlAbycLAnNKiym6FuBcaDjKs4Uo6Tbc5FqGsedpEFh6T jafIXnHZQnVaNtlsTGJ6Bbgmc7GasOAyn6UyirsJz0Bm4QKNGs3D65/3eACcPrQI giWJ/SGP7svBz20SKLiGw2G1CbJ8gUqlcLX5jFhYgVj9QAAsaAIQG3B9H24w1wP4 1Bbbm3h8y9/G1yR9UXzg== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3x562rhfbu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 28 Mar 2024 18:17:33 +0000 (GMT) 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 42SIHXYm011342 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 28 Mar 2024 18:17:33 GMT Received: from hu-adisi-blr.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.1118.40; Thu, 28 Mar 2024 11:17:31 -0700 From: Aditya Kumar Singh To: CC: Sriram R , Aditya Kumar Singh Subject: [PATCH 09/22] hostapd: MLO: pass link_id in get_hapd_bssid helper function Date: Thu, 28 Mar 2024 23:46:39 +0530 Message-ID: <20240328181652.2956122-10-quic_adisi@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240328181652.2956122-1-quic_adisi@quicinc.com> References: <20240328181652.2956122-1-quic_adisi@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) 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: 4jYllkHwG7JuQD1sacAKdSuPdDOowyCa X-Proofpoint-GUID: 4jYllkHwG7JuQD1sacAKdSuPdDOowyCa X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-28_17,2024-03-28_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 bulkscore=0 phishscore=0 spamscore=0 malwarescore=0 mlxlogscore=973 mlxscore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 clxscore=1015 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2403210001 definitions=main-2403280128 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240328_111734_609283_960D8366 X-CRM114-Status: GOOD ( 17.74 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Sriram R Currently get_hapd_bssid() function matches the given bssid in all bsses of its own iface. However with MLO, there is requirement to check its own partner BSS at least. Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Sriram R Currently get_hapd_bssid() function matches the given bssid in all bsses of its own iface. However with MLO, there is requirement to check its own partner BSS at least. Make changes to compare its link partners as well and if link id passed matches with the link id of the partner then return it. Signed-off-by: Sriram R Signed-off-by: Aditya Kumar Singh --- src/ap/drv_callbacks.c | 47 +++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c index 2d32069091a9..adac2d478c2a 100644 --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c @@ -1750,7 +1750,7 @@ switch_link_hapd(struct hostapd_data *hapd, int link_id) #define HAPD_BROADCAST ((struct hostapd_data *) -1) static struct hostapd_data * get_hapd_bssid(struct hostapd_iface *iface, - const u8 *bssid) + const u8 *bssid, int link_id) { size_t i; @@ -1761,8 +1761,30 @@ static struct hostapd_data * get_hapd_bssid(struct hostapd_iface *iface, return HAPD_BROADCAST; for (i = 0; i < iface->num_bss; i++) { +#ifdef CONFIG_IEEE80211BE + struct hostapd_data *hapd, *p_hapd; + + hapd = iface->bss[i]; + if (ether_addr_equal(bssid, hapd->own_addr) || + (hapd->conf->mld_ap && + ether_addr_equal(bssid, hapd->mld->mld_addr) && + link_id == hapd->mld_link_id)) { + return hapd; + } else if (hapd->conf->mld_ap) { + for_each_mld_link(p_hapd, hapd) { + if (p_hapd == hapd) + continue; + + if (ether_addr_equal(bssid, p_hapd->own_addr) || + (ether_addr_equal(bssid, p_hapd->mld->mld_addr) && + link_id == p_hapd->mld_link_id)) + return p_hapd; + } + } +#else if (ether_addr_equal(bssid, iface->bss[i]->own_addr)) return iface->bss[i]; +#endif /*CONFIG_IEEE80211BE */ } return NULL; @@ -1773,7 +1795,7 @@ static void hostapd_rx_from_unknown_sta(struct hostapd_data *hapd, const u8 *bssid, const u8 *addr, int wds) { - hapd = get_hapd_bssid(hapd->iface, bssid); + hapd = get_hapd_bssid(hapd->iface, bssid, -1); if (hapd == NULL || hapd == HAPD_BROADCAST) return; @@ -1813,14 +1835,7 @@ static int hostapd_mgmt_rx(struct hostapd_data *hapd, struct rx_mgmt *rx_mgmt) if (bssid == NULL) return 0; -#ifdef CONFIG_IEEE80211BE - if (hapd->conf->mld_ap && - ether_addr_equal(hapd->mld->mld_addr, bssid)) - is_mld = true; -#endif /* CONFIG_IEEE80211BE */ - - if (!is_mld) - hapd = get_hapd_bssid(iface, bssid); + hapd = get_hapd_bssid(iface, bssid, rx_mgmt->link_id); if (!hapd) { u16 fc = le_to_host16(hdr->frame_control); @@ -1872,17 +1887,11 @@ static void hostapd_mgmt_tx_cb(struct hostapd_data *hapd, const u8 *buf, struct ieee80211_hdr *hdr; struct hostapd_data *orig_hapd, *tmp_hapd; -#ifdef CONFIG_IEEE80211BE - if (hapd->conf->mld_ap && link_id != -1) { - tmp_hapd = hostapd_mld_get_link_bss(hapd, link_id); - if (tmp_hapd) - hapd = tmp_hapd; - } -#endif /* CONFIG_IEEE80211BE */ orig_hapd = hapd; hdr = (struct ieee80211_hdr *) buf; - tmp_hapd = get_hapd_bssid(hapd->iface, get_hdr_bssid(hdr, len)); + hapd = switch_link_hapd(hapd, link_id); + tmp_hapd = get_hapd_bssid(hapd->iface, get_hdr_bssid(hdr, len), link_id); if (tmp_hapd) { hapd = tmp_hapd; #ifdef CONFIG_IEEE80211BE @@ -1899,7 +1908,7 @@ static void hostapd_mgmt_tx_cb(struct hostapd_data *hapd, const u8 *buf, if (stype != WLAN_FC_STYPE_ACTION || len <= 25 || buf[24] != WLAN_ACTION_PUBLIC) return; - hapd = get_hapd_bssid(orig_hapd->iface, hdr->addr2); + hapd = get_hapd_bssid(orig_hapd->iface, hdr->addr2, link_id); if (!hapd || hapd == HAPD_BROADCAST) return; /*