From patchwork Mon Apr 22 11:19:03 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: 1926160 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=Tss9NJCj; 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=jEbyQIRZ; 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 4VNN7w0JJKz23p9 for ; Mon, 22 Apr 2024 21:19:55 +1000 (AEST) 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=xZoq07/BPHpJXhu44RLMviCTa+dzV7d+UjytZUiGbxQ=; b=Tss9NJCjQ3i7Eq kUwD26Yr062JaoAED1HDbRrUqaX11qEgVAwN6Ui5IMBYpsuSkEqI8i+nSyXcJF8ktq5Jd+b0CLmr2 CZ53DZReMuiWge9a6SrqvE/hSDul1JVyWcsU1hqobkcc66ot+YQQFRj7s/yoFl0YEMINXY7YNiJj+ zsdb9Mqs2sjFNDSWSAdEUbnTizPu9Rj9wbu7sXLOrKQ7w0pSljHIsmbreuftalTeczKQZBZWV/Ny7 1S+StVbvOk2gzHzeBpwGcoHzzddeuASwR5z+rDtOTdaA2X5VzbDsr2EBo94xdwz/LC/p4Yj+TEk09 pHuwPE13AGOJAHyT57cQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ryrhu-0000000DKar-0ln2; Mon, 22 Apr 2024 11:19:34 +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 1ryrhp-0000000DKZE-3hNh for hostap@lists.infradead.org; Mon, 22 Apr 2024 11:19:31 +0000 Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 43M9OVjZ012099 for ; Mon, 22 Apr 2024 11:19:28 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=lA84UgHy3yXSHvK1mHvg22rNbo+pJlMZQardZ8HtM/0=; b=jE byQIRZU6i5cKP2fTze/wdSb9j/BVLCtKkcnCe3b+prQswybQVTYhJNbVWQcCrU9K c2n6PF4Szx465/pmJo9n+GPylG/wgGqXfuzanv03mA3ygJrkw4hcIDFEvplUTPke t4p/ElDDmXHv1bnoGcTDoc7P57Dq79Ih+ZE9362aVVEquNRVyvvwT9xFFNoolfrh QjOqPcL4704AHD/g+b+5RRT8fIpQ31sh22YEASyZePGxk6nG1D8TnmvL6b6tVEd3 6ZHju2qzlREGO/xxYlMxV9Ksp8ywWTlu0A3vACOPglE6EM6ibfwhILOT5oKUs5ea a0DZLmP/ZEEAmURa5mPQ== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3xnn82rags-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 22 Apr 2024 11:19:28 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 43MBJROJ005186 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 22 Apr 2024 11:19:27 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.1544.9; Mon, 22 Apr 2024 04:19:26 -0700 From: Aditya Kumar Singh To: CC: Aditya Kumar Singh Subject: [PATCH 1/4] AP MLD: fix deferred first link BSS's radius, auth server and 802.1X initialization Date: Mon, 22 Apr 2024 16:49:03 +0530 Message-ID: <20240422111906.2928263-2-quic_adisi@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240422111906.2928263-1-quic_adisi@quicinc.com> References: <20240422111906.2928263-1-quic_adisi@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-GUID: HPpjxXRAGbjgLUdGthMSZ4M6ystxskZV X-Proofpoint-ORIG-GUID: HPpjxXRAGbjgLUdGthMSZ4M6ystxskZV X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-22_09,2024-04-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 adultscore=0 clxscore=1015 bulkscore=0 malwarescore=0 spamscore=0 impostorscore=0 priorityscore=1501 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2404010003 definitions=main-2404220051 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240422_041929_957096_B6EDC0D0 X-CRM114-Status: GOOD ( 20.38 ) 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: Currently, radius client, auth server and 802.1X are copied from first link's BSS into the non-first link during its setup. However, there could be a case where the first link is not initialized fully [...] 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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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 Currently, radius client, auth server and 802.1X are copied from first link's BSS into the non-first link during its setup. However, there could be a case where the first link is not initialized fully because of ACS/HT40 SCAN/DFS. Hence, in such cases, NULL is getting copied and later it leads to segmentation fault. Add changes to initialize those on behalf of the first link if such be the case and update it so that next time other non-first link can use it. Signed-off-by: Aditya Kumar Singh --- src/ap/authsrv.c | 16 ++++++-- src/ap/hostapd.c | 96 +++++++++++++++++++++++++++++---------------- src/ap/ieee802_1x.c | 15 +++++-- 3 files changed, 86 insertions(+), 41 deletions(-) diff --git a/src/ap/authsrv.c b/src/ap/authsrv.c index 6ed4d063349b..bfb89cc9b6a1 100644 --- a/src/ap/authsrv.c +++ b/src/ap/authsrv.c @@ -258,13 +258,21 @@ int authsrv_init(struct hostapd_data *hapd) { #ifdef CONFIG_IEEE80211BE if (!hostapd_mld_is_first_bss(hapd)) { - struct hostapd_data *first; - - wpa_printf(MSG_DEBUG, "MLD: Using auth_serv of the first BSS"); + struct hostapd_data *first = hostapd_mld_get_first_bss(hapd); - first = hostapd_mld_get_first_bss(hapd); if (!first) return -1; + + if (!first->eap_cfg) { + wpa_printf(MSG_DEBUG, + "MLD: First BSS auth_serv does not exist. Init on its behalf"); + + if (authsrv_init(first)) + return -1; + } + + wpa_printf(MSG_DEBUG, "MLD: Using auth_serv of the first BSS"); + #ifdef EAP_TLS_FUNCS hapd->ssl_ctx = first->ssl_ctx; #endif /* EAP_TLS_FUNCS */ diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index 130b6ebc6b21..eb5bf3371456 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -1307,6 +1307,58 @@ static int hostapd_start_beacon(struct hostapd_data *hapd, } +#ifndef CONFIG_NO_RADIUS +static int hostapd_bss_radius_init(struct hostapd_data *hapd) +{ + struct hostapd_bss_config *conf; + + if (!hapd) + return -1; + + conf = hapd->conf; + + if (hapd->radius) { + wpa_printf(MSG_DEBUG, "Skipping RADIUS client init (already done)"); + return 0; + } + + hapd->radius = radius_client_init(hapd, conf->radius); + if (!hapd->radius) { + wpa_printf(MSG_ERROR, + "RADIUS client initialization failed."); + return -1; + } + + if (conf->radius_das_port) { + struct radius_das_conf das_conf; + + os_memset(&das_conf, 0, sizeof(das_conf)); + das_conf.port = conf->radius_das_port; + das_conf.shared_secret = conf->radius_das_shared_secret; + das_conf.shared_secret_len = + conf->radius_das_shared_secret_len; + das_conf.client_addr = &conf->radius_das_client_addr; + das_conf.time_window = conf->radius_das_time_window; + das_conf.require_event_timestamp = + conf->radius_das_require_event_timestamp; + das_conf.require_message_authenticator = + conf->radius_das_require_message_authenticator; + das_conf.ctx = hapd; + das_conf.disconnect = hostapd_das_disconnect; + das_conf.coa = hostapd_das_coa; + hapd->radius_das = radius_das_init(&das_conf); + if (!hapd->radius_das) { + wpa_printf(MSG_ERROR, + "RADIUS DAS initialization failed."); + return -1; + } + } + + return 0; +} +#endif /* CONFIG_NO_RADIUS */ + + /** * hostapd_setup_bss - Per-BSS setup (initialization) * @hapd: Pointer to BSS data @@ -1540,46 +1592,24 @@ setup_mld: #endif /* CONFIG_SQLITE */ if (hostapd_mld_is_first_bss(hapd)) { - hapd->radius = radius_client_init(hapd, conf->radius); - if (!hapd->radius) { - wpa_printf(MSG_ERROR, - "RADIUS client initialization failed."); + if (hostapd_bss_radius_init(hapd)) + return -1; + } else { +#ifdef CONFIG_IEEE80211BE + struct hostapd_data *f_bss = hostapd_mld_get_first_bss(hapd); + if (!f_bss) return -1; - } - if (conf->radius_das_port) { - struct radius_das_conf das_conf; - - os_memset(&das_conf, 0, sizeof(das_conf)); - das_conf.port = conf->radius_das_port; - das_conf.shared_secret = conf->radius_das_shared_secret; - das_conf.shared_secret_len = - conf->radius_das_shared_secret_len; - das_conf.client_addr = &conf->radius_das_client_addr; - das_conf.time_window = conf->radius_das_time_window; - das_conf.require_event_timestamp = - conf->radius_das_require_event_timestamp; - das_conf.require_message_authenticator = - conf->radius_das_require_message_authenticator; - das_conf.ctx = hapd; - das_conf.disconnect = hostapd_das_disconnect; - das_conf.coa = hostapd_das_coa; - hapd->radius_das = radius_das_init(&das_conf); - if (!hapd->radius_das) { - wpa_printf(MSG_ERROR, - "RADIUS DAS initialization failed."); + if (!f_bss->radius) { + wpa_printf(MSG_DEBUG, + "MLD: First BSS RADIUS client does not exist. Init on its behalf"); + + if (hostapd_bss_radius_init(f_bss)) return -1; - } } - } else { -#ifdef CONFIG_IEEE80211BE - struct hostapd_data *f_bss; wpa_printf(MSG_DEBUG, "MLD: Using RADIUS client of the first BSS"); - f_bss = hostapd_mld_get_first_bss(hapd); - if (!f_bss) - return -1; hapd->radius = f_bss->radius; hapd->radius_das = f_bss->radius_das; #endif /* CONFIG_IEEE80211BE */ diff --git a/src/ap/ieee802_1x.c b/src/ap/ieee802_1x.c index 8e98b6521695..857f0d184774 100644 --- a/src/ap/ieee802_1x.c +++ b/src/ap/ieee802_1x.c @@ -2541,14 +2541,21 @@ int ieee802_1x_init(struct hostapd_data *hapd) #ifdef CONFIG_IEEE80211BE if (!hostapd_mld_is_first_bss(hapd)) { - struct hostapd_data *first; + struct hostapd_data *first = hostapd_mld_get_first_bss(hapd); + if (!first) + return -1; + + if (!first->eapol_auth) { + wpa_printf(MSG_DEBUG, + "MLD: First BSS IEEE 802.1X state machine does not exist. Init on its behalf"); + + if (ieee802_1x_init(first)) + return -1; + } wpa_printf(MSG_DEBUG, "MLD: Using IEEE 802.1X state machine of the first BSS"); - first = hostapd_mld_get_first_bss(hapd); - if (!first) - return -1; hapd->eapol_auth = first->eapol_auth; return 0; } From patchwork Mon Apr 22 11:19:04 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: 1926163 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=BssU4dhf; 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=ldEv6s5I; 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 4VNN7y0PbJz1ybF for ; Mon, 22 Apr 2024 21:19:58 +1000 (AEST) 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=jL8Atjm+1L8ebrHQ2L0jlpu6xopAFyemzn7U/GpVfA4=; b=BssU4dhf7x6h7U PuHfho9SR6x5tzXTdtQkLHlZhcwXPYsjLSA24B00X4p/yq12UncrV0nCX/MmA6+/r/wTzDYFET+k0 iIOLK01WUzGzYjDSLFGD+okcFQvC7T+x9xZWV2apnwgK46vCOr1ehPbkApdlCoV2TMDZOuj3zeelr 1bn3LUmW8t6xgq3COZiRJVGw9a41SOGqKSfSga+ysSAc9Yn24lZOSgR0k8H87CMBDJ535ifJ2TVnz eRPcE5P1favw90rr1/b46MT1cp/UQTZQb/XNW6S4Hx5MlgcgU1zO6zTAgExm87ieU7Kgp6hg1lwR1 5f9Mjn9PcLzsEtqE/yCQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ryrhw-0000000DKbU-1D7L; Mon, 22 Apr 2024 11:19:36 +0000 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1ryrhr-0000000DKZt-1ZMP for hostap@lists.infradead.org; Mon, 22 Apr 2024 11:19:32 +0000 Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 43MAqX8O005226 for ; Mon, 22 Apr 2024 11:19:30 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=twb02xEV2VsbEo8LJ07K6errLUu+0zSG4N4Jm8PHG/w=; b=ld Ev6s5IRZZmR9M/K20wQh8g8xk/1Q+tT1/pjZHI/bvzgWfGD0kRzxfP80550Jfjh+ eOKYF0P7Dal8ChINc/KOiQTl3ilc+bXFXRwCiGVy/8Ja+OgElb015Ei+IhqdfXJ2 abq+vUAFOPbfYxvAxeGh75Yn8q7pK72Cg9u5G4zjj9eHK3zOaZneaInZA51eRoBe 57vhONp94rCbmNudzHa8ubMhLw7S+S3OfgUikoHTfoFq3KovbZKV0sv+Ay3rGq6M 9Hda5rDdK+0oMQJI63Fqv1EK+oRbpsK7dCLJ0JxvwXb1wlBI+anaQAIKUzXuKkl2 RMG5knWpruJp5tiu02BA== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3xm5sx44tk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 22 Apr 2024 11:19:30 +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 43MBJTgS001151 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 22 Apr 2024 11:19:29 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.1544.9; Mon, 22 Apr 2024 04:19:27 -0700 From: Aditya Kumar Singh To: CC: Aditya Kumar Singh Subject: [PATCH 2/4] nl80211: fix scan request and its related events handling with MLO Date: Mon, 22 Apr 2024 16:49:04 +0530 Message-ID: <20240422111906.2928263-3-quic_adisi@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240422111906.2928263-1-quic_adisi@quicinc.com> References: <20240422111906.2928263-1-quic_adisi@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: NEru66F5XI9BBihpIzZhZ2URrQ-ZptA4 X-Proofpoint-GUID: NEru66F5XI9BBihpIzZhZ2URrQ-ZptA4 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-22_09,2024-04-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 phishscore=0 clxscore=1015 suspectscore=0 malwarescore=0 spamscore=0 bulkscore=0 mlxscore=0 lowpriorityscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2404010003 definitions=main-2404220051 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240422_041931_591857_D9F0FB6B X-CRM114-Status: GOOD ( 31.18 ) 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: Currently, whenever a scan is started, it uses drv's first BSS only whether it is AP or STA interface. However with MLO AP related changes, same drv could be used by other BSSes as well which needs sc [...] 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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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 Currently, whenever a scan is started, it uses drv's first BSS only whether it is AP or STA interface. However with MLO AP related changes, same drv could be used by other BSSes as well which needs scanning. Hence, the current logic will not work since scan needs to be handled on non-first BSS as well. Add changes to move the logic of always using drv's first BSS during scan events to using BSS on which the event arrived. Also, for ML AP operation, even though BSS is same, link BSS also needs to be identified. Hence add a back pointer in BSS struct which would be used to point to the link BSS which requested scan on that BSS. This will help in routing the scan events to appropriate BSS ctx. Signed-off-by: Aditya Kumar Singh --- src/ap/ap_drv_ops.c | 6 ++ src/drivers/driver.h | 8 ++ src/drivers/driver_nl80211.c | 20 +++- src/drivers/driver_nl80211.h | 3 +- src/drivers/driver_nl80211_event.c | 144 +++++++++++++++++++---------- src/drivers/driver_nl80211_scan.c | 27 +++++- wpa_supplicant/scan.c | 1 + 7 files changed, 152 insertions(+), 57 deletions(-) diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c index c47349110e5f..a875422f0d45 100644 --- a/src/ap/ap_drv_ops.c +++ b/src/ap/ap_drv_ops.c @@ -781,6 +781,12 @@ bool hostapd_drv_nl80211(struct hostapd_data *hapd) int hostapd_driver_scan(struct hostapd_data *hapd, struct wpa_driver_scan_params *params) { + params->mlo_link_id = -1; +#ifdef CONFIG_IEEE80211BE + if (hapd->conf->mld_ap) + params->mlo_link_id = hapd->mld_link_id; +#endif /* CONFIG_IEEE80211BE */ + if (hapd->driver && hapd->driver->scan2) return hapd->driver->scan2(hapd->drv_priv, params); return -1; diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 52632154ee4b..9873acb524fc 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -709,6 +709,14 @@ struct wpa_driver_scan_params { */ s8 link_id; + /** + * mlo_link_id - Link ID (in case of MLO) + * + * If this is set to value >= 0, after scan completion, this would be + * used to route the event to proper driver private data. + */ + u8 mlo_link_id; + /* * NOTE: Whenever adding new parameters here, please make sure * wpa_scan_clone_params() and wpa_scan_free_params() get updated with diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index c6af0f02f619..b2efcddf058f 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -4195,6 +4195,22 @@ struct i802_link * nl80211_get_link(struct i802_bss *bss, s8 link_id) } +u8 nl80211_get_link_id_from_link(struct i802_bss *bss, struct i802_link *link) +{ + u8 link_id; + + if (link == bss->flink) + return 0; + + for_each_link(bss->valid_links, link_id) { + if (&bss->links[link_id] == link) + return link_id; + } + + return 0; +} + + static void nl80211_link_set_freq(struct i802_bss *bss, s8 link_id, int freq) { struct i802_link *link = nl80211_get_link(bss, link_id); @@ -10259,7 +10275,9 @@ static int wpa_driver_nl80211_get_survey(void *priv, unsigned int freq) if (err) wpa_printf(MSG_ERROR, "nl80211: Failed to process survey data"); else - wpa_supplicant_event(drv->ctx, EVENT_SURVEY, &data); + wpa_supplicant_event((bss->scan_link && bss->scan_link->ctx) ? + bss->scan_link->ctx : bss->ctx, + EVENT_SURVEY, &data); clean_survey_results(survey_results); return err; diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h index 618746e67722..8e1426465586 100644 --- a/src/drivers/driver_nl80211.h +++ b/src/drivers/driver_nl80211.h @@ -67,7 +67,7 @@ struct i802_bss { u16 valid_links; struct i802_link links[MAX_NUM_MLD_LINKS]; - struct i802_link *flink; + struct i802_link *flink, *scan_link; int ifindex; int br_ifindex; @@ -352,6 +352,7 @@ const char * nl80211_iftype_str(enum nl80211_iftype mode); void nl80211_restore_ap_mode(struct i802_bss *bss); struct i802_link * nl80211_get_link(struct i802_bss *bss, s8 link_id); +u8 nl80211_get_link_id_from_link(struct i802_bss *bss, struct i802_link *link); static inline bool nl80211_link_valid(u16 links, s8 link_id) { diff --git a/src/drivers/driver_nl80211_event.c b/src/drivers/driver_nl80211_event.c index 6e75748792bf..6432a3274d09 100644 --- a/src/drivers/driver_nl80211_event.c +++ b/src/drivers/driver_nl80211_event.c @@ -1959,9 +1959,10 @@ static void mlme_event_dh_event(struct wpa_driver_nl80211_data *drv, } -static void send_scan_event(struct wpa_driver_nl80211_data *drv, int aborted, +static void send_scan_event(struct i802_bss *bss, int aborted, struct nlattr *tb[], int external_scan) { + struct wpa_driver_nl80211_data *drv = bss->drv; union wpa_event_data event; struct nlattr *nl; int rem; @@ -1969,6 +1970,8 @@ static void send_scan_event(struct wpa_driver_nl80211_data *drv, int aborted, #define MAX_REPORT_FREQS 110 int freqs[MAX_REPORT_FREQS]; int num_freqs = 0; + struct i802_link *mld_link; + void *ctx = bss->ctx; if (!external_scan && drv->scan_for_auth) { drv->scan_for_auth = 0; @@ -2032,7 +2035,25 @@ static void send_scan_event(struct wpa_driver_nl80211_data *drv, int aborted, ETH_ALEN); } - wpa_supplicant_event(drv->ctx, EVENT_SCAN_RESULTS, &event); + /* need to pass to correct link ctx during AP operation */ + if (is_ap_interface(drv->nlmode)) { + mld_link = bss->scan_link; + if (!mld_link) { + wpa_printf(MSG_DEBUG, "nl80211: Scan event on unknown link"); + goto process_scan_event; + } + + if (mld_link->ctx) { + u8 link_id = nl80211_get_link_id_from_link(bss, mld_link); + + wpa_printf(MSG_DEBUG, "nl80211: Scan event for link_id %d", + link_id); + ctx = mld_link->ctx; + } + } + +process_scan_event: + wpa_supplicant_event(ctx, EVENT_SCAN_RESULTS, &event); } @@ -3833,48 +3854,16 @@ static void nl80211_color_change_announcement_completed(struct i802_bss *bss) #endif /* CONFIG_IEEE80211AX */ -static void do_process_drv_event(struct i802_bss *bss, int cmd, - struct nlattr **tb) +static void nl80211_scan_event(struct i802_bss *bss, enum nl80211_commands cmd, + struct nlattr *tb[]) { struct wpa_driver_nl80211_data *drv = bss->drv; int external_scan_event = 0; - struct nlattr *frame = tb[NL80211_ATTR_FRAME]; - - wpa_printf(MSG_DEBUG, "nl80211: Drv Event %d (%s) received for %s", - cmd, nl80211_command_to_string(cmd), bss->ifname); - -#ifdef CONFIG_DRIVER_NL80211_QCA - if (cmd == NL80211_CMD_ROAM && - (drv->capa.flags & WPA_DRIVER_FLAGS_KEY_MGMT_OFFLOAD)) { - if (drv->pending_roam_data) { - wpa_printf(MSG_DEBUG, - "nl80211: Process pending roam+auth vendor event"); - qca_nl80211_key_mgmt_auth(drv, drv->pending_roam_data, - drv->pending_roam_data_len); - os_free(drv->pending_roam_data); - drv->pending_roam_data = NULL; - return; - } - /* - * Device will use roam+auth vendor event to indicate - * roaming, so ignore the regular roam event. - */ - drv->roam_indication_done = true; - wpa_printf(MSG_DEBUG, - "nl80211: Ignore roam event (cmd=%d), device will use vendor event roam+auth", - cmd); - return; - } -#endif /* CONFIG_DRIVER_NL80211_QCA */ - - if (drv->ap_scan_as_station != NL80211_IFTYPE_UNSPECIFIED && - (cmd == NL80211_CMD_NEW_SCAN_RESULTS || - cmd == NL80211_CMD_SCAN_ABORTED)) - nl80211_restore_ap_mode(bss); + void *ctx = bss->ctx; switch (cmd) { case NL80211_CMD_TRIGGER_SCAN: - wpa_dbg(drv->ctx, MSG_DEBUG, "nl80211: Scan trigger"); + wpa_dbg(ctx, MSG_DEBUG, "nl80211: Scan trigger"); drv->scan_state = SCAN_STARTED; if (drv->scan_for_auth) { /* @@ -3886,40 +3875,40 @@ static void do_process_drv_event(struct i802_bss *bss, int cmd, wpa_printf(MSG_DEBUG, "nl80211: Do not indicate scan-start event due to internal scan_for_auth"); break; } - wpa_supplicant_event(drv->ctx, EVENT_SCAN_STARTED, NULL); + wpa_supplicant_event(ctx, EVENT_SCAN_STARTED, NULL); break; case NL80211_CMD_START_SCHED_SCAN: - wpa_dbg(drv->ctx, MSG_DEBUG, "nl80211: Sched scan started"); + wpa_dbg(ctx, MSG_DEBUG, "nl80211: Sched scan started"); drv->scan_state = SCHED_SCAN_STARTED; break; case NL80211_CMD_SCHED_SCAN_STOPPED: - wpa_dbg(drv->ctx, MSG_DEBUG, "nl80211: Sched scan stopped"); + wpa_dbg(ctx, MSG_DEBUG, "nl80211: Sched scan stopped"); drv->scan_state = SCHED_SCAN_STOPPED; - wpa_supplicant_event(drv->ctx, EVENT_SCHED_SCAN_STOPPED, NULL); + wpa_supplicant_event(ctx, EVENT_SCHED_SCAN_STOPPED, NULL); break; case NL80211_CMD_NEW_SCAN_RESULTS: - wpa_dbg(drv->ctx, MSG_DEBUG, + wpa_dbg(ctx, MSG_DEBUG, "nl80211: New scan results available"); if (drv->last_scan_cmd != NL80211_CMD_VENDOR) drv->scan_state = SCAN_COMPLETED; drv->scan_complete_events = 1; if (drv->last_scan_cmd == NL80211_CMD_TRIGGER_SCAN) { eloop_cancel_timeout(wpa_driver_nl80211_scan_timeout, - drv, drv->ctx); + drv, bss->ctx); drv->last_scan_cmd = 0; } else { external_scan_event = 1; } - send_scan_event(drv, 0, tb, external_scan_event); + send_scan_event(bss, 0, tb, external_scan_event); break; case NL80211_CMD_SCHED_SCAN_RESULTS: - wpa_dbg(drv->ctx, MSG_DEBUG, + wpa_dbg(ctx, MSG_DEBUG, "nl80211: New sched scan results available"); drv->scan_state = SCHED_SCAN_RESULTS; - send_scan_event(drv, 0, tb, 0); + send_scan_event(bss, 0, tb, 0); break; case NL80211_CMD_SCAN_ABORTED: - wpa_dbg(drv->ctx, MSG_DEBUG, "nl80211: Scan aborted"); + wpa_dbg(ctx, MSG_DEBUG, "nl80211: Scan aborted"); if (drv->last_scan_cmd != NL80211_CMD_VENDOR) drv->scan_state = SCAN_ABORTED; if (drv->last_scan_cmd == NL80211_CMD_TRIGGER_SCAN) { @@ -3928,12 +3917,67 @@ static void do_process_drv_event(struct i802_bss *bss, int cmd, * order not to make wpa_supplicant stop its scanning. */ eloop_cancel_timeout(wpa_driver_nl80211_scan_timeout, - drv, drv->ctx); + drv, bss->ctx); drv->last_scan_cmd = 0; } else { external_scan_event = 1; } - send_scan_event(drv, 1, tb, external_scan_event); + send_scan_event(bss, 1, tb, external_scan_event); + break; + default: + wpa_dbg(ctx, MSG_DEBUG, "nl80211: Unknown scan cmd %d (%s)", + cmd, nl80211_command_to_string(cmd)); + break; + } +} + + +static void do_process_drv_event(struct i802_bss *bss, int cmd, + struct nlattr **tb) +{ + struct wpa_driver_nl80211_data *drv = bss->drv; + struct nlattr *frame = tb[NL80211_ATTR_FRAME]; + + wpa_printf(MSG_DEBUG, "nl80211: Drv Event %d (%s) received for %s", + cmd, nl80211_command_to_string(cmd), bss->ifname); + +#ifdef CONFIG_DRIVER_NL80211_QCA + if (cmd == NL80211_CMD_ROAM && + (drv->capa.flags & WPA_DRIVER_FLAGS_KEY_MGMT_OFFLOAD)) { + if (drv->pending_roam_data) { + wpa_printf(MSG_DEBUG, + "nl80211: Process pending roam+auth vendor event"); + qca_nl80211_key_mgmt_auth(drv, drv->pending_roam_data, + drv->pending_roam_data_len); + os_free(drv->pending_roam_data); + drv->pending_roam_data = NULL; + return; + } + /* + * Device will use roam+auth vendor event to indicate + * roaming, so ignore the regular roam event. + */ + drv->roam_indication_done = true; + wpa_printf(MSG_DEBUG, + "nl80211: Ignore roam event (cmd=%d), device will use vendor event roam+auth", + cmd); + return; + } +#endif /* CONFIG_DRIVER_NL80211_QCA */ + + if (drv->ap_scan_as_station != NL80211_IFTYPE_UNSPECIFIED && + (cmd == NL80211_CMD_NEW_SCAN_RESULTS || + cmd == NL80211_CMD_SCAN_ABORTED)) + nl80211_restore_ap_mode(bss); + + switch (cmd) { + case NL80211_CMD_TRIGGER_SCAN: + case NL80211_CMD_START_SCHED_SCAN: + case NL80211_CMD_SCHED_SCAN_STOPPED: + case NL80211_CMD_NEW_SCAN_RESULTS: + case NL80211_CMD_SCHED_SCAN_RESULTS: + case NL80211_CMD_SCAN_ABORTED: + nl80211_scan_event(bss, cmd, tb); break; case NL80211_CMD_AUTHENTICATE: case NL80211_CMD_ASSOCIATE: diff --git a/src/drivers/driver_nl80211_scan.c b/src/drivers/driver_nl80211_scan.c index 1eb4374052e5..68deb2d9e296 100644 --- a/src/drivers/driver_nl80211_scan.c +++ b/src/drivers/driver_nl80211_scan.c @@ -153,6 +153,7 @@ fail: void wpa_driver_nl80211_scan_timeout(void *eloop_ctx, void *timeout_ctx) { struct wpa_driver_nl80211_data *drv = eloop_ctx; + struct i802_bss *bss; wpa_printf(MSG_DEBUG, "nl80211: Scan timeout - try to abort it"); #ifdef CONFIG_DRIVER_NL80211_QCA @@ -160,14 +161,22 @@ void wpa_driver_nl80211_scan_timeout(void *eloop_ctx, void *timeout_ctx) nl80211_abort_vendor_scan(drv, drv->vendor_scan_cookie) == 0) return; #endif /* CONFIG_DRIVER_NL80211_QCA */ + + for (bss = drv->first_bss; bss; bss = bss->next) { + if (bss->scan_link) + break; + } + if (!drv->vendor_scan_cookie && - nl80211_abort_scan(drv->first_bss) == 0) + nl80211_abort_scan(bss) == 0) { + bss->scan_link = NULL; return; + } wpa_printf(MSG_DEBUG, "nl80211: Failed to abort scan"); if (drv->ap_scan_as_station != NL80211_IFTYPE_UNSPECIFIED) - nl80211_restore_ap_mode(drv->first_bss); + nl80211_restore_ap_mode(bss); wpa_printf(MSG_DEBUG, "nl80211: Try to get scan results"); wpa_supplicant_event(timeout_ctx, EVENT_SCAN_RESULTS, NULL); @@ -347,7 +356,7 @@ int wpa_driver_nl80211_scan(struct i802_bss *bss, int ret = -1, timeout; struct nl_msg *msg = NULL; - wpa_dbg(drv->ctx, MSG_DEBUG, "nl80211: scan request"); + wpa_dbg(bss->ctx, MSG_DEBUG, "nl80211: scan request"); drv->scan_for_auth = 0; if (TEST_FAIL()) @@ -440,11 +449,19 @@ int wpa_driver_nl80211_scan(struct i802_bss *bss, } wpa_printf(MSG_DEBUG, "Scan requested (ret=%d) - scan timeout %d " "seconds", ret, timeout); - eloop_cancel_timeout(wpa_driver_nl80211_scan_timeout, drv, drv->ctx); + eloop_cancel_timeout(wpa_driver_nl80211_scan_timeout, drv, bss->ctx); eloop_register_timeout(timeout, 0, wpa_driver_nl80211_scan_timeout, - drv, drv->ctx); + drv, bss->ctx); drv->last_scan_cmd = NL80211_CMD_TRIGGER_SCAN; + bss->scan_link = bss->flink; + if (is_ap_interface(drv->nlmode) && + nl80211_link_valid(bss->valid_links, params->mlo_link_id)) { + wpa_dbg(bss->ctx, MSG_DEBUG, "nl80211: scan requested for link %d", + params->mlo_link_id); + bss->scan_link = nl80211_get_link(bss, params->mlo_link_id); + } + fail: nlmsg_free(msg); return ret; diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index 8b59e409b81d..f97af36f9c8c 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -3390,6 +3390,7 @@ wpa_scan_clone_params(const struct wpa_driver_scan_params *src) params->p2p_include_6ghz = src->p2p_include_6ghz; params->non_coloc_6ghz = src->non_coloc_6ghz; params->min_probe_req_content = src->min_probe_req_content; + params->mlo_link_id = src->mlo_link_id; return params; failed: From patchwork Mon Apr 22 11:19:05 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: 1926159 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=e2gnpjeU; 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=ojzAarlq; 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 4VNN7v6w8Cz1ybF for ; Mon, 22 Apr 2024 21:19:55 +1000 (AEST) 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=AVFwnB6+dnu5NY7BbpDgFNZdIa5gMWNnesTu7X4QRuI=; b=e2gnpjeUGGqmZp MNGMrjMe4THamrh4GeJakinm0e7GATxB3HVGC4BEDUtZIhKWiNxseDbKT3kf8BiLqBKW9OcK5SL6B JUGPWqjO14puF8odQy1wwb1fL/TO7ddLiPl1U0KBYmorm/o9Tqmc4hNrlb8RSubTEp09ZeyjGmaGb 8kFkeNl/zTSKWdmeGil0/5yJdvBuvA3Jad1XotYfAVFntFaFljh8y+Fk+UgGzbmgvrNc1ScImcsqg aYSDRU8U4tSPd1QjW8SGI6ozZcouK/IEQIooNPCD+0RNZCjjbnWwzW8vR/E80u9x/Ux7GX99YI8D0 bWlPk4Wbn8aFkIEqEGig==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ryrhx-0000000DKbi-1Xvo; Mon, 22 Apr 2024 11:19:37 +0000 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1ryrht-0000000DKaN-0Xc5 for hostap@lists.infradead.org; Mon, 22 Apr 2024 11:19:35 +0000 Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 43M3CcOE013928 for ; Mon, 22 Apr 2024 11:19:32 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=8U+6viEeeCZqcCXrZAGLiSX9jjYzO3Kns9rShWwKKjw=; b=oj zAarlqrElrGvv7fTW7anKs5Q+Y9h24/omJbboT/ROsLkpgUsrq9lC6iwpNaDWKO9 tocwUNJScsrntQ4EhJm92JyyFWqO0fznnXIHKiLX2VS+ukZvNIPaxPjdJL0R3VB2 EENPnByENTV0Oak0EG7UsD6akOUhXfoCQjqtQNXg/2P7lBjcxSyCccIj1M8BSWUS YrlXU++UaXlSzo9HWUlTI1hGrzSzBc7xkIoH0dx1ZAGUskhvj3+KYc05VXFw6DYx SBpK8ZcX/hLnOHyXFdBVqWA0QWjZkcEEO5QByhSqxELFkGM4jluBYIiuE70sq52j UuUrlvhBI+U+re+YbyAA== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3xm5sx44tm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 22 Apr 2024 11:19:31 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 43MBJV5K005698 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 22 Apr 2024 11:19:31 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.1544.9; Mon, 22 Apr 2024 04:19:29 -0700 From: Aditya Kumar Singh To: CC: Aditya Kumar Singh Subject: [PATCH 3/4] nl80211: fix simultaneous scanning failure in case of MLO Date: Mon, 22 Apr 2024 16:49:05 +0530 Message-ID: <20240422111906.2928263-4-quic_adisi@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240422111906.2928263-1-quic_adisi@quicinc.com> References: <20240422111906.2928263-1-quic_adisi@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: ssADnNXk_rx6Zur7duWc_01H0wm7nSar X-Proofpoint-GUID: ssADnNXk_rx6Zur7duWc_01H0wm7nSar X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-22_09,2024-04-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 phishscore=0 clxscore=1015 suspectscore=0 malwarescore=0 spamscore=0 bulkscore=0 mlxscore=0 lowpriorityscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2404010003 definitions=main-2404220051 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240422_041933_333122_CCE56AB7 X-CRM114-Status: GOOD ( 18.39 ) 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: Currently only 1 scan can be performed on per phy level at a time in driver. Due to this, if via other underlying phy, a scan request is sent, kernel returns -EBUSY. And then hostapd would try to set [...] 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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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 Currently only 1 scan can be performed on per phy level at a time in driver. Due to this, if via other underlying phy, a scan request is sent, kernel returns -EBUSY. And then hostapd would try to set the interface in station mode if it was originally in AP mode and retry sending a scan request. However, this behaviour is expected in case of multi link operation and hence there is no need to switch the mode as such. Hence, add logic to not change the NL mode if kernel returns -EBUSY during multi link AP operation. The caller can accordingly decide and if needed, it can re-schedule a scan request after some time. Signed-off-by: Aditya Kumar Singh --- src/drivers/driver_nl80211_scan.c | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/drivers/driver_nl80211_scan.c b/src/drivers/driver_nl80211_scan.c index 68deb2d9e296..95c7ba80e81a 100644 --- a/src/drivers/driver_nl80211_scan.c +++ b/src/drivers/driver_nl80211_scan.c @@ -413,6 +413,40 @@ int wpa_driver_nl80211_scan(struct i802_bss *bss, if (drv->hostapd && is_ap_interface(drv->nlmode)) { enum nl80211_iftype old_mode = drv->nlmode; +#ifdef CONFIG_IEEE80211BE + /* For Multi Link BSS, retry scan if any other links + * are busy scanning + */ + if (ret == -EBUSY && + nl80211_link_valid(bss->valid_links, params->mlo_link_id)) { + struct i802_bss *link_bss; + u8 link_id; + + wpa_printf(MSG_DEBUG, + "nl80211: Scan trigger on Multi Link BSS failed (requested link=%d on interface %s)", + params->mlo_link_id, bss->ifname); + + for (link_bss = drv->first_bss; link_bss; + link_bss = link_bss->next) + if (link_bss->scan_link) + break; + + if (!link_bss) { + wpa_printf(MSG_DEBUG, + "nl80211: Interface information already running scan not available"); + goto fail; + } + + link_id = + nl80211_get_link_id_from_link(link_bss, + link_bss->scan_link); + wpa_printf(MSG_DEBUG, + "nl80211: Scan already running on interface %s link %d", + link_bss->ifname, link_id); + goto fail; + } +#endif /* CONFIG_IEEE80211BE */ + /* * mac80211 does not allow scan requests in AP mode, so * try to do this in station mode. From patchwork Mon Apr 22 11:19:06 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: 1926162 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=KM34fkrA; 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=nD6F8rvt; 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 4VNN7x2swBz23p9 for ; Mon, 22 Apr 2024 21:19:57 +1000 (AEST) 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=THxdFjv9wAt1IWNACFAGs4+ZYC9Ciy8fRg9Aeu4K+y8=; b=KM34fkrAXVh0pM gz5/kKBuroQKQGX6H0DzOKqY4Ho3gueAxzq7UgkHDU7yGNq4HpJNxoIixjmFXI6yrCr4nMzV0rTdR jQC2HWqAqtq/tm6T3Onl5jjJQ1v7UsAiSElKKOAp3iOUFCTGD7GqZ5sBD88likwDFtgTD/pyn4n+M bX/SCmWAc0gGSJmUEOXCgzwh7aCAqC10eU89QZU6suyt6dBFU3hhrK+87O71G6y1Xukw3GwOg+a8Q EYr1OMmH2aVuLyk+Vye7pGEsuXDhBpNXOdJ85dn3estMu6OK3tfNE4gj44GxqjnWSUyK85WwS7u20 m7Hy/xmBdZ3xeWbw+bUg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ryrhz-0000000DKcU-3cN0; Mon, 22 Apr 2024 11:19:39 +0000 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1ryrhv-0000000DKb0-1qVv for hostap@lists.infradead.org; Mon, 22 Apr 2024 11:19:36 +0000 Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 43MB158o006859 for ; Mon, 22 Apr 2024 11:19: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=KACKC0rfMG6JW00B+rAqrnVqv0+YFA16ZP3bbTd8z8o=; b=nD 6F8rvthGGHlqJqkg7ZkmCA5KvsF5lwy8+PJYRAPXQifmeRrodT4lpYfj4BFp/Dje DdipInUHZDIPZW3nYIXRznsJWlxd2kb6KpmOzvOXTUO4Uyr1TiAxMhnWTVn2udRV ztPRSH0xt5qeIrGFwv9GHDE6pIjSRYKWdna9LeFVdgCL2CskHjMQakhy5BMeXKXe fP3JIxHRC7mKNctdfXPezJBjcGwf1izP2H4Xbniz5NOw0liDcdam7dNxznDOQ5S8 edrfH32tUpEwMBamgA2VhHwB4RZyfyOfslmlfTIj/BP1T8SjIRyO3YH+PZem8gXP FIcEa+3roKQs+PVAf3RA== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3xnm1bgg5e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 22 Apr 2024 11:19:33 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 43MBJWfj005826 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 22 Apr 2024 11:19:32 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.1544.9; Mon, 22 Apr 2024 04:19:31 -0700 From: Aditya Kumar Singh To: CC: Harshitha Prem , Aditya Kumar Singh Subject: [PATCH 4/4] ACS: handle ACS scan start request failure with error code -EBUSY Date: Mon, 22 Apr 2024 16:49:06 +0530 Message-ID: <20240422111906.2928263-5-quic_adisi@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240422111906.2928263-1-quic_adisi@quicinc.com> References: <20240422111906.2928263-1-quic_adisi@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-GUID: Lm2LA9tVZe3qi__dnQwWKzmlbDtao-AL X-Proofpoint-ORIG-GUID: Lm2LA9tVZe3qi__dnQwWKzmlbDtao-AL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-22_09,2024-04-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 priorityscore=1501 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 mlxscore=0 phishscore=0 suspectscore=0 bulkscore=0 malwarescore=0 clxscore=1015 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2404010003 definitions=main-2404220050 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240422_041935_639576_24927047 X-CRM114-Status: GOOD ( 25.45 ) 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: Harshitha Prem Currently, if ACS scan request fails, states are cleared and returned. However, in case of multi link opertion, there is a possibilty of getting return value of -EBUSY. In this case, ACS can retry the [...] 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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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: Harshitha Prem Currently, if ACS scan request fails, states are cleared and returned. However, in case of multi link opertion, there is a possibilty of getting return value of -EBUSY. In this case, ACS can retry the scan request after some time same like HT-40 scan. Hence, add changes to retry the scan after 5 seconds if -EBUSY is returned. Max 15 re-attempts would be made post which no further attempts would be made. Signed-off-by: Harshitha Prem Co-developed-by: Aditya Kumar Singh Signed-off-by: Aditya Kumar Singh --- src/ap/acs.c | 62 +++++++++++++++++++++++++++++++++++++++--------- src/ap/acs.h | 3 +++ src/ap/hostapd.h | 1 + 3 files changed, 55 insertions(+), 11 deletions(-) diff --git a/src/ap/acs.c b/src/ap/acs.c index 28b0ba71cc7b..24804e8ec8b2 100644 --- a/src/ap/acs.c +++ b/src/ap/acs.c @@ -12,6 +12,7 @@ #include "utils/common.h" #include "utils/list.h" +#include "utils/eloop.h" #include "common/ieee802_11_defs.h" #include "common/hw_features_common.h" #include "common/wpa_ctrl.h" @@ -307,6 +308,7 @@ static const struct bw_item *bw_desc[] = { static int acs_request_scan(struct hostapd_iface *iface); static int acs_survey_is_sufficient(struct freq_survey *survey); +static void acs_scan_retry(void *eloop_data, void *user_data); static void acs_clean_chan_surveys(struct hostapd_channel_data *chan) @@ -352,6 +354,8 @@ void acs_cleanup(struct hostapd_iface *iface) iface->chans_surveyed = 0; iface->acs_num_completed_scans = 0; + iface->acs_num_retries = 0; + eloop_cancel_timeout(acs_scan_retry, iface, NULL); } @@ -1317,6 +1321,7 @@ static void acs_scan_complete(struct hostapd_iface *iface) int err; iface->scan_cb = NULL; + iface->acs_num_retries = 0; wpa_printf(MSG_DEBUG, "ACS: Using survey based algorithm (acs_num_scans=%d)", iface->conf->acs_num_scans); @@ -1329,7 +1334,7 @@ static void acs_scan_complete(struct hostapd_iface *iface) if (++iface->acs_num_completed_scans < iface->conf->acs_num_scans) { err = acs_request_scan(iface); - if (err) { + if (err && err != -EBUSY) { wpa_printf(MSG_ERROR, "ACS: Failed to request scan"); goto fail; } @@ -1378,11 +1383,10 @@ static int * acs_request_scan_add_freqs(struct hostapd_iface *iface, return freq; } - static int acs_request_scan(struct hostapd_iface *iface) { struct wpa_driver_scan_params params; - int i, *freq; + int i, *freq, ret; int num_channels; struct hostapd_hw_modes *mode; @@ -1415,24 +1419,60 @@ static int acs_request_scan(struct hostapd_iface *iface) return -1; } - iface->scan_cb = acs_scan_complete; - - wpa_printf(MSG_DEBUG, "ACS: Scanning %d / %d", - iface->acs_num_completed_scans + 1, - iface->conf->acs_num_scans); + if (!iface->acs_num_retries) + wpa_printf(MSG_DEBUG, "ACS: Scanning %d / %d", + iface->acs_num_completed_scans + 1, + iface->conf->acs_num_scans); + else + wpa_printf(MSG_DEBUG, "ACS: Re-try Scanning attempt %d (%d / %d)", + iface->acs_num_retries, + iface->acs_num_completed_scans + 1, + iface->conf->acs_num_scans); + + ret = hostapd_driver_scan(iface->bss[0], ¶ms); + os_free(params.freqs); - if (hostapd_driver_scan(iface->bss[0], ¶ms) < 0) { + if (ret == -EBUSY) { + iface->acs_num_retries++; + wpa_printf(MSG_ERROR, "Failed to request acs scan ret=%d (%s) - try to scan after %d seconds", + ret, strerror(-ret), ACS_SCAN_RETRY_INTERVAL); + eloop_cancel_timeout(acs_scan_retry, iface, NULL); + eloop_register_timeout(ACS_SCAN_RETRY_INTERVAL, 0, + acs_scan_retry, iface, NULL); + return 0; + } else if (ret < 0) { wpa_printf(MSG_ERROR, "ACS: Failed to request initial scan"); acs_cleanup(iface); - os_free(params.freqs); return -1; } - os_free(params.freqs); + iface->scan_cb = acs_scan_complete; + return 0; } +static void acs_scan_retry(void *eloop_data, void *user_data) +{ + struct hostapd_iface *iface = eloop_data; + int ret; + + if (iface->acs_num_retries >= ACS_SCAN_RETRY_MAX_COUNT) { + wpa_printf(MSG_ERROR, "ACS: Failed to request initial scan (all re-attempts failed)"); + goto acs_fail; + } + + ret = acs_request_scan(iface); + if (!ret) + return; + + wpa_printf(MSG_ERROR, "ACS: Failed to request re-try of initial scan"); + +acs_fail: + acs_fail(iface); +} + + enum hostapd_chan_status acs_init(struct hostapd_iface *iface) { int err; diff --git a/src/ap/acs.h b/src/ap/acs.h index ec84f0ee97f3..8be3de5b5f78 100644 --- a/src/ap/acs.h +++ b/src/ap/acs.h @@ -15,6 +15,9 @@ enum hostapd_chan_status acs_init(struct hostapd_iface *iface); void acs_cleanup(struct hostapd_iface *iface); +#define ACS_SCAN_RETRY_MAX_COUNT 15 +#define ACS_SCAN_RETRY_INTERVAL 5 + #else /* CONFIG_ACS */ static inline enum hostapd_chan_status acs_init(struct hostapd_iface *iface) diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h index 1d1943ac52ec..7454cdab179d 100644 --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h @@ -682,6 +682,7 @@ struct hostapd_iface { #ifdef CONFIG_ACS unsigned int acs_num_completed_scans; + unsigned int acs_num_retries; #endif /* CONFIG_ACS */ void (*scan_cb)(struct hostapd_iface *iface);