From patchwork Mon Nov 20 23:51:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866355 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=BZS+UNyh; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=iHL06ogo; 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 4SZ48Q1gfZz1ySN for ; Tue, 21 Nov 2023 10:53:26 +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=XC+JPumMzqgbBJpHapApMk/NrK9WljJm11KxWNKyv9o=; b=BZS+UNyhv4m+M+ 9C9p/h2K++eAcIvXLRDk5+BgRIKCdUcO4flPgIyFepDBn6xA5BK9tHXTynAHHSEz5NzWSx4+ZHA1g KsVvfIDRA65Cnk9SnEGgwo2UU0GHSTmihI+HPXggQCMoyzr/u/+XS3J/umK+hGtCPzaJwUO4W7d3b j1/g3MLY33j7R/hjvqGDC+dh+CSHOX7LXKWpBA7cCmb09noeL2/syisdTa8YQaFFAeDFWm/H3oqaV t1/LU+Hy7k4OmOzaUNTkuAquv54pTRJbuGVRCEGUE49gvVK+Rq5Z4yAskot7IqUCn2REXaN9xUFRI i9q8F2Y8ZLtjy1JfiQOQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E47-00F5Zh-17; Mon, 20 Nov 2023 23:52:31 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E43-00F5Yo-1v for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:52:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524347; x=1732060347; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Bo+DQgA2Yrb9Hx3j5yeWwFXmRMxSX2R3wO3rQ2Dd7dc=; b=iHL06ogoDPeAmrKc3y7uM8zAPEoTMJnqf1ATaDiprrPPbh6JiRR1/x2+ tXIBHNkewhb/wsYKLbPg8OL5eT2+Y+lnZXlMZJx/AEBXmbFFvvb073wOs 90FK9K0YeWd8oVGJStOyQfodQWAZ+VDU183EPIMvZQ93CsqKtH80EG+Hz 8Wi2MXWViiQShSs0Bx+iS3SLrERbuK2jYum3o+n44R3y8XGlS2leeDaC1 8MyDjWcecpS/IwptiBwwyrr7KIXmrjjUrcGnyWDNYiBVfcAQkptYN3aub 98fVNKYDOIWzAsTbKzPwALNd+RRg5ZFAfi7WCQH1NlhwZvBgmAySwH/Mg Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769723" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769723" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871307" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871307" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:25 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Benjamin Berg Subject: [PATCH 01/42] nl80211: Do a roundtrip to reset event supressions Date: Tue, 21 Nov 2023 01:51:15 +0200 Message-Id: <20231120235156.363852-2-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155228_425382_AB6BBD1D X-CRM114-Status: GOOD ( 24.02 ) X-Spam-Score: -0.4 (/) 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: Benjamin Berg With nl80211 we need to supress the kernel generated event for any disconnect and deauthenticate. This code is a bit fragile, as it assumes that an event will happen. Commit b898b655824a ("nl80211: Do [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Benjamin Berg With nl80211 we need to supress the kernel generated event for any disconnect and deauthenticate. This code is a bit fragile, as it assumes that an event will happen. Commit b898b655824a ("nl80211: Do not ignore disconnect event in case of !drv->associated") changed this to only disconnect when the driver knows it is associated (apparently required for P2P), however, deauthentication may also occur without being associated yet. Looking at the issue, what we are really interested in is whether the event belongs to a disconnect/deauth command that we have send ourselves. Any event happening after the disconnect/deauth completes should not be suppressed (or after the next connect/auth as that would be sufficient). We therefore need to know from the event stream whether events were generated before or after disconnect/deauth command completion. To do so, send a simple command on the nl_event socket. As this will be returned back to us in the correct order with regard to the events. We can therefore use it to safely reset our internal ignore_next_local_{deauth,disconnect} variables. Signed-off-by: Benjamin Berg --- src/drivers/driver_nl80211.c | 47 ++++++++++++++++++++++++++---- src/drivers/driver_nl80211.h | 5 ++-- src/drivers/driver_nl80211_event.c | 23 +++++++++++++++ 3 files changed, 67 insertions(+), 8 deletions(-) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index ac63e64054..229c78a6d2 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -405,6 +405,41 @@ static void nl80211_nlmsg_clear(struct nl_msg *msg) } +static int send_event_marker(struct wpa_driver_nl80211_data *drv) +{ + struct nl_sock *handle; + struct nl_msg *msg; + struct nlmsghdr *hdr; + int res = 0; + int err = -NLE_NOMEM; + + msg = nlmsg_alloc(); + if (!msg) + goto out; + + /* We only care about the returned sequence number for matching. */ + if (!nl80211_cmd(drv, msg, 0, NL80211_CMD_GET_PROTOCOL_FEATURES)) + goto out; + + handle = (void *) (((intptr_t) drv->global->nl_event) ^ + ELOOP_SOCKET_INVALID); + + err = nl_send_auto_complete(handle, msg); + if (err < 0) + goto out; + + hdr = nlmsg_hdr(msg); + res = hdr->nlmsg_seq; + +out: + nlmsg_free(msg); + if (err) + wpa_printf(MSG_INFO, "nl80211: %s failed: %s", + __func__, nl_geterror(err)); + return res; +} + + static int send_and_recv(struct nl80211_global *global, struct nl_sock *nl_handle, struct nl_msg *msg, int (*valid_handler)(struct nl_msg *, void *), @@ -3736,7 +3771,6 @@ static int wpa_driver_nl80211_disconnect(struct wpa_driver_nl80211_data *drv, struct i802_bss *bss) { int ret; - int drv_associated = drv->associated; wpa_printf(MSG_DEBUG, "%s(reason_code=%d)", __func__, reason_code); nl80211_mark_disconnected(drv); @@ -3747,7 +3781,8 @@ static int wpa_driver_nl80211_disconnect(struct wpa_driver_nl80211_data *drv, * For locally generated disconnect, supplicant already generates a * DEAUTH event, so ignore the event from NL80211. */ - drv->ignore_next_local_disconnect = drv_associated && (ret == 0); + if (ret == 0) + drv->ignore_next_local_disconnect = send_event_marker(drv); return ret; } @@ -3758,7 +3793,6 @@ static int wpa_driver_nl80211_deauthenticate(struct i802_bss *bss, { struct wpa_driver_nl80211_data *drv = bss->drv; int ret; - int drv_associated = drv->associated; if (drv->nlmode == NL80211_IFTYPE_ADHOC) { nl80211_mark_disconnected(drv); @@ -3776,7 +3810,8 @@ static int wpa_driver_nl80211_deauthenticate(struct i802_bss *bss, * For locally generated deauthenticate, supplicant already generates a * DEAUTH event, so ignore the event from NL80211. */ - drv->ignore_next_local_deauth = drv_associated && (ret == 0); + if (ret == 0) + drv->ignore_next_local_deauth = send_event_marker(drv); return ret; } @@ -10811,9 +10846,9 @@ static int wpa_driver_nl80211_status(void *priv, char *buf, size_t buflen) drv->retry_auth ? "retry_auth=1\n" : "", drv->use_monitor ? "use_monitor=1\n" : "", drv->ignore_next_local_disconnect ? - "ignore_next_local_disconnect=1\n" : "", + "ignore_next_local_disconnect\n" : "", drv->ignore_next_local_deauth ? - "ignore_next_local_deauth=1\n" : ""); + "ignore_next_local_deauth\n" : ""); if (os_snprintf_error(end - pos, res)) return pos - buf; pos += res; diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h index aee8c45124..d419739936 100644 --- a/src/drivers/driver_nl80211.h +++ b/src/drivers/driver_nl80211.h @@ -165,8 +165,6 @@ struct wpa_driver_nl80211_data { unsigned int scan_for_auth:1; unsigned int retry_auth:1; unsigned int use_monitor:1; - unsigned int ignore_next_local_disconnect:1; - unsigned int ignore_next_local_deauth:1; unsigned int hostapd:1; unsigned int start_mode_sta:1; unsigned int start_iface_up:1; @@ -203,6 +201,9 @@ struct wpa_driver_nl80211_data { unsigned int puncturing:1; unsigned int qca_ap_allowed_freqs:1; + u32 ignore_next_local_disconnect; + u32 ignore_next_local_deauth; + u64 vendor_scan_cookie; u64 remain_on_chan_cookie; u64 send_frame_cookie; diff --git a/src/drivers/driver_nl80211_event.c b/src/drivers/driver_nl80211_event.c index 0091032e55..cf10abd97d 100644 --- a/src/drivers/driver_nl80211_event.c +++ b/src/drivers/driver_nl80211_event.c @@ -4060,6 +4060,29 @@ int process_global_event(struct nl_msg *msg, void *arg) int wdev_id_set = 0; int wiphy_idx_set = 0; + /* event marker, all prior events have been processed */ + if (gnlh->cmd == NL80211_CMD_GET_PROTOCOL_FEATURES) { + struct wpa_driver_nl80211_data *drv, *tmp; + u32 seq = nlmsg_hdr(msg)->nlmsg_seq; + + dl_list_for_each_safe(drv, tmp, &global->interfaces, + struct wpa_driver_nl80211_data, list) { + if (drv->ignore_next_local_deauth > 0 && + drv->ignore_next_local_deauth <= seq) { + wpa_printf(MSG_INFO, "nl80211: No DEAUTHENTICATE event was ignored"); + drv->ignore_next_local_deauth = 0; + } + + if (drv->ignore_next_local_disconnect > 0 && + drv->ignore_next_local_disconnect <= seq) { + wpa_printf(MSG_INFO, "nl80211: No DISCONNECT event was ignored"); + drv->ignore_next_local_disconnect = 0; + } + } + + return NL_SKIP; + } + nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0), genlmsg_attrlen(gnlh, 0), NULL); From patchwork Mon Nov 20 23:51:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866353 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=ITysghjS; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=OPH9mDYD; 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 4SZ48P6FdZz1ySS for ; Tue, 21 Nov 2023 10:53:25 +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=Tc4KtNUtn/CVhxY8xVf9pSyXxU8QgfOgUpPalpMptV4=; b=ITysghjSpsHi1k IVyD/wnkmS6baJdoWsbZHUDx7ZszOOJnRLzBw+h3Mg4NDgqGCUBDHScOrtRRmjz7tcJbRLmm/kXrp 5kGB1siQeVbG5yHp0LZ4njSuEroA7MjZTM3PMFKh2P9YQp6JzNDFP+MDyWHYoEaEWZ95AMkGGyn0j Z+0lDOpMNRJ9SBKc+kJX/8fIUzzeIR9MS1DEui7Jon19gJGvASW5OOA2RaljIMaKcTkuErZrp+o7s /k2vLLFXHtv4z0lbXgs84t8wLPi8UJk8Y/GH4vkwEyFqtfl66dkrFt0pIXzGIun/Ur762Af4n3DHq sO26iEDIyhCXNz0m99hw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E49-00F5aG-1V; Mon, 20 Nov 2023 23:52:33 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E45-00F5Z9-2r for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:52:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524349; x=1732060349; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=iKAuV5aQ6O+lX4OoHhbQH7hdpWAdfYos4ZB6ZkssMR0=; b=OPH9mDYDQbvNBpIPhqNAkEGllD6mtGEkCkpDDgr7n+nWVX14WO6WqZtx mEaUuidX1+F7gakMK/VcDsE+pGpJlFU5xHVTgg2Lzc7Uk4qNOwqKs2/ot gL8jEilQZT33KXapJDKvJrlhAsESj+tjGZSY8Xy3TvHXAj8gjlFYGSbZJ zoSJyz72f6gJRBW+6N0hkbu/Nt+kg/nhu1T6/OCsAyqS0qBBomLR2Ob22 TGcwagtszj4SXQ3zoFmOLSS/Vw/dfQFthvQMloIzvNbNzNqBr67zXf+o9 bQCYs3fD9aXPvUF74QQ/0ZqYSuxdiNDkRTmV9S2kYx6QV6fVkyr+AR/7/ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769726" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769726" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871313" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871313" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:26 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Benjamin Berg Subject: [PATCH 02/42] sme: Drop old disassoc_while_authenticating workaround Date: Tue, 21 Nov 2023 01:51:16 +0200 Message-Id: <20231120235156.363852-3-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155230_001515_36BCC7C6 X-CRM114-Status: GOOD ( 15.60 ) X-Spam-Score: -0.4 (/) 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: Benjamin Berg This workaround pre-dates the code that supresses the deauth or disconnect event from nl80211. Should this code be called it would not actually work at this point, as important internal state for the [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Benjamin Berg This workaround pre-dates the code that supresses the deauth or disconnect event from nl80211. Should this code be called it would not actually work at this point, as important internal state for the authentication attempt has already been lost. Simply drop the code. This might also fix issues where we could get into a bad state if a proper deauth/disconnect event happens while we are authenticating or associating. Signed-off-by: Benjamin Berg --- wpa_supplicant/events.c | 9 --------- wpa_supplicant/sme.c | 22 ---------------------- wpa_supplicant/sme.h | 8 -------- 3 files changed, 39 deletions(-) diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 0e5b6c6a86..1ee6eb82ed 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -4133,14 +4133,11 @@ static void wpa_supplicant_event_disassoc_finish(struct wpa_supplicant *wpa_s, int locally_generated) { const u8 *bssid; - int authenticating; u8 prev_pending_bssid[ETH_ALEN]; struct wpa_bss *fast_reconnect = NULL; struct wpa_ssid *fast_reconnect_ssid = NULL; - struct wpa_ssid *last_ssid; struct wpa_bss *curr = NULL; - authenticating = wpa_s->wpa_state == WPA_AUTHENTICATING; os_memcpy(prev_pending_bssid, wpa_s->pending_bssid, ETH_ALEN); if (wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE) { @@ -4236,17 +4233,11 @@ static void wpa_supplicant_event_disassoc_finish(struct wpa_supplicant *wpa_s, wpa_dbg(wpa_s, MSG_DEBUG, "Disconnect event - remove keys"); wpa_clear_keys(wpa_s, wpa_s->bssid); } - last_ssid = wpa_s->current_ssid; wpa_supplicant_mark_disassoc(wpa_s); if (curr) wpa_bss_remove(wpa_s, curr, "Connection to AP lost"); - if (authenticating && (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME)) { - sme_disassoc_while_authenticating(wpa_s, prev_pending_bssid); - wpa_s->current_ssid = last_ssid; - } - if (fast_reconnect && !wpas_network_disabled(wpa_s, fast_reconnect_ssid) && !disallowed_bssid(wpa_s, fast_reconnect->bssid) && diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index 5faa038690..8c81824f09 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -2888,28 +2888,6 @@ void sme_state_changed(struct wpa_supplicant *wpa_s) } -void sme_disassoc_while_authenticating(struct wpa_supplicant *wpa_s, - const u8 *prev_pending_bssid) -{ - /* - * mac80211-workaround to force deauth on failed auth cmd, - * requires us to remain in authenticating state to allow the - * second authentication attempt to be continued properly. - */ - wpa_dbg(wpa_s, MSG_DEBUG, "SME: Allow pending authentication " - "to proceed after disconnection event"); - wpa_supplicant_set_state(wpa_s, WPA_AUTHENTICATING); - os_memcpy(wpa_s->pending_bssid, prev_pending_bssid, ETH_ALEN); - - /* - * Re-arm authentication timer in case auth fails for whatever reason. - */ - eloop_cancel_timeout(sme_auth_timer, wpa_s, NULL); - eloop_register_timeout(SME_AUTH_TIMEOUT, 0, sme_auth_timer, wpa_s, - NULL); -} - - void sme_clear_on_disassoc(struct wpa_supplicant *wpa_s) { wpa_s->sme.prev_bssid_set = 0; diff --git a/wpa_supplicant/sme.h b/wpa_supplicant/sme.h index c797d2e9e7..50524d1318 100644 --- a/wpa_supplicant/sme.h +++ b/wpa_supplicant/sme.h @@ -32,8 +32,6 @@ void sme_event_ch_switch(struct wpa_supplicant *wpa_s); void sme_sa_query_rx(struct wpa_supplicant *wpa_s, const u8 *da, const u8 *sa, const u8 *data, size_t len); void sme_state_changed(struct wpa_supplicant *wpa_s); -void sme_disassoc_while_authenticating(struct wpa_supplicant *wpa_s, - const u8 *prev_pending_bssid); void sme_clear_on_disassoc(struct wpa_supplicant *wpa_s); void sme_deinit(struct wpa_supplicant *wpa_s); @@ -98,12 +96,6 @@ static inline void sme_state_changed(struct wpa_supplicant *wpa_s) { } -static inline void -sme_disassoc_while_authenticating(struct wpa_supplicant *wpa_s, - const u8 *prev_pending_bssid) -{ -} - static inline void sme_clear_on_disassoc(struct wpa_supplicant *wpa_s) { } From patchwork Mon Nov 20 23:51:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866363 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=vDLNilS6; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=WL+LeugM; 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 4SZ48T2NfHz1ySS for ; Tue, 21 Nov 2023 10:53:29 +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=ZpmL9c+ic1Ezg2Jf2Q8VZZP4YTWaY+Lk5lq191DXgyw=; b=vDLNilS651ck1M tp61pLJpem8/IscJUjkAJESk+8tvsrA77Lp3SAZ4hLvIhR7JOLIjpd4WcRwpbstwT/Ah5Y6GEEsaS SjgzWGgmKJzAoFsFiTGdZrM4iPD7erMqcMYUQu2B6UvaGgxnVCQ9BLTilYqbix7etKohjqNrTk0kW ffvX9oivEQIF1ljJ45wHyBvcBblrIfnkeosr170GtQB/k8PUP/Oa9fk+t8vzhgL3zJs5Hnui2YCYy V6YsVMr1oFYEV0oB/EvXiPfzABLUZDrtrCtPjk+kJAlT1Eyy2Jj1IfQqucoW4EtClNt+2kRWBJMV1 47YbTuWt+lbVJFOZer8g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4A-00F5ae-2j; Mon, 20 Nov 2023 23:52:34 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E46-00F5Yo-0P for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:52:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524350; x=1732060350; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2UmGt738XsbjurnO55a4M5PjTcrVaaXzm6Hj+t8OlBI=; b=WL+LeugMq69Sy10lsbDGxOygdlGy4CJrmPifHs0Y9TckhpAj79TxVF8Y o9b7X72mVN0OGRUwhLcqNeWjYq0zAmV0Aozxu8n0PtMz07DyAhITZDYsr v46kudjbmNFyFD1Pr/0LLDUMi7Yf748hNBhZrkqfBvTrLgb0Y9g97bNUE MUtea7O3WrJVdIvpwIjSJXmFSdjrKrOk+NSx7/cvrFR+CRvR/uDYp3/nz HUGYtFTgFG9Hqx84UtTVmdfFj6i//N1p8eHQn/wvHYf3vt3jG6W2w/NjY t00wFIY8C/glYJOEJMcXfkZnoCCcBRmH54IOwT84pvwq2kJGQjd1LRERU w==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769729" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769729" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871322" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871322" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:28 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Johannes Berg , Andrei Otcheretianski Subject: [PATCH 03/42] ieee802_11_defs: Fix EHT_ML_PRES_BM_PROBE_REQ_AP_MLD_ID Date: Tue, 21 Nov 2023 01:51:17 +0200 Message-Id: <20231120235156.363852-4-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155230_224490_52D77F0B X-CRM114-Status: GOOD ( 10.98 ) X-Spam-Score: -0.4 (/) 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: Johannes Berg Signed-off-by: Johannes Berg Signed-off-by: Andrei Otcheretianski --- src/common/ieee802_11_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Johannes Berg Signed-off-by: Johannes Berg Signed-off-by: Andrei Otcheretianski --- src/common/ieee802_11_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h index 8cdf76bd48..3c08ef19cf 100644 --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h @@ -2700,7 +2700,7 @@ struct ieee80211_eht_per_sta_profile { /* IEEE P802.11be/D2.0, 9.4.2.312.3 - Probe Request Multi-Link element */ -#define EHT_ML_PRES_BM_PROBE_REQ_AP_MLD_ID 0x0001 +#define EHT_ML_PRES_BM_PROBE_REQ_AP_MLD_ID 0x0010 struct eht_ml_probe_req_common_info { u8 len; From patchwork Mon Nov 20 23:51:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866357 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=xe7l1qan; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=bBY8DDSf; 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 4SZ48P6JS3z1ySV for ; Tue, 21 Nov 2023 10:53: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=iGdjPZqliZlZ0H5yhuQR1ObK5lCD9XKBcks6oKyXcM0=; b=xe7l1qanEXzvcy iB7FoIUO7y7rNaxWaLK2kyhpNebv74V2c2hpkHKAaKQZSYXob8mxbEfA1wL/smsgC6tyZn3po56UA ZQ203MqBDIQmgMZ63zY8nysnexfoeUYerUAFI+6+ZLyG2QoXjJ+lOuK4JsahL50UQXv68r/W5t/JL CR2oGWlEcsf9egixW3kwup2JZchVAJimUqWzfWBhi/0zikq1XhDe4yr2A3ZsiZJ9HZL23CpDLd6lV H0Qs3LMGfvFZlt+nII05sR37kzGqc/1K7n7oFap1OKHN/PUQDXLYsQehfcjSFSDb7roh0ow2fMFsl Pd/EWB0/ZH9/6V4a5kDQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4D-00F5ce-11; Mon, 20 Nov 2023 23:52:37 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E48-00F5Zj-1u for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:52:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524352; x=1732060352; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LcxZEi9lph6RQRXvHOg9d+Cf25cD0T+KgPG0ss21s4A=; b=bBY8DDSfnKqcluJQ/3u1iRL7NbNeW16B3bLIeUtMrNQwIf8VQBUzgqUh rkFbHAga0DssLaIMrQK/ksgyVbmrwARvjW2MVRcYxwN8dz3NW+kpr5NKD EbFpChOyFmFgZoyB1czRwkgyQXzdDV5iGsefhBJhmOcusvgW7lO+YDhV4 M+CvpuXo3seksxS+U7i6iH89YRqpLGvV+GwzN/QEFt9hVMvc9bKrGsIML qPUPgOYVyoybHtEsCcS20yVDD+YllHYqjF3BmGbK22f263PadHuuWhdRY +vkI+AMo6EcreS0oB5XUsWazxkQVo1s9TswG7sA3Z+ofAml0KaRjRjj2b A==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769734" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769734" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871330" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871330" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:29 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Benjamin Berg , Andrei Otcheretianski Subject: [PATCH 04/42] common: Simplify and avoid confusing defragmentation API Date: Tue, 21 Nov 2023 01:51:18 +0200 Message-Id: <20231120235156.363852-5-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155232_713310_7065CC4C X-CRM114-Status: GOOD ( 20.11 ) X-Spam-Score: -0.4 (/) 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: Benjamin Berg Three functions were provided for defragmentation. First ieee802_11_defrag, ieee802_11_defrag_mle and then ieee802_11_defrag_data which would do the actual job. With ieee802_11_defrag picking the memb [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Benjamin Berg Three functions were provided for defragmentation. First ieee802_11_defrag, ieee802_11_defrag_mle and then ieee802_11_defrag_data which would do the actual job. With ieee802_11_defrag picking the member in the elements struct for an EID. The problem with this is, that for the multi-link element, there are multiple entries in the elems struct depending on its type. As such, remove the intermediate function and simply pass the correct members directly. Signed-off-by: Benjamin Berg Signed-off-by: Andrei Otcheretianski --- src/ap/drv_callbacks.c | 2 +- src/ap/ieee802_11.c | 10 ++-- src/ap/ieee802_11_eht.c | 3 +- src/common/ieee802_11_common.c | 78 +----------------------------- src/common/ieee802_11_common.h | 6 +-- src/common/wpa_common.c | 4 +- src/drivers/driver_nl80211_event.c | 4 +- src/pasn/pasn_initiator.c | 10 ++-- src/pasn/pasn_responder.c | 11 ++--- wlantest/rx_mgmt.c | 2 +- wpa_supplicant/bss.c | 22 +-------- wpa_supplicant/bss.h | 1 - wpa_supplicant/sme.c | 7 ++- 13 files changed, 33 insertions(+), 127 deletions(-) diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c index e58cb9f527..4075e27ffe 100644 --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c @@ -158,7 +158,7 @@ static int hostapd_update_sta_links_status(struct hostapd_data *hapd, return -1; } - mlebuf = ieee802_11_defrag_mle(&elems, MULTI_LINK_CONTROL_TYPE_BASIC); + mlebuf = ieee802_11_defrag(elems.basic_mle, elems.basic_mle_len, true); if (!mlebuf) { wpa_printf(MSG_ERROR, "MLO: Basic Multi-Link element not found in (Re)Association Response frame"); diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index 1f39107d8e..30edc5bfc3 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -2520,8 +2520,8 @@ static int pasn_wd_handle_fils(struct hostapd_data *hapd, struct sta_info *sta, FILS_SESSION_LEN); os_memcpy(fils->session, elems.fils_session, FILS_SESSION_LEN); - fils_wd = ieee802_11_defrag(&elems, WLAN_EID_EXTENSION, - WLAN_EID_EXT_WRAPPED_DATA); + fils_wd = ieee802_11_defrag(elems.wrapped_data, elems.wrapped_data_len, + true); if (!fils_wd) { wpa_printf(MSG_DEBUG, "PASN: FILS: Missing wrapped data"); @@ -2690,8 +2690,8 @@ static void hapd_pasn_update_params(struct hostapd_data *hapd, return; } if (pasn_params.wrapped_data_format != WPA_PASN_WRAPPED_DATA_NO) { - wrapped_data = ieee802_11_defrag(&elems, WLAN_EID_EXTENSION, - WLAN_EID_EXT_WRAPPED_DATA); + wrapped_data = ieee802_11_defrag(elems.wrapped_data, + elems.wrapped_data_len, true); if (!wrapped_data) { wpa_printf(MSG_DEBUG, "PASN: Missing wrapped data"); return; @@ -4401,7 +4401,7 @@ static void ieee80211_ml_process_link(struct hostapd_data *hapd, goto out; } - mlbuf = ieee802_11_defrag_mle(&elems, MULTI_LINK_CONTROL_TYPE_BASIC); + mlbuf = ieee802_11_defrag(elems.basic_mle, elems.basic_mle_len, true); if (!mlbuf) goto out; diff --git a/src/ap/ieee802_11_eht.c b/src/ap/ieee802_11_eht.c index 1d17518378..94a9b58b08 100644 --- a/src/ap/ieee802_11_eht.c +++ b/src/ap/ieee802_11_eht.c @@ -908,7 +908,8 @@ u16 hostapd_process_ml_assoc_req(struct hostapd_data *hapd, int ret = -1; u16 ml_control; - mlbuf = ieee802_11_defrag_mle(elems, MULTI_LINK_CONTROL_TYPE_BASIC); + mlbuf = ieee802_11_defrag(elems->basic_mle, + elems->basic_mle_len, true); if (!mlbuf) return WLAN_STATUS_SUCCESS; diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c index 70d56ffbf2..37a300ea48 100644 --- a/src/common/ieee802_11_common.c +++ b/src/common/ieee802_11_common.c @@ -3201,8 +3201,7 @@ enum oper_chan_width op_class_to_ch_width(u8 op_class) } -struct wpabuf * ieee802_11_defrag_data(const u8 *data, size_t len, - bool ext_elem) +struct wpabuf * ieee802_11_defrag(const u8 *data, size_t len, bool ext_elem) { struct wpabuf *buf; const u8 *pos, *end = data + len; @@ -3242,44 +3241,6 @@ struct wpabuf * ieee802_11_defrag_data(const u8 *data, size_t len, } -struct wpabuf * ieee802_11_defrag(struct ieee802_11_elems *elems, - u8 eid, u8 eid_ext) -{ - const u8 *data; - size_t len; - - /* - * TODO: Defragmentation mechanism can be supported for all IEs. For now - * handle only those that are used (or use ieee802_11_defrag_data()). - */ - switch (eid) { - case WLAN_EID_EXTENSION: - switch (eid_ext) { - case WLAN_EID_EXT_FILS_HLP_CONTAINER: - data = elems->fils_hlp; - len = elems->fils_hlp_len; - break; - case WLAN_EID_EXT_WRAPPED_DATA: - data = elems->wrapped_data; - len = elems->wrapped_data_len; - break; - default: - wpa_printf(MSG_DEBUG, - "Defragmentation not supported. eid_ext=%u", - eid_ext); - return NULL; - } - break; - default: - wpa_printf(MSG_DEBUG, - "Defragmentation not supported. eid=%u", eid); - return NULL; - } - - return ieee802_11_defrag_data(data, len, true); -} - - const u8 * get_ml_ie(const u8 *ies, size_t len, u8 type) { const struct element *elem; @@ -3314,40 +3275,3 @@ const u8 * get_basic_mle_mld_addr(const u8 *buf, size_t len) return &buf[mld_addr_pos]; } - - -struct wpabuf * ieee802_11_defrag_mle(struct ieee802_11_elems *elems, u8 type) -{ - const u8 *data; - size_t len; - - switch (type) { - case MULTI_LINK_CONTROL_TYPE_BASIC: - data = elems->basic_mle; - len = elems->basic_mle_len; - break; - case MULTI_LINK_CONTROL_TYPE_PROBE_REQ: - data = elems->probe_req_mle; - len = elems->probe_req_mle_len; - break; - case MULTI_LINK_CONTROL_TYPE_RECONF: - data = elems->reconf_mle; - len = elems->reconf_mle_len; - break; - case MULTI_LINK_CONTROL_TYPE_TDLS: - data = elems->tdls_mle; - len = elems->tdls_mle_len; - break; - case MULTI_LINK_CONTROL_TYPE_PRIOR_ACCESS: - data = elems->prior_access_mle; - len = elems->prior_access_mle_len; - break; - default: - wpa_printf(MSG_DEBUG, - "Defragmentation not supported for Multi-Link element type=%u", - type); - return NULL; - } - - return ieee802_11_defrag_data(data, len, true); -} diff --git a/src/common/ieee802_11_common.h b/src/common/ieee802_11_common.h index 00dc2fb108..a8a2118b1f 100644 --- a/src/common/ieee802_11_common.h +++ b/src/common/ieee802_11_common.h @@ -350,11 +350,7 @@ void hostapd_encode_edmg_chan(int edmg_enable, u8 edmg_channel, int ieee802_edmg_is_allowed(struct ieee80211_edmg_config allowed, struct ieee80211_edmg_config requested); -struct wpabuf * ieee802_11_defrag_data(const u8 *data, size_t len, - bool ext_elem); -struct wpabuf * ieee802_11_defrag(struct ieee802_11_elems *elems, - u8 eid, u8 eid_ext); -struct wpabuf * ieee802_11_defrag_mle(struct ieee802_11_elems *elems, u8 type); +struct wpabuf * ieee802_11_defrag(const u8 *data, size_t len, bool ext_elem); const u8 * get_ml_ie(const u8 *ies, size_t len, u8 type); const u8 * get_basic_mle_mld_addr(const u8 *buf, size_t len); diff --git a/src/common/wpa_common.c b/src/common/wpa_common.c index d897e0eca6..fa4a803966 100644 --- a/src/common/wpa_common.c +++ b/src/common/wpa_common.c @@ -1329,8 +1329,8 @@ int wpa_ft_parse_ies(const u8 *ies, size_t ies_len, struct wpa_ft_ies *parse, if (fte_len < 255) { res = wpa_ft_parse_fte(key_mgmt, fte, fte_len, parse); } else { - parse->fte_buf = ieee802_11_defrag_data(fte, fte_len, - false); + parse->fte_buf = ieee802_11_defrag(fte, fte_len, + false); if (!parse->fte_buf) goto fail; res = wpa_ft_parse_fte(key_mgmt, diff --git a/src/drivers/driver_nl80211_event.c b/src/drivers/driver_nl80211_event.c index cf10abd97d..3ff597d6e2 100644 --- a/src/drivers/driver_nl80211_event.c +++ b/src/drivers/driver_nl80211_event.c @@ -660,7 +660,7 @@ static int nl80211_update_rejected_links_info(struct driver_sta_mlo_info *mlo, return -1; } - mle = ieee802_11_defrag_mle(&req_elems, MULTI_LINK_CONTROL_TYPE_BASIC); + mle = ieee802_11_defrag(req_elems.basic_mle, req_elems.basic_mle_len, true); if (!mle) { wpa_printf(MSG_INFO, "nl80211: MLO: Basic Multi-Link element not found in Association Request"); @@ -671,7 +671,7 @@ static int nl80211_update_rejected_links_info(struct driver_sta_mlo_info *mlo, &req_info); wpabuf_free(mle); - mle = ieee802_11_defrag_mle(&resp_elems, MULTI_LINK_CONTROL_TYPE_BASIC); + mle = ieee802_11_defrag(resp_elems.basic_mle, resp_elems.basic_mle_len, true); if (!mle) { wpa_printf(MSG_ERROR, "nl80211: MLO: Basic Multi-Link element not found in Association Response"); diff --git a/src/pasn/pasn_initiator.c b/src/pasn/pasn_initiator.c index 1f9a508300..5d73f81951 100644 --- a/src/pasn/pasn_initiator.c +++ b/src/pasn/pasn_initiator.c @@ -378,8 +378,8 @@ static int wpas_pasn_wd_fils_rx(struct pasn_data *pasn, struct wpabuf *wd) return -1; } - fils_wd = ieee802_11_defrag(&elems, WLAN_EID_EXTENSION, - WLAN_EID_EXT_WRAPPED_DATA); + fils_wd = ieee802_11_defrag(elems.wrapped_data, elems.wrapped_data_len, + true); if (!fils_wd) { wpa_printf(MSG_DEBUG, @@ -1200,9 +1200,9 @@ int wpa_pasn_auth_rx(struct pasn_data *pasn, const u8 *data, size_t len, } if (pasn_params->wrapped_data_format != WPA_PASN_WRAPPED_DATA_NO) { - wrapped_data = ieee802_11_defrag(&elems, - WLAN_EID_EXTENSION, - WLAN_EID_EXT_WRAPPED_DATA); + wrapped_data = ieee802_11_defrag(elems.wrapped_data, + elems.wrapped_data_len, + true); if (!wrapped_data) { wpa_printf(MSG_DEBUG, "PASN: Missing wrapped data"); diff --git a/src/pasn/pasn_responder.c b/src/pasn/pasn_responder.c index 47be403245..7501e7a56a 100644 --- a/src/pasn/pasn_responder.c +++ b/src/pasn/pasn_responder.c @@ -753,9 +753,8 @@ int handle_auth_pasn_1(struct pasn_data *pasn, derive_keys = true; if (pasn_params.wrapped_data_format != WPA_PASN_WRAPPED_DATA_NO) { - wrapped_data = ieee802_11_defrag(&elems, - WLAN_EID_EXTENSION, - WLAN_EID_EXT_WRAPPED_DATA); + wrapped_data = ieee802_11_defrag(elems.wrapped_data, + elems.wrapped_data_len, true); if (!wrapped_data) { wpa_printf(MSG_DEBUG, "PASN: Missing wrapped data"); status = WLAN_STATUS_UNSPECIFIED_FAILURE; @@ -979,9 +978,9 @@ int handle_auth_pasn_3(struct pasn_data *pasn, const u8 *own_addr, } if (pasn_params.wrapped_data_format != WPA_PASN_WRAPPED_DATA_NO) { - wrapped_data = ieee802_11_defrag(&elems, - WLAN_EID_EXTENSION, - WLAN_EID_EXT_WRAPPED_DATA); + wrapped_data = ieee802_11_defrag(elems.wrapped_data, + elems.wrapped_data_len, + true); if (!wrapped_data) { wpa_printf(MSG_DEBUG, "PASN: Missing wrapped data"); diff --git a/wlantest/rx_mgmt.c b/wlantest/rx_mgmt.c index 5d1233b643..c6bf65ddf3 100644 --- a/wlantest/rx_mgmt.c +++ b/wlantest/rx_mgmt.c @@ -390,7 +390,7 @@ static void parse_basic_ml_elems(struct ieee802_11_elems *elems, bool ap, { struct wpabuf *mlbuf; - mlbuf = ieee802_11_defrag_mle(elems, MULTI_LINK_CONTROL_TYPE_BASIC); + mlbuf = ieee802_11_defrag(elems->basic_mle, elems->basic_mle_len, true); if (mlbuf) { parse_basic_ml(wpabuf_head(mlbuf), wpabuf_len(mlbuf), ap, sta, fields_len); diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c index c1be660415..b85a9ad177 100644 --- a/wpa_supplicant/bss.c +++ b/wpa_supplicant/bss.c @@ -1496,24 +1496,6 @@ int wpa_bss_ext_capab(const struct wpa_bss *bss, unsigned int capab) } -/** - * wpa_bss_defrag_mle - Get a buffer holding a de-fragmented ML element - * @bss: BSS table entry - * @type: ML control type - */ -struct wpabuf * wpa_bss_defrag_mle(const struct wpa_bss *bss, u8 type) -{ - struct ieee802_11_elems elems; - const u8 *pos = wpa_bss_ie_ptr(bss); - size_t len = bss->ie_len; - - if (ieee802_11_parse_elems(pos, len, &elems, 1) == ParseFailed) - return NULL; - - return ieee802_11_defrag_mle(&elems, type); -} - - static void wpa_bss_parse_ml_rnr_ap_info(struct wpa_supplicant *wpa_s, struct wpa_bss *bss, u8 mbssid_idx, @@ -1633,7 +1615,7 @@ int wpa_bss_parse_basic_ml_element(struct wpa_supplicant *wpa_s, return ret; } - mlbuf = ieee802_11_defrag_mle(&elems, MULTI_LINK_CONTROL_TYPE_BASIC); + mlbuf = ieee802_11_defrag(elems.basic_mle, elems.basic_mle_len, true); if (!mlbuf) { wpa_dbg(wpa_s, MSG_DEBUG, "MLD: No Multi-Link element"); return ret; @@ -1769,7 +1751,7 @@ u16 wpa_bss_parse_reconf_ml_element(struct wpa_supplicant *wpa_s, if (!elems.reconf_mle || !elems.reconf_mle_len) return 0; - mlbuf = ieee802_11_defrag_mle(&elems, MULTI_LINK_CONTROL_TYPE_RECONF); + mlbuf = ieee802_11_defrag(elems.reconf_mle, elems.reconf_mle_len, true); if (!mlbuf) return 0; diff --git a/wpa_supplicant/bss.h b/wpa_supplicant/bss.h index 042b5d2645..7b0b24c616 100644 --- a/wpa_supplicant/bss.h +++ b/wpa_supplicant/bss.h @@ -213,7 +213,6 @@ void calculate_update_time(const struct os_reltime *fetch_time, unsigned int age_ms, struct os_reltime *update_time); -struct wpabuf * wpa_bss_defrag_mle(const struct wpa_bss *bss, u8 type); int wpa_bss_parse_basic_ml_element(struct wpa_supplicant *wpa_s, struct wpa_bss *bss, u8 *ap_mld_addr, diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index 8c81824f09..02114acae6 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -485,6 +485,7 @@ static bool wpas_ml_element(struct wpa_supplicant *wpa_s, struct wpa_bss *bss, u8 ml_ie_len; const struct ieee80211_eht_ml *eht_ml; const struct eht_ml_basic_common_info *ml_basic_common_info; + struct ieee802_11_elems elems; u8 i; const u16 control = host_to_le16(MULTI_LINK_CONTROL_TYPE_BASIC | @@ -497,7 +498,11 @@ static bool wpas_ml_element(struct wpa_supplicant *wpa_s, struct wpa_bss *bss, if (!(wpa_s->drv_flags2 & WPA_DRIVER_FLAGS2_MLO)) return false; - mlbuf = wpa_bss_defrag_mle(bss, MULTI_LINK_CONTROL_TYPE_BASIC); + if (ieee802_11_parse_elems(wpa_bss_ie_ptr(bss), + bss->ie_len, &elems, 1) == ParseFailed) + return false; + + mlbuf = ieee802_11_defrag(elems.basic_mle, elems.basic_mle_len, true); if (!mlbuf) { wpa_dbg(wpa_s, MSG_DEBUG, "MLD: No ML element"); return false; From patchwork Mon Nov 20 23:51:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866351 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=j9S2YqQY; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=koVJELMl; 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 4SZ48Q15rNz1ySb for ; Tue, 21 Nov 2023 10:53:26 +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=JlO/AZqSAa0jnhjA2dohHm4pzC6ci4FUQwBuVvujJjM=; b=j9S2YqQY8JPup8 Nz+l8zT9UpHGvo9LejG13OY8kQkGoPRMkAXKQoSg28YsUgpyIGeOFs/8VIUQFtSrqBlBv5mEQq0gz 0DwpSWq+baNIQXp8iVeIHH7HHDsdGQhXUrrqKE6ui0FDWvTbyvP8zomD/9CaTuzDE2STs1h+CBpPM qJXU691C0uGkEcgAyQ9TNG3AzMoSKcgRE7uv38rPFuV4pNvPnLxopVFi99S3W8hZI1GCV5uclwKd8 TTgRc/AxSEu7Ue24WbT90JrTLA3fA2lE6G9YTRc+I60vYfn1o/2+dD4MM93qHNyiWLiNu5+tXqPMv A+Uz+5u7DVWt6rukDWtg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4E-00F5dh-2Y; Mon, 20 Nov 2023 23:52:38 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E49-00F5aK-2D for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:52:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524353; x=1732060353; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hitNbhoFygaDoyMXWvyJbaaPPsBAp/tUa+qooCTjQj8=; b=koVJELMlJUsfgbgnABfiade2IjSK3aI2vU5t9VMQSTKohXdc5DjPU6Su qXPpHZMF8DkikqNY4LxVdMR+nSpE88sPyIialJ01OmOZ7mcf4y4FAkbZN DVGKQNPQmB9MoCKY4JG0YRQlEvLIVFXYkCLvViqZmPredfVTf5rorHdGt HLm+TiwoLfwQp1KjGpoZqJxMET6hClnHCLKPYyCU1t4gHE/qxVp+tI5zZ FueGV5LwrZMBoq11fCd1J6TYf+vd573qe+IxFTQjOkidJxA0uM226k9CV TcaxERpmRSLXj8mPabYmjW+ZkceBVoGQaJpWE15LRzZSTQClwejm9SXp2 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769736" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769736" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871337" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871337" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:30 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Andrei Otcheretianski , Ilan Peer Subject: [PATCH 05/42] wpa_supplicant: Add MLD testing configs Date: Tue, 21 Nov 2023 01:51:19 +0200 Message-Id: <20231120235156.363852-6-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155233_779268_9978FE34 X-CRM114-Status: GOOD ( 22.30 ) X-Spam-Score: -0.4 (/) 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: Add band preference, bssid preference and single link enforcement testing options. This is needed for testing. Signed-off-by: Ilan Peer Signed-off-by: Andrei Otcheretianski --- wpa_supplicant/config.c | 23 ++++++++ wpa_supplicant/config.h | 17 ++++++ wpa_ [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 Add band preference, bssid preference and single link enforcement testing options. This is needed for testing. Signed-off-by: Ilan Peer Signed-off-by: Andrei Otcheretianski --- wpa_supplicant/config.c | 23 ++++++++ wpa_supplicant/config.h | 17 ++++++ wpa_supplicant/config_file.c | 10 ++++ wpa_supplicant/sme.c | 111 ++++++++++++++++++++++++++++++++--- 4 files changed, 152 insertions(+), 9 deletions(-) diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index 77467f00a1..c663eb78ba 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -4671,6 +4671,9 @@ struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface, config->driver_param = os_strdup(driver_param); config->gas_rand_addr_lifetime = DEFAULT_RAND_ADDR_LIFETIME; +#ifdef CONFIG_TESTING_OPTIONS + config->mld_connect_band_pref = DEFAULT_MLD_CONNECT_BAND_PREF; +#endif /* CONFIG_TESTING_OPTIONS */ return config; } @@ -5305,6 +5308,21 @@ static int wpa_config_get_ipv4(const char *name, struct wpa_config *config, } #endif /* CONFIG_P2P */ +#ifdef CONFIG_TESTING_OPTIONS +static int wpa_config_process_mld_connect_bssid_pref( + const struct global_parse_data *data, + struct wpa_config *config, int line, const char *pos) +{ + if (hwaddr_aton2(pos, config->mld_connect_bssid_pref) < 0) { + wpa_printf(MSG_ERROR, + "Line %d: Invalid mld_connect_bssid_pref '%s'", + line, pos); + return -1; + } + + return 0; +} +#endif /* CONFIG_TESTING_OPTIONS */ #ifdef OFFSET #undef OFFSET @@ -5519,6 +5537,11 @@ static const struct global_parse_data global_fields[] = { { INT_RANGE(pasn_corrupt_mic, 0, 1), 0 }, #endif /* CONFIG_TESTING_OPTIONS */ #endif /* CONFIG_PASN */ +#ifdef CONFIG_TESTING_OPTIONS + { INT_RANGE(mld_force_single_link, 0, 1), 0 }, + { INT_RANGE(mld_connect_band_pref, 0, MLD_CONNECT_BAND_PREF_MAX), 0 }, + { FUNC(mld_connect_bssid_pref), 0 }, +#endif /* CONFIG_TESTING_OPTIONS */ }; #undef FUNC diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h index 7d2b570282..647374d697 100644 --- a/wpa_supplicant/config.h +++ b/wpa_supplicant/config.h @@ -47,6 +47,9 @@ #define DEFAULT_OCE_SUPPORT OCE_STA #define DEFAULT_EXTENDED_KEY_ID 0 #define DEFAULT_SCAN_RES_VALID_FOR_CONNECT 5 +#ifdef CONFIG_TESTING_OPTIONS +#define DEFAULT_MLD_CONNECT_BAND_PREF MLD_CONNECT_BAND_PREF_AUTO +#endif /* CONFIG_TESTING_OPTIONS */ #include "config_ssid.h" #include "wps/wps.h" @@ -1777,6 +1780,20 @@ struct wpa_config { #endif /* CONFIG_TESTING_OPTIONS */ #endif /* CONFIG_PASN*/ + +#ifdef CONFIG_TESTING_OPTIONS + enum { + MLD_CONNECT_BAND_PREF_AUTO = 0, + MLD_CONNECT_BAND_PREF_2GHZ = 1, + MLD_CONNECT_BAND_PREF_5GHZ = 2, + MLD_CONNECT_BAND_PREF_6GHZ = 3, + MLD_CONNECT_BAND_PREF_MAX = 4, + } mld_connect_band_pref; + + u8 mld_connect_bssid_pref[ETH_ALEN]; + + int mld_force_single_link; +#endif /* CONFIG_TESTING_OPTIONS */ }; diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c index 9a474bd834..4db85f9c07 100644 --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c @@ -1612,6 +1612,16 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config) if (config->wowlan_disconnect_on_deinit) fprintf(f, "wowlan_disconnect_on_deinit=%d\n", config->wowlan_disconnect_on_deinit); +#ifdef CONFIG_TESTING_OPTIONS + if (config->mld_force_single_link) + fprintf(f, "mld_force_single_link=1\n"); + if (config->mld_connect_band_pref != MLD_CONNECT_BAND_PREF_AUTO) + fprintf(f, "mld_connect_band_pref=%d\n", + config->mld_connect_band_pref); + if (!is_zero_ether_addr(config->mld_connect_bssid_pref)) + fprintf(f, "mld_connect_bssid_pref=" MACSTR "\n", + MAC2STR(config->mld_connect_bssid_pref)); +#endif /* CONFIG_TESTING_OPTIONS */ } #endif /* CONFIG_NO_CONFIG_WRITE */ diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index 02114acae6..bbd8e1f205 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -605,6 +605,91 @@ static void wpas_ml_handle_removed_links(struct wpa_supplicant *wpa_s, wpa_s->valid_links &= ~removed_links; } +#ifdef CONFIG_TESTING_OPTIONS +static struct wpa_bss *wpas_ml_connect_pref(struct wpa_supplicant *wpa_s, + struct wpa_bss *bss) +{ + int low, high; + u8 i; + + wpa_printf(MSG_DEBUG, + "MLD: valid_links=%d, band_pref=%u, bssid_pref=" MACSTR, + wpa_s->valid_links, + wpa_s->conf->mld_connect_band_pref, + MAC2STR(wpa_s->conf->mld_connect_bssid_pref)); + + /* check if there are more then one link */ + if (!(wpa_s->valid_links & (wpa_s->valid_links - 1))) + return bss; + + if (!is_zero_ether_addr(wpa_s->conf->mld_connect_bssid_pref)) { + for (i = 0; i < MAX_NUM_MLD_LINKS; i++) { + if (!(wpa_s->valid_links & BIT(i))) + continue; + + if (wpa_s->mlo_assoc_link_id == i) + continue; + + if (!os_memcmp(wpa_s->links[i].bssid, + wpa_s->conf->mld_connect_bssid_pref, + ETH_ALEN)) + goto found; + } + } + + if (wpa_s->conf->mld_connect_band_pref != + MLD_CONNECT_BAND_PREF_AUTO) { + switch (wpa_s->conf->mld_connect_band_pref) { + case MLD_CONNECT_BAND_PREF_2GHZ: + low = 2412; + high = 2472; + break; + case MLD_CONNECT_BAND_PREF_5GHZ: + low = 5180; + high = 5985; + break; + case MLD_CONNECT_BAND_PREF_6GHZ: + low = 5955; + high = 7125; + break; + default: + return bss; + } + + for (i = 0; i < MAX_NUM_MLD_LINKS; i++) { + if (!(wpa_s->valid_links & BIT(i))) + continue; + + if (wpa_s->mlo_assoc_link_id == i) + continue; + + if (wpa_s->links[i].freq >= low && + wpa_s->links[i].freq <= high) + goto found; + } + } else { + return bss; + } + +found: + if (i == MAX_NUM_MLD_LINKS) { + wpa_printf(MSG_DEBUG, "MLD: no match for connect/band pref"); + return bss; + } + + wpa_printf(MSG_DEBUG, + "MLD: change BSS for connect: " MACSTR " -> " MACSTR, + MAC2STR(wpa_s->links[wpa_s->mlo_assoc_link_id].bssid), + MAC2STR(wpa_s->links[i].bssid)); + + /* get the bss entry and do the switch */ + bss = wpa_bss_get_bssid(wpa_s, wpa_s->links[i].bssid); + wpa_s->mlo_assoc_link_id = i; + + return bss; +} +#endif /* CONFIG_TESTING_OPTIONS */ + static void wpas_sme_ml_auth(struct wpa_supplicant *wpa_s, union wpa_event_data *data, @@ -686,11 +771,27 @@ static void sme_send_authentication(struct wpa_supplicant *wpa_s, return; } + os_memset(¶ms, 0, sizeof(params)); + if (wpas_ml_element(wpa_s, bss, ssid)) { + wpa_printf(MSG_DEBUG, "MLD: In authentication"); +#ifdef CONFIG_TESTING_OPTIONS + bss = wpas_ml_connect_pref(wpa_s, bss); + + if (wpa_s->conf->mld_force_single_link) { + wpa_printf(MSG_DEBUG, "MLD: Force single link"); + wpa_s->valid_links = BIT(wpa_s->mlo_assoc_link_id); + } +#endif /* CONFIG_TESTING_OPTIONS */ + params.mld = true; + params.mld_link_id = wpa_s->mlo_assoc_link_id; + params.ap_mld_addr = wpa_s->ap_mld_addr; + wpas_ml_handle_removed_links(wpa_s, bss); + } + skip_auth = wpa_s->conf->reassoc_same_bss_optim && wpa_s->reassoc_same_bss; wpa_s->current_bss = bss; - os_memset(¶ms, 0, sizeof(params)); wpa_s->reassociate = 0; params.freq = bss->freq; @@ -699,14 +800,6 @@ static void sme_send_authentication(struct wpa_supplicant *wpa_s, params.ssid_len = bss->ssid_len; params.p2p = ssid->p2p_group; - if (wpas_ml_element(wpa_s, bss, ssid)) { - wpa_printf(MSG_DEBUG, "MLD: In authentication"); - params.mld = true; - params.mld_link_id = wpa_s->mlo_assoc_link_id; - params.ap_mld_addr = wpa_s->ap_mld_addr; - wpas_ml_handle_removed_links(wpa_s, bss); - } - if (wpa_s->sme.ssid_len != params.ssid_len || os_memcmp(wpa_s->sme.ssid, params.ssid, params.ssid_len) != 0) wpa_s->sme.prev_bssid_set = 0; From patchwork Mon Nov 20 23:51:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866358 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=BV0Z0Zdb; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=g2ITy3oF; 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 4SZ48P6htCz1ySW for ; Tue, 21 Nov 2023 10:53: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=MR9MkK8hhI8S8LBw2jntprhtwJ6Em+b81/EnWLyzC/E=; b=BV0Z0ZdbCOeP/w qpwQOA+T61Dk60gfSUeWFlFDV4hU7AEpcmdRYIKCCtQZIg0sj6awIIBYFZHkuzpKfd6pW4T71SN6p NE0jN+JWWk6uhpAnXSKOTaTYyrxfI7q85hGuiXj9tpZyKFkGlloWwe7z1RR/petIFb2AK0o0CdVf8 A3SW2uWPUuRjSvHurRxdJ5zuuzQt58DQzroaHHUeuO34G5c7G6EFyS8OD/Cilk5sjtXrE9sRGM00g Ec/UcV6n6NPl8YqbUoFXahhZyGa1Djmi2+QPS3QivTmckYZNm/+Ovi3xcb1HnjlfwYmab+3Ftg0/R R2CYP2HBz/B1//CU+APg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4H-00F5f4-2h; Mon, 20 Nov 2023 23:52:41 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4A-00F5Zj-2l for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:52:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524354; x=1732060354; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9tof9UYzDkRYHnVcLUKK9DhOxy+ikxunu0eL+QSEKj0=; b=g2ITy3oFz++6PaFBAvZMuhbfr1RvvVuTgELhWImYfu3QORnB1d0KCtU8 HVUanwTxhaWe/DozJbZdYqvpJGpwfBRmnc4R/MPmY1ZQVmLcphL1IN4ul o5RBS1AIMIuIEpeYzQT5F22syY0xIvbbHCZqcOnmucgGjJQUFO+ANLlFQ jejizngBul8OYA/XQJcQNNhTokGUZUZOeo9zW2j2l20UPZQk1g6EfUoc/ kPC1zcMODU6BAjfXulYuSUMDqPo3xOIXNQWT8RpUz/ZSOzPYprMn1Dvj3 3D+4Jo7Qn2yZji699EHeIpUSPraZBXHG/6ObBCZeUeJB7ZsDGtwVl7fFR A==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769741" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769741" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871347" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871347" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:32 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Andrei Otcheretianski Subject: [PATCH 06/42] wpa_supplicant: Remove duplicate logic in wpas_ml_element() Date: Tue, 21 Nov 2023 01:51:20 +0200 Message-Id: <20231120235156.363852-7-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155235_001363_C94536F1 X-CRM114-Status: GOOD ( 24.96 ) X-Spam-Score: -0.4 (/) 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: Parsing multiple RNR elements already exists in wpa_bss_parse_basic_ml_element(), so wpas_ml_element() just duplicates the same code. Combine the functionality of both these functions and remove the d [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 Parsing multiple RNR elements already exists in wpa_bss_parse_basic_ml_element(), so wpas_ml_element() just duplicates the same code. Combine the functionality of both these functions and remove the duplicate. Signed-off-by: Andrei Otcheretianski --- src/common/ieee802_11_common.c | 29 ---- src/common/ieee802_11_common.h | 1 - wpa_supplicant/bss.c | 62 ++++++--- wpa_supplicant/bss.h | 4 +- wpa_supplicant/events.c | 5 +- wpa_supplicant/sme.c | 246 ++++----------------------------- 6 files changed, 71 insertions(+), 276 deletions(-) diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c index 37a300ea48..06f82ce303 100644 --- a/src/common/ieee802_11_common.c +++ b/src/common/ieee802_11_common.c @@ -2495,35 +2495,6 @@ const u8 * get_ie(const u8 *ies, size_t len, u8 eid) } -/** - * get_ie_nth - Fetch a specified information element from IEs buffer - * @ies: Information elements buffer - * @len: Information elements buffer length - * @eid: Information element identifier (WLAN_EID_*) - * @nth: Return the nth element of the requested type (2 returns the second) - * Returns: Pointer to the information element (id field) or %NULL if not found - * - * This function returns the nth matching information element in the IEs - * buffer or %NULL in case the element is not found. - */ -const u8 * get_ie_nth(const u8 *ies, size_t len, u8 eid, int nth) -{ - const struct element *elem; - int sofar = 0; - - if (!ies) - return NULL; - - for_each_element_id(elem, eid, ies, len) { - sofar++; - if (sofar == nth) - return &elem->id; - } - - return NULL; -} - - /** * get_ie_ext - Fetch a specified extended information element from IEs buffer * @ies: Information elements buffer diff --git a/src/common/ieee802_11_common.h b/src/common/ieee802_11_common.h index a8a2118b1f..a7d407b65d 100644 --- a/src/common/ieee802_11_common.h +++ b/src/common/ieee802_11_common.h @@ -261,7 +261,6 @@ extern const struct oper_class_map global_op_class[]; extern size_t global_op_class_size; const u8 * get_ie(const u8 *ies, size_t len, u8 eid); -const u8 * get_ie_nth(const u8 *ies, size_t len, u8 eid, int nth); const u8 * get_ie_ext(const u8 *ies, size_t len, u8 ext); const u8 * get_vendor_ie(const u8 *ies, size_t len, u32 vendor_type); diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c index b85a9ad177..e9164a09e7 100644 --- a/wpa_supplicant/bss.c +++ b/wpa_supplicant/bss.c @@ -18,6 +18,7 @@ #include "notify.h" #include "scan.h" #include "bss.h" +#include "rsn_supp/wpa.h" static void wpa_bss_set_hessid(struct wpa_bss *bss) { @@ -1221,22 +1222,6 @@ const u8 * wpa_bss_get_ie(const struct wpa_bss *bss, u8 ie) } -/** - * wpa_bss_get_ie_nth - Fetch a specified information element from a BSS entry - * @bss: BSS table entry - * @ie: Information element identitifier (WLAN_EID_*) - * @nth: Return the nth element of the requested type (2 returns the second) - * Returns: Pointer to the information element (id field) or %NULL if not found - * - * This function returns the nth matching information element in the BSS - * entry. - */ -const u8 * wpa_bss_get_ie_nth(const struct wpa_bss *bss, u8 ie, int nth) -{ - return get_ie_nth(wpa_bss_ie_ptr(bss), bss->ie_len, ie, nth); -} - - /** * wpa_bss_get_ie_ext - Fetch a specified extended IE from a BSS entry * @bss: BSS table entry @@ -1500,7 +1485,8 @@ static void wpa_bss_parse_ml_rnr_ap_info(struct wpa_supplicant *wpa_s, struct wpa_bss *bss, u8 mbssid_idx, const struct ieee80211_neighbor_ap_info *ap_info, - size_t len, u16 *seen, u16 *missing) + size_t len, u16 *seen, u16 *missing, + struct wpa_ssid *ssid) { const u8 *pos, *end; const u8 *mld_params; @@ -1524,12 +1510,15 @@ wpa_bss_parse_ml_rnr_ap_info(struct wpa_supplicant *wpa_s, pos += sizeof(*ap_info); for (i = 0; i < count; i++) { + u8 bss_params; + if (bss->n_mld_links >= MAX_NUM_MLD_LINKS) return; if (end - pos < ap_info->tbtt_info_len) break; + bss_params = pos[1 + ETH_ALEN + 4]; mld_params = pos + mld_params_offset; link_id = *(mld_params + 1) & EHT_ML_LINK_ID_MSK; @@ -1545,7 +1534,13 @@ wpa_bss_parse_ml_rnr_ap_info(struct wpa_supplicant *wpa_s, wpa_printf(MSG_DEBUG, "MLD: mld ID=%u, link ID=%u", *mld_params, link_id); - if (neigh_bss) { + if (!neigh_bss) { + *missing |= BIT(link_id); + } else if (!ssid || + bss_params & RNR_BSS_PARAM_SAME_SSID || + bss_params & RNR_BSS_PARAM_CO_LOCATED || + wpa_scan_res_match(wpa_s, 0, neigh_bss, + ssid, 1, 0)) { struct mld_link *l; l = &bss->mld_links[bss->n_mld_links]; @@ -1554,8 +1549,6 @@ wpa_bss_parse_ml_rnr_ap_info(struct wpa_supplicant *wpa_s, ETH_ALEN); l->freq = neigh_bss->freq; bss->n_mld_links++; - } else { - *missing |= BIT(link_id); } } @@ -1572,6 +1565,7 @@ wpa_bss_parse_ml_rnr_ap_info(struct wpa_supplicant *wpa_s, * @link_info: Array to store link information (or %NULL), * should be initialized and #MAX_NUM_MLD_LINKS elements long * @missing_links: Result bitmask of links that were not discovered (or %NULL) + * @ssid: Target SSID (or %NULL) * Returns: 0 on success or -1 for non-MLD or parsing failures * * Parses the Basic Multi-Link element of the BSS into @link_info using the scan @@ -1582,7 +1576,8 @@ wpa_bss_parse_ml_rnr_ap_info(struct wpa_supplicant *wpa_s, int wpa_bss_parse_basic_ml_element(struct wpa_supplicant *wpa_s, struct wpa_bss *bss, u8 *ap_mld_addr, - u16 *missing_links) + u16 *missing_links, + struct wpa_ssid *ssid) { struct ieee802_11_elems elems; struct wpabuf *mlbuf; @@ -1623,6 +1618,29 @@ int wpa_bss_parse_basic_ml_element(struct wpa_supplicant *wpa_s, ml_ie_len = wpabuf_len(mlbuf); + if (ssid) { + struct wpa_ie_data ie; + + if (!elems.rsn_ie || wpa_parse_wpa_ie(elems.rsn_ie - 2, 2 + elems.rsn_ie_len, &ie)) { + wpa_dbg(wpa_s, MSG_DEBUG, "MLD: No RSN element"); + goto out; + } + + if (!(ie.capabilities & WPA_CAPABILITY_MFPC) || + wpas_get_ssid_pmf(wpa_s, ssid) == NO_MGMT_FRAME_PROTECTION) { + wpa_dbg(wpa_s, MSG_DEBUG, + "MLD: No management frame protection"); + goto out; + } + + ie.key_mgmt &= ~(WPA_KEY_MGMT_PSK | WPA_KEY_MGMT_FT_PSK | + WPA_KEY_MGMT_PSK_SHA256); + if (!(ie.key_mgmt & ssid->key_mgmt)) { + wpa_dbg(wpa_s, MSG_DEBUG, "MLD: No valid key management"); + goto out; + } + } + /* * for ext ID + 2 control + common info len + MLD address + * link info @@ -1702,7 +1720,7 @@ int wpa_bss_parse_basic_ml_element(struct wpa_supplicant *wpa_s, wpa_bss_parse_ml_rnr_ap_info(wpa_s, bss, mbssid_idx, ap_info, len, &seen, - &missing); + &missing, ssid); pos += ap_info_len; len -= ap_info_len; diff --git a/wpa_supplicant/bss.h b/wpa_supplicant/bss.h index 7b0b24c616..bacf0a8e9c 100644 --- a/wpa_supplicant/bss.h +++ b/wpa_supplicant/bss.h @@ -171,7 +171,6 @@ struct wpa_bss * wpa_bss_get_id(struct wpa_supplicant *wpa_s, unsigned int id); struct wpa_bss * wpa_bss_get_id_range(struct wpa_supplicant *wpa_s, unsigned int idf, unsigned int idl); const u8 * wpa_bss_get_ie(const struct wpa_bss *bss, u8 ie); -const u8 * wpa_bss_get_ie_nth(const struct wpa_bss *bss, u8 ie, int nth); const u8 * wpa_bss_get_ie_ext(const struct wpa_bss *bss, u8 ext); const u8 * wpa_bss_get_vendor_ie(const struct wpa_bss *bss, u32 vendor_type); const u8 * wpa_bss_get_vendor_ie_beacon(const struct wpa_bss *bss, @@ -216,7 +215,8 @@ void calculate_update_time(const struct os_reltime *fetch_time, int wpa_bss_parse_basic_ml_element(struct wpa_supplicant *wpa_s, struct wpa_bss *bss, u8 *ap_mld_addr, - u16 *missing_links); + u16 *missing_links, + struct wpa_ssid *ssid); u16 wpa_bss_parse_reconf_ml_element(struct wpa_supplicant *wpa_s, struct wpa_bss *bss); diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 1ee6eb82ed..a0c8eb1c53 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -1135,7 +1135,7 @@ static bool wpas_valid_ml_bss(struct wpa_supplicant *wpa_s, struct wpa_bss *bss) { u16 removed_links; - if (wpa_bss_parse_basic_ml_element(wpa_s, bss, NULL, NULL)) + if (wpa_bss_parse_basic_ml_element(wpa_s, bss, NULL, NULL, NULL)) return true; if (bss->n_mld_links == 0) @@ -1860,7 +1860,8 @@ static int wpa_supplicant_connect_ml_missing(struct wpa_supplicant *wpa_s, /* Try to resolve any missing link information */ if (wpa_bss_parse_basic_ml_element(wpa_s, selected, NULL, - &missing_links) || !missing_links) + &missing_links, ssid) || + !missing_links) return 0; removed_links = wpa_bss_parse_reconf_ml_element(wpa_s, selected); diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index bbd8e1f205..95d1858800 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -378,225 +378,6 @@ static void sme_auth_handle_rrm(struct wpa_supplicant *wpa_s, } -static void wpas_process_tbtt_info(struct wpa_supplicant *wpa_s, const u8 *data) -{ - struct wpa_bss *neigh_bss; - const u8 *bssid; - u8 bss_params; - u8 link_id; - - /* TBTT Information field - * Neighbor AP TBTT Offset[1] - * BSSID[6] - * Short SSID[4] - * BSS parameters[1] - * 20 MHz PSD[1] - * MLD Parameters[3] - * B0..B7: AP MLD ID - * B7..B11: Link ID - * B12..B19: BSS Parameters Change Count - * B20: All Updates Included - * B21: Disabled Link Indication */ - - bssid = data + 1; - bss_params = data[1 + ETH_ALEN + 4]; - - data += 13; /* MLD Parameters */ - link_id = *(data + 1) & 0xF; - - wpa_dbg(wpa_s, MSG_DEBUG, - "MLD: mld ID=%u, link ID=%u, bssid=" MACSTR ", bss_params=0x%x", - *data, link_id, MAC2STR(bssid), bss_params); - - if (*data) { - wpa_printf(MSG_DEBUG, "MLD: Reported link not part of MLD"); - return; - } - - neigh_bss = wpa_bss_get_bssid(wpa_s, bssid); - if (!neigh_bss) { - wpa_printf(MSG_DEBUG, "MLD: Neighbor not found in scan"); - return; - } - - if (!((bss_params & RNR_BSS_PARAM_SAME_SSID) && - (bss_params & RNR_BSS_PARAM_CO_LOCATED)) && - !wpa_scan_res_match(wpa_s, 0, neigh_bss, wpa_s->current_ssid, - 1, 0)) { - wpa_printf(MSG_DEBUG, - "MLD: Neighbor doesn't match current SSID - skip link"); - return; - } - - wpa_s->valid_links |= BIT(link_id); - os_memcpy(wpa_s->links[link_id].bssid, bssid, ETH_ALEN); - wpa_s->links[link_id].freq = neigh_bss->freq; -} - - -static void wpas_process_rnr(struct wpa_supplicant *wpa_s, const u8 *pos, - size_t rnr_ie_len) -{ - while (rnr_ie_len > sizeof(struct ieee80211_neighbor_ap_info)) { - const struct ieee80211_neighbor_ap_info *ap_info = - (const struct ieee80211_neighbor_ap_info *) pos; - /* The first TBTT Information field */ - const u8 *data = ap_info->data; - u8 tbtt_count; - size_t len; - int tbtt_i; - - if (rnr_ie_len < sizeof(struct ieee80211_neighbor_ap_info)) - break; - - tbtt_count = (ap_info->tbtt_info_hdr >> 4) + 1; - len = sizeof(struct ieee80211_neighbor_ap_info) + - ap_info->tbtt_info_len * tbtt_count; - - wpa_printf(MSG_DEBUG, "MLD: op_class=%u, channel=%u", - ap_info->op_class, ap_info->channel); - - if (len > rnr_ie_len) - break; - - if (ap_info->tbtt_info_len < 16) { - rnr_ie_len -= len; - pos += len; - continue; - } - - for (tbtt_i = 0; tbtt_i < tbtt_count; tbtt_i++) { - wpas_process_tbtt_info(wpa_s, data); - data += ap_info->tbtt_info_len; - } - - rnr_ie_len -= len; - pos += len; - } -} - - -static bool wpas_ml_element(struct wpa_supplicant *wpa_s, struct wpa_bss *bss, - struct wpa_ssid *ssid) -{ - struct wpabuf *mlbuf; - const u8 *rnr_ie, *rsn_ie; - struct wpa_ie_data ie; - u8 ml_ie_len; - const struct ieee80211_eht_ml *eht_ml; - const struct eht_ml_basic_common_info *ml_basic_common_info; - struct ieee802_11_elems elems; - u8 i; - const u16 control = - host_to_le16(MULTI_LINK_CONTROL_TYPE_BASIC | - BASIC_MULTI_LINK_CTRL_PRES_LINK_ID | - BASIC_MULTI_LINK_CTRL_PRES_BSS_PARAM_CH_COUNT | - BASIC_MULTI_LINK_CTRL_PRES_MLD_CAPA); - bool ret = false; - int rnr_idx; - - if (!(wpa_s->drv_flags2 & WPA_DRIVER_FLAGS2_MLO)) - return false; - - if (ieee802_11_parse_elems(wpa_bss_ie_ptr(bss), - bss->ie_len, &elems, 1) == ParseFailed) - return false; - - mlbuf = ieee802_11_defrag(elems.basic_mle, elems.basic_mle_len, true); - if (!mlbuf) { - wpa_dbg(wpa_s, MSG_DEBUG, "MLD: No ML element"); - return false; - } - - rsn_ie = wpa_bss_get_ie(bss, WLAN_EID_RSN); - if (!rsn_ie || wpa_parse_wpa_ie(rsn_ie, 2 + rsn_ie[1], &ie)) { - wpa_dbg(wpa_s, MSG_DEBUG, "MLD: No RSN element"); - goto out; - } - - if (!(ie.capabilities & WPA_CAPABILITY_MFPC) || - wpas_get_ssid_pmf(wpa_s, ssid) == NO_MGMT_FRAME_PROTECTION) { - wpa_dbg(wpa_s, MSG_DEBUG, - "MLD: No management frame protection"); - goto out; - } - - ie.key_mgmt &= ~(WPA_KEY_MGMT_PSK | WPA_KEY_MGMT_FT_PSK | - WPA_KEY_MGMT_PSK_SHA256); - if (!(ie.key_mgmt & ssid->key_mgmt)) { - wpa_dbg(wpa_s, MSG_DEBUG, "MLD: No valid key management"); - goto out; - } - - ml_ie_len = wpabuf_len(mlbuf); - - /* control + common info len + MLD address + MLD link information */ - if (ml_ie_len < 2 + 1 + ETH_ALEN + 1) - goto out; - - eht_ml = wpabuf_head(mlbuf); - if ((eht_ml->ml_control & control) != control) { - wpa_printf(MSG_DEBUG, "MLD: Unexpected ML element control=0x%x", - eht_ml->ml_control); - goto out; - } - - ml_basic_common_info = - (const struct eht_ml_basic_common_info *) eht_ml->variable; - - /* common info length should be valid (self, mld_addr, link_id) */ - if (ml_basic_common_info->len < 1 + ETH_ALEN + 1) - goto out; - - /* get the MLD address and MLD link ID */ - os_memcpy(wpa_s->ap_mld_addr, ml_basic_common_info->mld_addr, - ETH_ALEN); - wpa_s->mlo_assoc_link_id = ml_basic_common_info->variable[0] & - EHT_ML_LINK_ID_MSK; - - os_memcpy(wpa_s->links[wpa_s->mlo_assoc_link_id].bssid, bss->bssid, - ETH_ALEN); - wpa_s->links[wpa_s->mlo_assoc_link_id].freq = bss->freq; - - wpa_printf(MSG_DEBUG, "MLD: address=" MACSTR ", link ID=%u", - MAC2STR(wpa_s->ap_mld_addr), wpa_s->mlo_assoc_link_id); - - wpa_s->valid_links = BIT(wpa_s->mlo_assoc_link_id); - - ret = true; - - /* Process all Reduced Neighbor Report elements */ - for (rnr_idx = 1; ; rnr_idx++) { - rnr_ie = wpa_bss_get_ie_nth(bss, - WLAN_EID_REDUCED_NEIGHBOR_REPORT, - rnr_idx); - if (!rnr_ie) { - if (rnr_idx == 0) { - wpa_dbg(wpa_s, MSG_DEBUG, - "MLD: No RNR element"); - goto out; - } - break; - } - wpas_process_rnr(wpa_s, rnr_ie + 2, rnr_ie[1]); - } - - wpa_printf(MSG_DEBUG, "MLD: valid_links=0x%x", wpa_s->valid_links); - - for (i = 0; i < MAX_NUM_MLD_LINKS; i++) { - if (!(wpa_s->valid_links & BIT(i))) - continue; - - wpa_printf(MSG_DEBUG, "MLD: link=%u, bssid=" MACSTR, - i, MAC2STR(wpa_s->links[i].bssid)); - } - -out: - wpabuf_free(mlbuf); - return ret; -} - - static void wpas_ml_handle_removed_links(struct wpa_supplicant *wpa_s, struct wpa_bss *bss) { @@ -740,6 +521,26 @@ out: } +static void wpas_sme_set_mlo_links(struct wpa_supplicant *wpa_s, struct wpa_bss *bss) +{ + int i; + + wpa_s->valid_links = 0; + + for (i = 0; i < bss->n_mld_links; i++) { + u8 link_id = bss->mld_links[i].link_id; + u8 *bssid = bss->mld_links[i].bssid; + + if (i == 0) + wpa_s->mlo_assoc_link_id = link_id; + wpa_s->valid_links |= BIT(link_id); + os_memcpy(wpa_s->links[link_id].bssid, bssid, ETH_ALEN); + wpa_s->links[link_id].freq = bss->mld_links[i].freq; + wpa_s->links[link_id].bss = wpa_bss_get_bssid(wpa_s, bssid); + } +} + + static void sme_send_authentication(struct wpa_supplicant *wpa_s, struct wpa_bss *bss, struct wpa_ssid *ssid, int start) @@ -772,8 +573,13 @@ static void sme_send_authentication(struct wpa_supplicant *wpa_s, } os_memset(¶ms, 0, sizeof(params)); - if (wpas_ml_element(wpa_s, bss, ssid)) { + + if (wpa_s->drv_flags2 & WPA_DRIVER_FLAGS2_MLO && + !wpa_bss_parse_basic_ml_element(wpa_s, bss, wpa_s->ap_mld_addr, + NULL, ssid) && bss->n_mld_links) { wpa_printf(MSG_DEBUG, "MLD: In authentication"); + wpas_sme_set_mlo_links(wpa_s, bss); + #ifdef CONFIG_TESTING_OPTIONS bss = wpas_ml_connect_pref(wpa_s, bss); From patchwork Mon Nov 20 23:51:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866356 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=hBqfGDmC; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=ag019W6V; 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 4SZ48P744Pz1ySY for ; Tue, 21 Nov 2023 10:53: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=PpcmcLQ2wK4w1ktk79chIA+NbzvwL3IyatghZUx24Cs=; b=hBqfGDmCFKGKAW uSTByJh1t9I7z7qiIsSLarDBeAv5VIzrl356yUV6bqgNUzp3cbxGzTxArzsCQ6BiVZg3gXjbRQWTN aCCXJ9tYVjRBm20yq0pqW6iFRvi36f2FML4EJeRx/QL/3Ww1mBpQbIy3XWyBgIMToR3hCaT+CXAR8 5N9dmSorrzEdMuAslEwqtHJ/m032VkN9tqKGXwI3euXCFGtBzZG4oFMUuCki9wfRuZZXKqLlfMpPJ mWpToxuXWx09ojB183vB1WUxESdCwcccLaWWGXZjx+KPGfZxPKX2OSkIrENFXsNHmJBACZ9ZT64GX TMSFbSGFsp46kTo2XSog==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4G-00F5eK-1f; Mon, 20 Nov 2023 23:52:40 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4B-00F5aK-23 for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:52:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524355; x=1732060355; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=R+xgV6NUL2+FCtV8ykUkt42YlQxGi/z/93c2M5Z3HqQ=; b=ag019W6VfbIdaM1B/N23/S57UoXA+9z+3olhSJYZiHJXfwcmqf3pwSpp mkxT2hA6mhs5+QbB/u20HIYg6qpSPwf1CW6p7B1bQStLAqZSI15+oLopT Ls9Z3oxGq1wJ7pHj0cbM0p4ENxOioo5vt7EBXXG2EviT1lzklji+zVlBC 3fAvRk94xeDuxRl9AhevCcMRII98L+RCVlDhwAQhmrX8EEJZYPXB7eFG2 nmPnEZhLYxA4M3zbsziZwSSUt5rVKcg0/79JxTNhg1gqmgBD+ADloIAMn 924yTkVeMEx5HR0kezZ4NuHZn5yS4iWRhWgyRdjGItzJi6ErSZAUyTJ8p w==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769747" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769747" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871353" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871353" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:33 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Andrei Otcheretianski Subject: [PATCH 07/42] wpa_supplicant: Fix ml_ie_len type in wpa_bss_parse_basic_ml_element() Date: Tue, 21 Nov 2023 01:51:21 +0200 Message-Id: <20231120235156.363852-8-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155235_733879_E575F0B5 X-CRM114-Status: GOOD ( 11.35 ) X-Spam-Score: -0.4 (/) 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: Since the ML element can be fragmented, use size_t instead of u8. Signed-off-by: Andrei Otcheretianski --- wpa_supplicant/bss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 Since the ML element can be fragmented, use size_t instead of u8. Signed-off-by: Andrei Otcheretianski --- wpa_supplicant/bss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c index e9164a09e7..9f48da31b0 100644 --- a/wpa_supplicant/bss.c +++ b/wpa_supplicant/bss.c @@ -1583,7 +1583,7 @@ int wpa_bss_parse_basic_ml_element(struct wpa_supplicant *wpa_s, struct wpabuf *mlbuf; const struct element *elem; u8 mbssid_idx = 0; - u8 ml_ie_len; + size_t ml_ie_len; const struct ieee80211_eht_ml *eht_ml; const struct eht_ml_basic_common_info *ml_basic_common_info; u8 i, link_id; From patchwork Mon Nov 20 23:51:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866352 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=Lljzjtg7; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=SYiIwm/z; 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 4SZ48Q0Nn4z1ySZ for ; Tue, 21 Nov 2023 10:53: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=5YDYCdFKGbp93f+JhmCyiHmyVppbfnoRbXP1MOzIRvs=; b=Lljzjtg7oF5lcW XzfCngBtoNn2pLO1L7g4ePyyYPWEwCn5aXWNBGM4Q7uOvFShG6x5RzAcxYa1iOnilPb6CY44ffL9L QfxTpC2bwBbagMgiWqtqP9gX9AAVLdAM7s1RPyXBfVt9Ak1iL+kGbsVizA7yPv2OP4etfNexEprfO JrVgGHjcuuV8bomMM8mNhigjSRx2TYqSEj3MnmCbFZ2j1EHnlj9N51S9yMghucmupJ7oR9UvY9UW3 Q+pmOI6T+PvLdK3PKqYrs275PvMCbbX6St2WDKxrOQ1kR2No3yN2PbIwzahnT3MlF2xQoVOVJx8xN 3bONjxTXzV+z06RzgpyQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4J-00F5ft-0n; Mon, 20 Nov 2023 23:52:43 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4C-00F5bf-1I for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:52:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524356; x=1732060356; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rmShEx/7OZ8jNRTdGZrKgKfY1cEjf+Xg3FOUbNGtMYA=; b=SYiIwm/zUq3j/QPTunURZ3h8qqDkqV6u3CNwvnFqxYDCn36PlfgYKceS okhgEFPWMSq9kHMX05QWMoRiJHSoM1cbl2+wExM+7gDPBlbLCi8FCUz1R ql/++GDT4cLjD0LiXrknHzcvzsf6GMU7Nc0hqycd4LWOm8ffzAE9U24h6 QZ+gcXF6o3+iGqXxP+ii+EaB7wAM14FG1GMXdDv9telzVrPGgQguoBsdC MkhmFO/taC9cgDFX4DWAOV8U/CRyZ1jozPHac9ajwio5vjxJZ9wievjrO p1/cPfg+zNrKurPhrbbeyOjdgKUAhJG507V2lqZv+CECSrFtrSeRCuFFV w==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769749" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769749" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871356" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871356" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:34 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Ilan Peer Subject: [PATCH 08/42] AP: MLD: Make BSS parameter change variable Date: Tue, 21 Nov 2023 01:51:22 +0200 Message-Id: <20231120235156.363852-9-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155236_498969_EDFE042C X-CRM114-Status: GOOD ( 13.09 ) X-Spam-Score: -0.4 (/) 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: Ilan Peer As a preparation to support link removal, make the BSS parameter change count variable. Signed-off-by: Ilan Peer --- hostapd/main.c | 3 +++ src/ap/hostapd.h | 4 ++++ src/ap/ieee802_11_eht.c | 4 +--- 3 files changed, 8 insertions(+), 3 deletions(-) Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Ilan Peer As a preparation to support link removal, make the BSS parameter change count variable. Signed-off-by: Ilan Peer --- hostapd/main.c | 3 +++ src/ap/hostapd.h | 4 ++++ src/ap/ieee802_11_eht.c | 4 +--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/hostapd/main.c b/hostapd/main.c index aac2a81dea..fcb01f60e1 100644 --- a/hostapd/main.c +++ b/hostapd/main.c @@ -338,6 +338,9 @@ setup_mld: return -1; } + /* Initialize the BSS parameter change to 1 */ + hapd->eht_mld_bss_param_change = 1; + wpa_printf(MSG_DEBUG, "MLD: Set link_id=%u, mld_addr=" MACSTR ", own_addr=" MACSTR, diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h index 2994b2788c..6dbe569cb7 100644 --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h @@ -468,6 +468,10 @@ struct hostapd_data { #ifdef CONFIG_CTRL_IFACE_UDP unsigned char ctrl_iface_cookie[CTRL_IFACE_COOKIE_LEN]; #endif /* CONFIG_CTRL_IFACE_UDP */ + +#ifdef CONFIG_IEEE80211BE + u8 eht_mld_bss_param_change; +#endif /* CONFIG_IEEE80211BE */ }; diff --git a/src/ap/ieee802_11_eht.c b/src/ap/ieee802_11_eht.c index 94a9b58b08..3167764fff 100644 --- a/src/ap/ieee802_11_eht.c +++ b/src/ap/ieee802_11_eht.c @@ -552,9 +552,7 @@ u8 * hostapd_eid_eht_basic_ml(struct hostapd_data *hapd, u8 *eid, wpabuf_put_le16(buf, link_bss->conf->dtim_period); /* BSS Parameters Change Count */ - /* TODO: Currently hard code the BSS Parameters Change Count to - * 0x1 */ - wpabuf_put_u8(buf, 0x1); + wpabuf_put_u8(buf, hapd->eht_mld_bss_param_change); /* Fragment the sub element if needed */ if (total_len <= 255) { From patchwork Mon Nov 20 23:51:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866362 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=YYvpxI7Z; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=MJUuw9Zi; 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 4SZ48S45Dbz1ySZ for ; Tue, 21 Nov 2023 10:53:28 +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=OgaI8aHr7K9Baxh8apyEyEXVzl+IiOK/6UxaFlIQZ8Q=; b=YYvpxI7ZdQMRY+ s0ckipI76D78lRnLp18CfIsgv+aobCLH4Pa7lhOtYXZkXEOAhec0TlfTPEG/ZgYC6AydBWNwyQ0Y4 /adI9ybiRill1ELmSV4xPeru219dkWoN3TOodNKQBnQyO/SYEtGsmkrtTs/IhwCyqKCYKH8rk8PBq iVS7Jo4/2x6GAQcPSildcDRXBV2BWIf0S9sPHNe9J6VlYYaYoIO9cUVcS1sdnt90QD+H8iBy1UV4P IfyBr8OgtXx4oEA9oO9cYBMw2nW/gIlWqLK537vD0ur0XphF+Nl9X62PBC4EarOfhdPzUEZA2OU6O 1wN4JMffuMs4VRzW5PKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4M-00F5iB-38; Mon, 20 Nov 2023 23:52:46 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4D-00F5d3-2h for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:52:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524357; x=1732060357; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Hb2aC6YYufEmuMXZ1ZdqmABu1MmUkrBjANJ0Ocg7vZY=; b=MJUuw9ZiBaTn1GKdZnpBl4GAy+ZNWskUXyzv8BKRPCVd2SjF6gCmTI8X CeUUDxOWOg+mqXpRhm4cWaSzOu5bv4uAAN/uVoyO+g/7wgj+5YVFg71G4 sun9CqFiNcJfXb/oQ60Z8Mi/5tfsCI63FptwDl6wXwMvWYt8hpfbAcLZG VRjCsfzjeQkZOECsa1LszhiD64fWGhsjyaGS+xivRNKhZJ0ZOWXRYDRyx pWMlZRq1a22L8PiyPH5oUGZesIiqnMluheQF50KVMG6Llfjvqo+gAyVCA cxNhbpQk6Iz0lGIHTZpq7AdOW9Hc7u6aGFnUy3ZTwMXP43fw7Cac6T+Tu A==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769752" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769752" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871360" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871360" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:35 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Ilan Peer , Andrei Otcheretianski Subject: [PATCH 09/42] AP: Add support for testing ML link removal Date: Tue, 21 Nov 2023 01:51:23 +0200 Message-Id: <20231120235156.363852-10-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155237_959790_33AB26B6 X-CRM114-Status: GOOD ( 27.09 ) X-Spam-Score: -0.4 (/) 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: Ilan Peer Add support for testing ML link removal to hostapd. While such support should inherently be integrated with the underline driver, simulate the inclusion of the ML reconfiguration element in hostapd. Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Ilan Peer Add support for testing ML link removal to hostapd. While such support should inherently be integrated with the underline driver, simulate the inclusion of the ML reconfiguration element in hostapd. Signed-off-by: Ilan Peer Signed-off-by: Andrei Otcheretianski --- hostapd/ctrl_iface.c | 35 ++++++++++++ src/ap/beacon.c | 6 +- src/ap/hostapd.c | 59 +++++++++++++++++++ src/ap/hostapd.h | 5 +- src/ap/ieee802_11.c | 2 +- src/ap/ieee802_11.h | 8 ++- src/ap/ieee802_11_eht.c | 106 +++++++++++++++++++++++++++++++++-- src/common/ieee802_11_defs.h | 7 +++ 8 files changed, 217 insertions(+), 11 deletions(-) diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c index f91bb1bcba..6ad86142e6 100644 --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c @@ -3444,6 +3444,33 @@ static int hostapd_ctrl_iface_driver_cmd(struct hostapd_data *hapd, char *cmd, } #endif /* ANDROID */ +#ifdef CONFIG_IEEE80211BE +#ifdef CONFIG_TESTING_OPTIONS + +static int hostapd_ctrl_iface_link_remove(struct hostapd_data *hapd, char *cmd, + char *buf, size_t buflen) +{ + int ret; + u32 count = atoi(cmd); + + if (!count) + count = 1; + + ret = hostapd_link_remove(hapd, count); + if (ret == 0) { + ret = os_snprintf(buf, buflen, "%s\n", "OK"); + if (os_snprintf_error(buflen, ret)) + ret = -1; + else + ret = 0; + } + + return ret; +} + +#endif /* CONFIG_TESTING_OPTIONS */ +#endif /* CONFIG_IEEE80211BE*/ + static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd, char *buf, char *reply, @@ -3996,6 +4023,14 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd, reply_len = hostapd_ctrl_iface_driver_cmd(hapd, buf + 7, reply, reply_size); #endif /* ANDROID */ +#ifdef CONFIG_IEEE80211BE +#ifdef CONFIG_TESTING_OPTIONS + } else if (os_strncmp(buf, "LINK_REMOVE ", 12) == 0) { + if (hostapd_ctrl_iface_link_remove(hapd, buf + 12, + reply, reply_size)) + reply_len = -1; +#endif /* CONFIG_TESTING_OPTIONS */ +#endif /* CONFIG_IEEE80211BE*/ } else { os_memcpy(reply, "UNKNOWN COMMAND\n", 16); reply_len = 16; diff --git a/src/ap/beacon.c b/src/ap/beacon.c index 1b5cea96b2..d5f6821e7d 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -780,7 +780,7 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd, #ifdef CONFIG_IEEE80211BE if (hapd->iconf->ieee80211be && !hapd->conf->disable_11be) { if (hapd->conf->mld_ap) - pos = hostapd_eid_eht_basic_ml(hapd, pos, NULL, true); + pos = hostapd_eid_eht_ml_beacon(hapd, NULL, pos, true); pos = hostapd_eid_eht_capab(hapd, pos, IEEE80211_MODE_AP); pos = hostapd_eid_eht_operation(hapd, pos); } @@ -1966,8 +1966,8 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd, #ifdef CONFIG_IEEE80211BE if (hapd->iconf->ieee80211be && !hapd->conf->disable_11be) { if (hapd->conf->mld_ap) - tailpos = hostapd_eid_eht_basic_ml(hapd, tailpos, NULL, - true); + tailpos = hostapd_eid_eht_ml_beacon(hapd, NULL, + tailpos, true); tailpos = hostapd_eid_eht_capab(hapd, tailpos, IEEE80211_MODE_AP); tailpos = hostapd_eid_eht_operation(hapd, tailpos); diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index 236381fe87..b6031014d4 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -412,6 +412,59 @@ static void hostapd_clear_drv_priv(struct hostapd_data *hapd) hapd->drv_priv = NULL; } +#ifdef CONFIG_IEEE80211BE +#ifdef CONFIG_TESTING_OPTIONS + +#define TU_TO_USEC(_val) ((_val) * 1024) + +static void hostapd_link_remove_timeout_handler(void *eloop_data, + void *user_ctx) +{ + struct hostapd_data *hapd = (struct hostapd_data *)eloop_data; + + hapd->eht_mld_link_removal_count--; + + wpa_printf(MSG_DEBUG, + "MLD: Remove link_id=%u in %u beacons", + hapd->mld_link_id, + hapd->eht_mld_link_removal_count); + + ieee802_11_set_beacon(hapd); + + if (!hapd->eht_mld_link_removal_count) { + hostapd_disable_iface(hapd->iface); + return; + } + + eloop_register_timeout(0, TU_TO_USEC(hapd->iconf->beacon_int), + hostapd_link_remove_timeout_handler, + hapd, NULL); +} + + +int hostapd_link_remove(struct hostapd_data *hapd, u32 count) +{ + if (!hapd->conf->mld_ap) + return -1; + + wpa_printf(MSG_DEBUG, + "MLD: Remove link_id=%u in %u beacons", + hapd->mld_link_id, count); + + hapd->eht_mld_link_removal_count = count; + hapd->eht_mld_bss_param_change++; + + eloop_register_timeout(0, TU_TO_USEC(hapd->iconf->beacon_int), + hostapd_link_remove_timeout_handler, + hapd, NULL); + + ieee802_11_set_beacon(hapd); + return 0; +} + +#endif /* CONFIG_TESTING_OPTIONS */ +#endif /* CONFIG_IEEE80211BE*/ + void hostapd_free_hapd_data(struct hostapd_data *hapd) { @@ -525,6 +578,12 @@ void hostapd_free_hapd_data(struct hostapd_data *hapd) #ifdef CONFIG_IEEE80211AX eloop_cancel_timeout(hostapd_switch_color_timeout_handler, hapd, NULL); +#ifdef CONFIG_TESTING_OPTIONS +#ifdef CONFIG_IEEE80211BE + eloop_cancel_timeout(hostapd_link_remove_timeout_handler, hapd, NULL); +#endif /* CONFIG_IEEE80211BE */ +#endif /* CONFIG_TESTING_OPTIONS */ + #endif /* CONFIG_IEEE80211AX */ } diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h index 6dbe569cb7..6f0c0fc66d 100644 --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h @@ -471,6 +471,9 @@ struct hostapd_data { #ifdef CONFIG_IEEE80211BE u8 eht_mld_bss_param_change; +#ifdef CONFIG_TESTING_OPTIONS + u8 eht_mld_link_removal_count; +#endif /* CONFIG_TESTING_OPTIONS */ #endif /* CONFIG_IEEE80211BE */ }; @@ -772,5 +775,5 @@ struct hostapd_data * hostapd_mbssid_get_tx_bss(struct hostapd_data *hapd); int hostapd_mbssid_get_bss_index(struct hostapd_data *hapd); struct hostapd_data * hostapd_mld_get_link_bss(struct hostapd_data *hapd, u8 link_id); - +int hostapd_link_remove(struct hostapd_data *hapd, u32 count); #endif /* HOSTAPD_H */ diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index 30edc5bfc3..7de12284d9 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -4893,7 +4893,7 @@ rsnxe_done: #ifdef CONFIG_IEEE80211BE if (hapd->iconf->ieee80211be && !hapd->conf->disable_11be) { if (hapd->conf->mld_ap) - p = hostapd_eid_eht_basic_ml(hapd, p, sta, false); + p = hostapd_eid_eht_ml_assoc(hapd, sta, p); p = hostapd_eid_eht_capab(hapd, p, IEEE80211_MODE_AP); p = hostapd_eid_eht_operation(hapd, p); } diff --git a/src/ap/ieee802_11.h b/src/ap/ieee802_11.h index 4b58fee624..ada6dc5e88 100644 --- a/src/ap/ieee802_11.h +++ b/src/ap/ieee802_11.h @@ -23,6 +23,7 @@ struct ieee802_11_elems; struct sae_pk; struct sae_pt; struct sae_password_entry; +struct mld_info; int ieee802_11_mgmt(struct hostapd_data *hapd, const u8 *buf, size_t len, struct hostapd_frame_info *fi); @@ -88,8 +89,11 @@ void hostapd_get_eht_capab(struct hostapd_data *hapd, const struct ieee80211_eht_capabilities *src, struct ieee80211_eht_capabilities *dest, size_t len); -u8 * hostapd_eid_eht_basic_ml(struct hostapd_data *hapd, u8 *eid, - struct sta_info *info, bool include_mld_id); +u8 * hostapd_eid_eht_ml_beacon(struct hostapd_data *hapd, + struct mld_info *mld_info, + u8 *eid, bool include_mld_id); +u8 * hostapd_eid_eht_ml_assoc(struct hostapd_data *hapd, struct sta_info *info, + u8 *eid); struct wpabuf * hostapd_ml_auth_resp(struct hostapd_data *hapd); const u8 * hostapd_process_ml_auth(struct hostapd_data *hapd, const struct ieee80211_mgmt *mgmt, diff --git a/src/ap/ieee802_11_eht.c b/src/ap/ieee802_11_eht.c index 3167764fff..7b60e6647a 100644 --- a/src/ap/ieee802_11_eht.c +++ b/src/ap/ieee802_11_eht.c @@ -421,8 +421,9 @@ void hostapd_get_eht_capab(struct hostapd_data *hapd, } -u8 * hostapd_eid_eht_basic_ml(struct hostapd_data *hapd, u8 *eid, - struct sta_info *info, bool include_mld_id) +static u8 * hostapd_eid_eht_basic_ml_common(struct hostapd_data *hapd, + u8 *eid, struct mld_info *mld_info, + bool include_mld_id) { struct wpabuf *buf; u16 control; @@ -489,12 +490,12 @@ u8 * hostapd_eid_eht_basic_ml(struct hostapd_data *hapd, u8 *eid, wpabuf_put_u8(buf, hapd->conf->mld_id); } - if (!info) + if (!mld_info) goto out; /* Add link info for the other links */ for (link_id = 0; link_id < MAX_NUM_MLD_LINKS; link_id++) { - struct mld_link_info *link = &info->mld_info.links[link_id]; + struct mld_link_info *link = &mld_info->links[link_id]; struct hostapd_data *link_bss; /* @@ -623,6 +624,103 @@ out: } +static u8 *hostapd_eid_eht_reconf_ml(struct hostapd_data *hapd, + u8 *eid) +{ +#ifdef CONFIG_TESTING_OPTIONS + struct hostapd_data *other_hapd; + u16 control; + u8 *pos = eid; + u32 i; + + wpa_printf(MSG_DEBUG, "MLD: reconfiguration ML"); + + /* first check if the element needs to be added */ + for (i = 0; i < hapd->iface->interfaces->count; i++) { + other_hapd = hapd->iface->interfaces->iface[i]->bss[0]; + + wpa_printf(MSG_DEBUG, "MLD: reconfiguration ML: %u", + other_hapd->eht_mld_link_removal_count); + + if (other_hapd->eht_mld_link_removal_count) + break; + } + + /* no link is going to be removed */ + if (i == hapd->iface->interfaces->count) + return eid; + + wpa_printf(MSG_DEBUG, "MLD: reconfiguration ML: adding element"); + + /* the length would set at the end */ + *pos++ = WLAN_EID_EXTENSION; + *pos++ = 0; + *pos++ = WLAN_EID_EXT_MULTI_LINK; + + /* set the multi-link control field */ + control = MULTI_LINK_CONTROL_TYPE_RECONF; + WPA_PUT_LE16(pos, control); + pos += 2; + + /* common info doesn't include any information */ + *pos++ = 1; + + /* add the per station profiles */ + for (i = 0; i < hapd->iface->interfaces->count; i++) { + other_hapd = hapd->iface->interfaces->iface[i]->bss[0]; + + if (!other_hapd->eht_mld_link_removal_count) + continue; + + /* sub element ID is 0 */ + *pos++ = 0; + *pos++ = 5; + + control = other_hapd->mld_link_id | + EHT_PER_STA_RECONF_CTRL_AP_REMOVAL_TIMER; + + WPA_PUT_LE16(pos, control); + pos += 2; + + /* sta profile length */ + *pos++ = 3; + + WPA_PUT_LE16(pos, other_hapd->eht_mld_link_removal_count); + pos += 2; + } + + eid[1] = pos - eid - 2; + + wpa_hexdump(MSG_DEBUG, "MLD: reconfiguration ML dump: ", + eid, eid[1] + 2); + return pos; +#else + return eid; +#endif /* CONFIG_TESTING_OPTIONS */ +} + + +u8 * hostapd_eid_eht_ml_beacon(struct hostapd_data *hapd, + struct mld_info *info, + u8 *eid, bool include_mld_id) +{ + eid = hostapd_eid_eht_basic_ml_common(hapd, eid, info, include_mld_id); + return hostapd_eid_eht_reconf_ml(hapd, eid); +} + + + +u8 * hostapd_eid_eht_ml_assoc(struct hostapd_data *hapd, struct sta_info *info, + u8 *eid) +{ + if (!info || !info->mld_info.mld_sta) + return eid; + + eid = hostapd_eid_eht_basic_ml_common(hapd, eid, &info->mld_info, false); + return hostapd_eid_eht_reconf_ml(hapd, eid); +} + + struct wpabuf * hostapd_ml_auth_resp(struct hostapd_data *hapd) { struct wpabuf *buf = wpabuf_alloc(12); diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h index 3c08ef19cf..312b1bc0bf 100644 --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h @@ -2690,6 +2690,13 @@ struct eht_ml_basic_common_info { #define EHT_PER_STA_CTRL_NSTR_BM_SIZE_MSK 0x0400 #define EHT_PER_STA_CTRL_BSS_PARAM_CNT_PRESENT_MSK 0x0800 +#define EHT_PER_STA_RECONF_CTRL_LINK_ID_MSK 0x000f +#define EHT_PER_STA_RECONF_CTRL_COMPLETE_PROFILE 0x0010 +#define EHT_PER_STA_RECONF_CTRL_MAC_ADDR 0x0020 +#define EHT_PER_STA_RECONF_CTRL_AP_REMOVAL_TIMER 0x0040 +#define EHT_PER_STA_RECONF_CTRL_OP_UPDATE_TYPE_MSK 0x0780 +#define EHT_PER_STA_RECONF_CTRL_OP_PARAMS 0x0800 + /* IEEE P802.11be/D2.0, 9.4.2.312.2.4 - Per-STA Profile subelement format */ struct ieee80211_eht_per_sta_profile { le16 sta_control; From patchwork Mon Nov 20 23:51:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866359 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=AEEZH43i; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=EeWR4t0U; 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 4SZ48R6RX1z1ySd for ; Tue, 21 Nov 2023 10:53:27 +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=fxpNl5C0f/eVtWQTvhrLs13wdXMQHUewlYjdly8KCuY=; b=AEEZH43inF/gzs bbIKiGd5U3wOp8IShcpcWOSWkvIqJoBPgv65aNH5HiEgwlwCxv1KC/ci9agvcdWxR/0ii8HdlyaIR TNZJNCnXFjbmb49ky1IvuZNX4Gc5yP5fHlcFZNcAZ8Clu9yOn5Nhq/UsqSZxbL6+eG5mHTy+NFrBK WO7rd+4svJmL2X062I+p8OlBigmbU/7azOnZ6KO0GGl8bsU8T9xNI5v+KnLVoTK9Y18Fvl8FyDP03 ZDT0Ws6lWHNuuhZm3Ol5YSPHpLilmoqgaxAcCT5vk8kUb0+CeZaoulw6FZQiUPl6o5Woc4Ys+MDIL 6z6+3LrjRMq8Bl8184DA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4O-00F5j8-1w; Mon, 20 Nov 2023 23:52:48 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4E-00F5bf-2y for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:52:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524358; x=1732060358; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MVxPKrJOTfkDYQnrzAKeVJ4hyOvGkLEp2JX6Y9cJpwk=; b=EeWR4t0USDKd3zvNhmSJmPXjNzZidSrV4no4RnVjYq7QYdAkeQuzTuiy eyAi35NGhF8RJPSm6l6RKHGy0asMBfPxyQfIqOL5iqkupBMnDIClzfXE4 OME61f3+q8ZvMegLBJAFspKDAUbXPJvpDxyI6XAHQZnepDowMi2oDsYWB 9fNKamfGDofA+S5bsWJJjcOA9TBh/g5oawglKg6ZXztdhlaKNPWsJUjkc K6cr+vtGm73rb9+iKIFyP3szc/Me7uBagvgoWg4dh9EuzutB56k9ItPYp Q6b/7shqsYsBUY7I4pdYzReMg76/Bf3cYcn5MEf2ZtZq0coTZYr4BigdR g==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769756" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769756" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871365" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871365" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:37 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Benjamin Berg , Andrei Otcheretianski Subject: [PATCH 10/42] defs: Add WLAN_STATUS_DENIED_TX_LINK_NOT_ACCEPTED Date: Tue, 21 Nov 2023 01:51:24 +0200 Message-Id: <20231120235156.363852-11-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155239_027844_C2F77A23 X-CRM114-Status: UNSURE ( 9.21 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.4 (/) 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: Benjamin Berg As defined in IEEE802.11be D3.0. Signed-off-by: Benjamin Berg Signed-off-by: Andrei Otcheretianski --- src/common/ieee802_11_defs.h | 1 + 1 file changed, 1 insertion(+) Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Benjamin Berg As defined in IEEE802.11be D3.0. Signed-off-by: Benjamin Berg Signed-off-by: Andrei Otcheretianski --- src/common/ieee802_11_defs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h index 312b1bc0bf..c0f5ffec07 100644 --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h @@ -212,6 +212,7 @@ #define WLAN_STATUS_INVALID_PUBLIC_KEY 136 #define WLAN_STATUS_PASN_BASE_AKMP_FAILED 137 #define WLAN_STATUS_OCI_MISMATCH 138 +#define WLAN_STATUS_DENIED_TX_LINK_NOT_ACCEPTED 139 /* Reason codes (IEEE Std 802.11-2016, 9.4.1.7, Table 9-45) */ #define WLAN_REASON_UNSPECIFIED 1 From patchwork Mon Nov 20 23:51:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866365 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=UNGhf3A7; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=VxX4wbUJ; 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 4SZ48Y4xSHz1ySN for ; Tue, 21 Nov 2023 10:53:33 +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=HygmB9RaVsIpplPFKQQQHPaBioHJYWTqxf1W0tJkpA0=; b=UNGhf3A7tS1liQ FRvCGp3Dpel1NOf0YRvm+V1BsqsK0eiHLutSaTznGzC6AQFGHVdrAUg151p8+YYVXLd3kfHW/vJKg rnnBGOOpUjXefDJ+0UD7iI32gfL+wvs6rXPokbYnXBnLFjk0OU5KDnnbEvs1uVQaMQngwUZKZLpnV P8RLlspcPJcufqcNhU0/nacTdkyv11PYfzxaJ0+Xh7l74OrfLRvGoGbYgLZPVDWGRvnIzvoXOKYfT 9yi3EZMHZ3XGdfpRKoZQK09PFG++EdJxwsTkUGVkDSdrDhorqzSidsgo9hMQy33dnpQrG9OH13ZtU F6G9VM765XfNLQ9/+cRQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4S-00F5lW-0T; Mon, 20 Nov 2023 23:52:52 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4G-00F5eM-1w for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:52:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524360; x=1732060360; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EREWZvspWp4KldblFbf53D3xwz8CiEZPdkSHmWsjJLo=; b=VxX4wbUJHHhJjq5Cf56JafMga0Tyq/Ij+/lHnHz+n6YVLnpHwQjP3/z6 ZkmpBI/91HJ9teeJGKvCTpIHWcWXkXR7VU/Hk/F9VuZ9o9wtbOkpccQO3 Fba+4769/dPCHo6lvGnwwnOY0ojBtFj7JzzKzrTTeSfx4a0bHCSUYMJHa ftiF1wVo1p6xJm8PyYwc5cm3enwWKwyVFCWfr35+EEdPePCjoD0836JU0 rzZhtohEoimcblaNOPCdpThgAhNBwL2CfgyK6XL8x9lkzvsOPYDR2BLZH Qj56A+FaTdpo28b51+TSpdWZ1YlGdUmIpQrf7KqEWxLOuTG2N9NNcOSqL Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769758" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769758" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871369" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871369" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:38 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Benjamin Berg , Andrei Otcheretianski Subject: [PATCH 11/42] MLD: Also mark links as failed after association failure Date: Tue, 21 Nov 2023 01:51:25 +0200 Message-Id: <20231120235156.363852-12-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155240_710729_5EF45DEC X-CRM114-Status: GOOD ( 26.36 ) X-Spam-Score: -0.4 (/) 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: Benjamin Berg Parse the link statuses out of ML assoc response. If the AP rejects ML association and marks the links as failed with a reason code other than TX_LINK_NOT_ACCEPTED, then also report these links to wpa [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Benjamin Berg Parse the link statuses out of ML assoc response. If the AP rejects ML association and marks the links as failed with a reason code other than TX_LINK_NOT_ACCEPTED, then also report these links to wpas_connection_failed and ignore them. Signed-off-by: Benjamin Berg Signed-off-by: Andrei Otcheretianski --- wpa_supplicant/events.c | 287 +++++++++++++++++++++++++++++- wpa_supplicant/sme.c | 40 +++-- wpa_supplicant/sme.h | 6 +- wpa_supplicant/wpa_supplicant.c | 12 +- wpa_supplicant/wpa_supplicant_i.h | 12 +- 5 files changed, 329 insertions(+), 28 deletions(-) diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index a0c8eb1c53..bd6630ea7e 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -3624,6 +3624,256 @@ static void wpas_fst_update_mb_assoc(struct wpa_supplicant *wpa_s, } +static unsigned int wpas_ml_parse_assoc(struct wpa_supplicant *wpa_s, + struct ieee802_11_elems *elems, + struct ml_sta_link_info *ml_info) +{ + struct wpabuf *mlbuf = NULL; + struct ieee80211_eht_ml *ml; + size_t ml_len; + struct eht_ml_basic_common_info *common_info; + const u8 *pos; + u16 eml_capa = 0, mld_capa = 0; + const u16 control = + host_to_le16(MULTI_LINK_CONTROL_TYPE_BASIC | + BASIC_MULTI_LINK_CTRL_PRES_LINK_ID | + BASIC_MULTI_LINK_CTRL_PRES_BSS_PARAM_CH_COUNT); + u8 expected_common_info_len = 9; + u32 i = 0; + u16 ml_control; + + if (!wpa_s->valid_links || !elems->basic_mle || !elems->basic_mle_len) + return 0; + + mlbuf = ieee802_11_defrag(elems->basic_mle, elems->basic_mle_len, true); + + if (!mlbuf) + return 0; + + ml = (struct ieee80211_eht_ml *)wpabuf_head(mlbuf); + ml_len = wpabuf_len(mlbuf); + + os_memset(ml_info, 0, sizeof(*ml_info) * MAX_NUM_MLD_LINKS); + + ml_control = le_to_host16(ml->ml_control); + + if ((ml_control & control) != control) { + wpa_printf(MSG_DEBUG, "MLD: Invalid presence BM=0x%x", + ml_control); + goto out; + } + + if (ml_control & BASIC_MULTI_LINK_CTRL_PRES_EML_CAPA) { + wpa_printf(MSG_DEBUG, "MLD: EML capabilities included"); + expected_common_info_len += 2; + } + + if (ml_control & BASIC_MULTI_LINK_CTRL_PRES_MLD_CAPA) { + wpa_printf(MSG_DEBUG, "MLD: MLD capabilities included"); + expected_common_info_len += 2; + } + + if (ml_control & BASIC_MULTI_LINK_CTRL_PRES_MSD_INFO) { + wpa_printf(MSG_DEBUG, + "MLD: unexpected: medium sync delay info present"); + expected_common_info_len += 2; + } + + if (ml_control & BASIC_MULTI_LINK_CTRL_PRES_AP_MLD_ID) { + wpa_printf(MSG_DEBUG, + "MLD: unexpected: MLD ID present"); + expected_common_info_len += 1; + } + + if (sizeof(*ml) + expected_common_info_len > ml_len) { + wpa_printf(MSG_DEBUG, + "MLD: not enough bytes for common info. ml_len=%zu", + ml_len); + goto out; + } + + common_info = (struct eht_ml_basic_common_info *)ml->variable; + if (common_info->len != expected_common_info_len) { + wpa_printf(MSG_DEBUG, + "MLD: invalid common info len=%u. expected=%u", + common_info->len, expected_common_info_len); + goto out; + } + + wpa_printf(MSG_DEBUG, "MLD: address: " MACSTR, + MAC2STR(common_info->mld_addr)); + + if (os_memcmp(wpa_s->ap_mld_addr, common_info->mld_addr, ETH_ALEN)) { + wpa_printf(MSG_DEBUG, "MLD: invalid MLD address"); + goto out; + } + + pos = common_info->variable; + + /* Store the information for the association link */ + ml_info[i].link_id = *(pos); + + /* skip the BSS Parameters change count */ + pos += 2; + + /* skip the medium synchronization delay information if present */ + if (ml_control & BASIC_MULTI_LINK_CTRL_PRES_MSD_INFO) + pos += 2; + + if (ml_control & BASIC_MULTI_LINK_CTRL_PRES_EML_CAPA) { + eml_capa = WPA_GET_LE16(pos); + pos += 2; + } + + if (ml_control & BASIC_MULTI_LINK_CTRL_PRES_MLD_CAPA) { + mld_capa = WPA_GET_LE16(pos); + pos += 2; + } + + wpa_printf(MSG_DEBUG, + "MLD: link_id=%u, eml=0x%x, mld=0x%x", + ml_info[i].link_id, eml_capa, mld_capa); + + pos += common_info->len - + (sizeof(*common_info) + pos - common_info->variable); + i++; + + ml_len -= sizeof(*ml) + common_info->len; + while (ml_len > 2 && i < MAX_NUM_MLD_LINKS) { + u8 sub_elem_len = *(pos + 1); + u8 sta_info_len; + u8 nstr_bitmap_len = 0; + u16 ctrl; + + wpa_printf(MSG_DEBUG, "MLD: sub element len=%u", + sub_elem_len); + + if (2 + sub_elem_len > (int)ml_len) { + wpa_printf(MSG_DEBUG, + "MLD: invalid link info len: %u %zu", + 2 + sub_elem_len, ml_len); + goto out; + } + + switch (*pos) { + case EHT_ML_SUB_ELEM_PER_STA_PROFILE: + break; + case EHT_ML_SUB_ELEM_FRAGMENT: + case EHT_ML_SUB_ELEM_VENDOR: + wpa_printf(MSG_DEBUG, + "MLD: skip %u sub element, len=%u", + *pos, sub_elem_len); + + pos += 2 + sub_elem_len; + ml_len -= 2 + sub_elem_len; + continue; + default: + wpa_printf(MSG_DEBUG, "MLD: invalid subelement ID=%u", + *pos); + goto out; + } + + /* skip the subelement ID and the length */ + pos += 2; + ml_len -= 2; + + /* get the station control field */ + ctrl = WPA_GET_LE16(pos); + + pos += 2; + ml_len -= 2; + + if (!(ctrl & EHT_PER_STA_CTRL_COMPLETE_PROFILE_MSK)) { + wpa_printf(MSG_DEBUG, + "MLD: per STA complete profile expected"); + goto out; + } + + if (!(ctrl & EHT_PER_STA_CTRL_MAC_ADDR_PRESENT_MSK)) { + wpa_printf(MSG_DEBUG, + "MLD: per STA MAC address not present"); + goto out; + } + + if (!(ctrl & EHT_PER_STA_CTRL_TSF_OFFSET_PRESENT_MSK)) { + wpa_printf(MSG_DEBUG, + "MLD: per STA TSF offset not present"); + goto out; + } + + if (!(ctrl & EHT_PER_STA_CTRL_BEACON_INTERVAL_PRESENT_MSK)) { + wpa_printf(MSG_DEBUG, + "MLD: beacon interval not present"); + goto out; + } + + if (!(ctrl & EHT_PER_STA_CTRL_DTIM_INFO_PRESENT_MSK)) { + wpa_printf(MSG_DEBUG, + "MLD: DTIM information not present"); + goto out; + } + + if (ctrl & EHT_PER_STA_CTRL_NSTR_LINK_PAIR_PRESENT_MSK) { + if (ctrl & EHT_PER_STA_CTRL_NSTR_BM_SIZE_MSK) + nstr_bitmap_len = 2; + else + nstr_bitmap_len = 1; + } + + if (!(ctrl & EHT_PER_STA_CTRL_BSS_PARAM_CNT_PRESENT_MSK)) { + wpa_printf(MSG_DEBUG, + "MLD: BSS params change count not present"); + goto out; + } + + sta_info_len = 1 + ETH_ALEN + 8 + 2 + 2 + 1 + nstr_bitmap_len; + + if (sta_info_len > ml_len || sta_info_len != *pos) { + wpa_printf(MSG_DEBUG, + "MLD: invalid sta info len=%u, len=%u", + sta_info_len, *pos); + goto out; + } + + /* get the link address */ + wpa_printf(MSG_DEBUG, + "MLD: link addr: " MACSTR " nstr BM len=%u", + MAC2STR(pos + 1), nstr_bitmap_len); + + ml_info[i].link_id = ctrl & EHT_PER_STA_CTRL_LINK_ID_MSK; + os_memcpy(ml_info[i].bssid, pos + 1, ETH_ALEN); + + pos += sta_info_len; + ml_len -= sta_info_len; + + wpa_printf(MSG_DEBUG, "MLD: sub_elem_len=%u, sta_info_len=%u", + sub_elem_len, sta_info_len); + + sub_elem_len -= sta_info_len + 2; + if (sub_elem_len >= 4) { + wpa_hexdump(MSG_MSGDUMP, "MLD: sta profile", pos, + sub_elem_len); + ml_info[i].status = WPA_GET_LE16(pos + 2); + + pos += sub_elem_len; + ml_len -= sub_elem_len; + } else { + wpa_printf(MSG_DEBUG, + "MLD: per sta profile too short"); + goto out; + } + + i++; + } + + wpabuf_free(mlbuf); + return i; +out: + wpabuf_free(mlbuf); + return 0; +} + + static int wpa_drv_get_mlo_info(struct wpa_supplicant *wpa_s) { struct driver_sta_mlo_info mlo; @@ -4221,7 +4471,7 @@ static void wpa_supplicant_event_disassoc_finish(struct wpa_supplicant *wpa_s, if (is_zero_ether_addr(bssid)) bssid = wpa_s->pending_bssid; if (wpa_s->wpa_state >= WPA_AUTHENTICATING) - wpas_connection_failed(wpa_s, bssid); + wpas_connection_failed(wpa_s, bssid, NULL); wpa_sm_notify_disassoc(wpa_s->wpa); ptksa_cache_flush(wpa_s->ptksa, wpa_s->bssid, WPA_CIPHER_NONE); @@ -5236,6 +5486,10 @@ static void wpas_event_assoc_reject(struct wpa_supplicant *wpa_s, union wpa_event_data *data) { const u8 *bssid = data->assoc_reject.bssid; + struct ieee802_11_elems elems; + struct ml_sta_link_info ml_info[MAX_NUM_MLD_LINKS]; + const u8 *link_bssids[MAX_NUM_MLD_LINKS]; + u8 n_links, i, idx; #ifdef CONFIG_MBO struct wpa_bss *reject_bss; #endif /* CONFIG_MBO */ @@ -5290,7 +5544,7 @@ static void wpas_event_assoc_reject(struct wpa_supplicant *wpa_s, if (!bss) { bss = wpa_supplicant_get_new_bss(wpa_s, bssid); if (!bss) { - wpas_connection_failed(wpa_s, bssid); + wpas_connection_failed(wpa_s, bssid, NULL); wpa_supplicant_mark_disassoc(wpa_s); return; } @@ -5325,7 +5579,7 @@ static void wpas_event_assoc_reject(struct wpa_supplicant *wpa_s, if (!bss || wpa_s->dpp_pfs_fallback) { wpa_printf(MSG_DEBUG, "DPP: Updated PFS policy for next try"); - wpas_connection_failed(wpa_s, bssid); + wpas_connection_failed(wpa_s, bssid, NULL); wpa_supplicant_mark_disassoc(wpa_s); return; } @@ -5362,8 +5616,31 @@ static void wpas_event_assoc_reject(struct wpa_supplicant *wpa_s, } #endif /* CONFIG_MBO */ + /* Check for other failed links in the response */ + os_memset(link_bssids, 0, sizeof(link_bssids)); + idx = 0; + if (ieee802_11_parse_elems(data->assoc_reject.resp_ies, + data->assoc_reject.resp_ies_len, + &elems, 1) != ParseFailed) { + n_links = wpas_ml_parse_assoc(wpa_s, &elems, ml_info); + + for (i = 1; i < n_links; i++) { + /* The status cannot be success here. + * Add the link to the failed list if it is reporting + * an error. The only valid "non-error" status is + * TX_LINK_NOT_ACCEPTED as that means this link may + * still accept an association from us. + */ + if (ml_info[i].status != + WLAN_STATUS_DENIED_TX_LINK_NOT_ACCEPTED) { + link_bssids[idx] = ml_info[i].bssid; + idx++; + } + } + } + if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) { - sme_event_assoc_reject(wpa_s, data); + sme_event_assoc_reject(wpa_s, data, link_bssids); return; } @@ -5400,7 +5677,7 @@ static void wpas_event_assoc_reject(struct wpa_supplicant *wpa_s, } #endif /* CONFIG_FILS */ - wpas_connection_failed(wpa_s, bssid); + wpas_connection_failed(wpa_s, bssid, link_bssids); wpa_supplicant_mark_disassoc(wpa_s); } diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index 95d1858800..b4fe088149 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -1022,7 +1022,7 @@ static void sme_send_authentication(struct wpa_supplicant *wpa_s, else resp = sme_auth_build_sae_confirm(wpa_s, 0); if (resp == NULL) { - wpas_connection_failed(wpa_s, bss->bssid); + wpas_connection_failed(wpa_s, bss->bssid, NULL); return; } params.auth_data = wpabuf_head(resp); @@ -1158,7 +1158,7 @@ no_fils: if (wpas_p2p_handle_frequency_conflicts(wpa_s, params.freq, ssid) < 0) { - wpas_connection_failed(wpa_s, bss->bssid); + wpas_connection_failed(wpa_s, bss->bssid, NULL); wpa_supplicant_mark_disassoc(wpa_s); wpabuf_free(resp); wpas_connect_work_done(wpa_s); @@ -1181,7 +1181,7 @@ no_fils: if (wpa_drv_authenticate(wpa_s, ¶ms) < 0) { wpa_msg(wpa_s, MSG_INFO, "SME: Authentication request to the " "driver failed"); - wpas_connection_failed(wpa_s, bss->bssid); + wpas_connection_failed(wpa_s, bss->bssid, NULL); wpa_supplicant_mark_disassoc(wpa_s); wpabuf_free(resp); wpas_connect_work_done(wpa_s); @@ -2003,7 +2003,8 @@ void sme_event_auth(struct wpa_supplicant *wpa_s, union wpa_event_data *data) data->auth.ies_len, 0, data->auth.peer, &ie_offset); if (res < 0) { - wpas_connection_failed(wpa_s, wpa_s->pending_bssid); + wpas_connection_failed(wpa_s, wpa_s->pending_bssid, + NULL); wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); } @@ -2047,7 +2048,8 @@ void sme_event_auth(struct wpa_supplicant *wpa_s, union wpa_event_data *data) WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG || wpa_s->sme.auth_alg == data->auth.auth_type || wpa_s->current_ssid->auth_alg == WPA_AUTH_ALG_LEAP) { - wpas_connection_failed(wpa_s, wpa_s->pending_bssid); + wpas_connection_failed(wpa_s, wpa_s->pending_bssid, + NULL); wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); return; } @@ -2096,7 +2098,8 @@ void sme_event_auth(struct wpa_supplicant *wpa_s, union wpa_event_data *data) " reason=%d locally_generated=1", MAC2STR(wpa_s->pending_bssid), WLAN_REASON_DEAUTH_LEAVING); - wpas_connection_failed(wpa_s, wpa_s->pending_bssid); + wpas_connection_failed(wpa_s, wpa_s->pending_bssid, + NULL); wpa_supplicant_mark_disassoc(wpa_s); return; } @@ -2120,7 +2123,8 @@ void sme_event_auth(struct wpa_supplicant *wpa_s, union wpa_event_data *data) " reason=%d locally_generated=1", MAC2STR(wpa_s->pending_bssid), WLAN_REASON_DEAUTH_LEAVING); - wpas_connection_failed(wpa_s, wpa_s->pending_bssid); + wpas_connection_failed(wpa_s, wpa_s->pending_bssid, + NULL); wpa_supplicant_mark_disassoc(wpa_s); return; } @@ -2134,7 +2138,8 @@ void sme_event_auth(struct wpa_supplicant *wpa_s, union wpa_event_data *data) " reason=%d locally_generated=1", MAC2STR(wpa_s->pending_bssid), WLAN_REASON_DEAUTH_LEAVING); - wpas_connection_failed(wpa_s, wpa_s->pending_bssid); + wpas_connection_failed(wpa_s, wpa_s->pending_bssid, + NULL); wpa_supplicant_mark_disassoc(wpa_s); return; } @@ -2592,7 +2597,7 @@ mscs_fail: if (wpa_drv_associate(wpa_s, ¶ms) < 0) { wpa_msg(wpa_s, MSG_INFO, "SME: Association request to the " "driver failed"); - wpas_connection_failed(wpa_s, wpa_s->pending_bssid); + wpas_connection_failed(wpa_s, wpa_s->pending_bssid, NULL); wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); os_memset(wpa_s->pending_bssid, 0, ETH_ALEN); return; @@ -2634,7 +2639,7 @@ int sme_update_ft_ies(struct wpa_supplicant *wpa_s, const u8 *md, } -static void sme_deauth(struct wpa_supplicant *wpa_s) +static void sme_deauth(struct wpa_supplicant *wpa_s, const u8 **link_bssids) { int bssid_changed; @@ -2647,7 +2652,7 @@ static void sme_deauth(struct wpa_supplicant *wpa_s) } wpa_s->sme.prev_bssid_set = 0; - wpas_connection_failed(wpa_s, wpa_s->pending_bssid); + wpas_connection_failed(wpa_s, wpa_s->pending_bssid, link_bssids); wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); os_memset(wpa_s->bssid, 0, ETH_ALEN); os_memset(wpa_s->pending_bssid, 0, ETH_ALEN); @@ -2657,7 +2662,8 @@ static void sme_deauth(struct wpa_supplicant *wpa_s) void sme_event_assoc_reject(struct wpa_supplicant *wpa_s, - union wpa_event_data *data) + union wpa_event_data *data, + const u8 **link_bssids) { wpa_dbg(wpa_s, MSG_DEBUG, "SME: Association with " MACSTR " failed: " "status code %d", MAC2STR(wpa_s->pending_bssid), @@ -2721,7 +2727,7 @@ void sme_event_assoc_reject(struct wpa_supplicant *wpa_s, * benefit from using the previous authentication, so this could be * optimized in the future. */ - sme_deauth(wpa_s); + sme_deauth(wpa_s, link_bssids); } @@ -2729,7 +2735,7 @@ void sme_event_auth_timed_out(struct wpa_supplicant *wpa_s, union wpa_event_data *data) { wpa_dbg(wpa_s, MSG_DEBUG, "SME: Authentication timed out"); - wpas_connection_failed(wpa_s, wpa_s->pending_bssid); + wpas_connection_failed(wpa_s, wpa_s->pending_bssid, NULL); wpa_supplicant_mark_disassoc(wpa_s); } @@ -2738,7 +2744,7 @@ void sme_event_assoc_timed_out(struct wpa_supplicant *wpa_s, union wpa_event_data *data) { wpa_dbg(wpa_s, MSG_DEBUG, "SME: Association timed out"); - wpas_connection_failed(wpa_s, wpa_s->pending_bssid); + wpas_connection_failed(wpa_s, wpa_s->pending_bssid, NULL); wpa_supplicant_mark_disassoc(wpa_s); } @@ -2767,7 +2773,7 @@ static void sme_auth_timer(void *eloop_ctx, void *timeout_ctx) struct wpa_supplicant *wpa_s = eloop_ctx; if (wpa_s->wpa_state == WPA_AUTHENTICATING) { wpa_msg(wpa_s, MSG_DEBUG, "SME: Authentication timeout"); - sme_deauth(wpa_s); + sme_deauth(wpa_s, NULL); } } @@ -2777,7 +2783,7 @@ static void sme_assoc_timer(void *eloop_ctx, void *timeout_ctx) struct wpa_supplicant *wpa_s = eloop_ctx; if (wpa_s->wpa_state == WPA_ASSOCIATING) { wpa_msg(wpa_s, MSG_DEBUG, "SME: Association timeout"); - sme_deauth(wpa_s); + sme_deauth(wpa_s, NULL); } } diff --git a/wpa_supplicant/sme.h b/wpa_supplicant/sme.h index 50524d1318..f8fd06b95f 100644 --- a/wpa_supplicant/sme.h +++ b/wpa_supplicant/sme.h @@ -19,7 +19,8 @@ void sme_event_auth(struct wpa_supplicant *wpa_s, union wpa_event_data *data); int sme_update_ft_ies(struct wpa_supplicant *wpa_s, const u8 *md, const u8 *ies, size_t ies_len); void sme_event_assoc_reject(struct wpa_supplicant *wpa_s, - union wpa_event_data *data); + union wpa_event_data *data, + const u8 **link_bssids); void sme_event_auth_timed_out(struct wpa_supplicant *wpa_s, union wpa_event_data *data); void sme_event_assoc_timed_out(struct wpa_supplicant *wpa_s, @@ -63,7 +64,8 @@ static inline int sme_update_ft_ies(struct wpa_supplicant *wpa_s, const u8 *md, static inline void sme_event_assoc_reject(struct wpa_supplicant *wpa_s, - union wpa_event_data *data) + union wpa_event_data *data, + const u8 **link_bssids) { } diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index a292f05da8..c4c77e1810 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -4420,7 +4420,8 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit) * can stop right here; the association will not * succeed. */ - wpas_connection_failed(wpa_s, wpa_s->pending_bssid); + wpas_connection_failed(wpa_s, wpa_s->pending_bssid, + NULL); wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); os_memset(wpa_s->pending_bssid, 0, ETH_ALEN); return; @@ -8169,7 +8170,8 @@ static int * get_bss_freqs_in_ess(struct wpa_supplicant *wpa_s) } -void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid) +void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid, + const u8 **link_bssids) { int timeout; int count; @@ -8199,6 +8201,12 @@ void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid) return; } + /* Also mark links as failed */ + while (link_bssids && *link_bssids) { + wpa_bssid_ignore_add(wpa_s, *link_bssids); + link_bssids++; + } + /* * Add the failed BSSID into the ignore list and speed up next scan * attempt if there could be other APs that could accept association. diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index c3c766bbf9..35a9c0c9e0 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -661,6 +661,13 @@ struct active_scs_elem { }; +struct ml_sta_link_info { + u8 link_id; + u8 bssid[ETH_ALEN]; + u16 status; +}; + + /** * struct wpa_supplicant - Internal data for wpa_supplicant interface * @@ -723,7 +730,7 @@ struct wpa_supplicant { u8 ap_mld_addr[ETH_ALEN]; u8 mlo_assoc_link_id; u16 valid_links; /* bitmap of valid MLO link IDs */ - struct ml_sta_link_info { + struct { u8 addr[ETH_ALEN]; u8 bssid[ETH_ALEN]; unsigned int freq; @@ -1688,7 +1695,8 @@ void wpa_supplicant_rx_eapol(void *ctx, const u8 *own_addr, enum frame_encryption encrypted); void wpa_supplicant_update_config(struct wpa_supplicant *wpa_s); void wpa_supplicant_clear_status(struct wpa_supplicant *wpa_s); -void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid); +void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid, + const u8 **link_bssids); void fils_connection_failure(struct wpa_supplicant *wpa_s); void fils_pmksa_cache_flush(struct wpa_supplicant *wpa_s); int wpas_driver_bss_selection(struct wpa_supplicant *wpa_s); From patchwork Mon Nov 20 23:51:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866361 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=zpE/BsgC; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=V95p82UC; 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 4SZ48S2K0rz1ySf for ; Tue, 21 Nov 2023 10:53:28 +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=2O5Hvwltbcz1tpjUs+lnxh2kTu9ODQJsOU/p8YguAsg=; b=zpE/BsgCdxDP61 kVNn3KVkoa1U8MmeniJPrwrP9kFEl/pdUP1oZq0Ex16lL24tDFPwPaaJ7QHmT1Ook03Q9T9rUw456 BqjTQv9TJrWeKdvyg4ML8a0AHrBq9nD8fMOi9S/D3Srlm2EhuMnBKgRkXM9h+ogtnLshWzkkZhSnu Y4Y2mzFqsZP4ZYTYC1WTph7QbyACMZlO33/Kwww5Bj+2D/ZM3rWQ/eEPNEdRjohW/Y5Gi7rXmw5T8 klT1AM5qj3iGSQVJuNs1S+GRmfEKdKWvV4YHS+7FCBsFh0lo8g1Wyj9QexgenBYEUUR0DxY9aYXE7 8ObvhnE/F73Ku5LgtbFw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4Q-00F5kU-2D; Mon, 20 Nov 2023 23:52:50 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4H-00F5eO-24 for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:52:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524361; x=1732060361; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1jfZa/mP1YOgzEoCagYdhR7/iWy2iur54bLjD38RICc=; b=V95p82UCcsGDOtyjjk8yG71YAIUMKSGmHsm/VN97gSj3Hf4dG8ZX9Ha+ Uug0KpWTtcOTjE5bf83OaAv1rcQoZKiHK7FrDFjOwWAizlvHxYNjCxnJy Bkwn2b1blG8Qfbzhq7upPh3OcfHthAy6pc4qvklqUZT+KzMS7kE98MXgh dnBCXXCDfW+A/giUWx4q9Nnvq0ek7k1UCXTYaXFkVbjPx8I7LxkCNJ/70 glCfXOK8t4V9EoJZPzNhlwWZB2mVWvsQFErAHsuKerUY3E0cnGzbwgLVV KuMAAzmHpnWB05ToQxyxuXZLUf6/p3HRsF5Aoy9PA8xT9OersNvEdJFmK w==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769760" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769760" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871373" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871373" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:40 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Benjamin Berg , Andrei Otcheretianski Subject: [PATCH 12/42] MLD: Return status code for links when rejecting association Date: Tue, 21 Nov 2023 01:51:26 +0200 Message-Id: <20231120235156.363852-13-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155241_743888_8882D5D3 X-CRM114-Status: GOOD ( 14.22 ) X-Spam-Score: -0.4 (/) 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: Benjamin Berg When the TX link rejects the association, return a status code for all requested links. For simplicity, just return "TX link not accepted" so that clients may try to connect to other links. This could [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Benjamin Berg When the TX link rejects the association, return a status code for all requested links. For simplicity, just return "TX link not accepted" so that clients may try to connect to other links. This could be improved to explicitly reject each link if directly associating to the link will not work either. Also add a TEST_FAIL to fail one link in an MLD association. Signed-off-by: Benjamin Berg Signed-off-by: Andrei Otcheretianski --- src/ap/ieee802_11.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index 7de12284d9..85b02947a8 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -4500,7 +4500,7 @@ bool hostapd_is_mld_ap(struct hostapd_data *hapd) static void hostapd_process_assoc_ml_info(struct hostapd_data *hapd, struct sta_info *sta, const u8 *ies, size_t ies_len, - bool reassoc) + bool reassoc, int tx_link_status) { #ifdef CONFIG_IEEE80211BE unsigned int i, j; @@ -4536,7 +4536,8 @@ static void hostapd_process_assoc_ml_info(struct hostapd_data *hapd, break; } - if (!iface || j == hapd->iface->interfaces->count) { + if (!iface || j == hapd->iface->interfaces->count || + TEST_FAIL()) { wpa_printf(MSG_DEBUG, "MLD: No link match for link_id=%u", i); @@ -4546,6 +4547,14 @@ static void hostapd_process_assoc_ml_info(struct hostapd_data *hapd, hapd, link->status, link->resp_sta_profile, sizeof(link->resp_sta_profile)); + } else if (tx_link_status != WLAN_STATUS_SUCCESS) { + /* TX link rejected the connection */ + link->status = WLAN_STATUS_DENIED_TX_LINK_NOT_ACCEPTED; + link->resp_sta_profile_len = + ieee80211_ml_build_assoc_resp(hapd, + link->status, + link->resp_sta_profile, + sizeof(link->resp_sta_profile)); } else { ieee80211_ml_process_link(iface->bss[0], sta, link, ies, ies_len, reassoc); @@ -5500,8 +5509,7 @@ static void handle_assoc(struct hostapd_data *hapd, * issues with processing other non-Data Class 3 frames during this * window. */ - if (resp == WLAN_STATUS_SUCCESS) - hostapd_process_assoc_ml_info(hapd, sta, pos, left, reassoc); + hostapd_process_assoc_ml_info(hapd, sta, pos, left, reassoc, resp); if (resp == WLAN_STATUS_SUCCESS && sta && add_associated_sta(hapd, sta, reassoc)) From patchwork Mon Nov 20 23:51:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866364 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=DfaO+oJr; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Zc1qi+/A; 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 4SZ48V35Wpz1ySN for ; Tue, 21 Nov 2023 10:53:30 +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=U3VScZA8DQu72+WNPjsROneclh7iH9Aau94pU++FG7A=; b=DfaO+oJrj0PZe1 OolhOntV/zhlwTPFXOD2WdspR0uipxF/glzxBfvKgEGK5AfvRqzJGkdSFvZWy2nsfGi0EiqbrWu9K wdCtti4eYhYrJQB7XNVFayo8KWPzCgCFRorNsM9F7CoIYcR49K350qk2hQvoURImkv9qRYdfuUshu O4L+03AqP/YI7vxNlPKMcKquxRiEFO3KC6tx1m22BTuBMTBawsSAmviVAG4DUvLKuyKWuX0ZAjTrT AO7ZyqSwDDHB6wiEGROm4dFQrzL8uh4wrTR8N+SjFue4dFO9SX6CcE0G0Z3UdMvxtoyd4Nrjn4UXI VUUlVotRDebhnitvZwVQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4V-00F5o0-0L; Mon, 20 Nov 2023 23:52:55 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4J-00F5fq-0a for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:52:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524363; x=1732060363; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YpmUUMyw/cQPDi1QNBSODU6eIqfjQcNHdrWKUWcZQHg=; b=Zc1qi+/AiW1HBI35Y4adCHz/DmAWiLE7DqzxFM8ewXZLRCRKxI3teAGx oQP/xFH64XXiq2hl9ROdmfBM+x2g3MpMklCVA664D2KLw0lewl50qqjl1 XodTOgqQKFgWSgTv7qnWm0noDF0Dn8iv9832Kmws1vh3fxsUH6imdXZlQ cibymIcO4QRjs1vPjeFmZNtRJhOoOfDdeKiPrMOQ6TyICFEfFgz/MfoCP lWxzUnS6e6LOb1+vYRnhE4F9OJLl/IS16xAOo4XyDR4Xc0WSImIeR4i4x cutcsAfPX8Q/kEd2FqWkolBV5jOM/Re7dodQe6LEoZatGQ0lPRxgrCeaR Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769762" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769762" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871377" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871377" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:41 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Benjamin Berg , Andrei Otcheretianski Subject: [PATCH 13/42] bss: do not consider ignored BSSs for links Date: Tue, 21 Nov 2023 01:51:27 +0200 Message-Id: <20231120235156.363852-14-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155243_265423_7AA22945 X-CRM114-Status: GOOD ( 14.01 ) X-Spam-Score: -0.4 (/) 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: Benjamin Berg This avoids e.g. trying to use a BSS that is rejected by mac80211 as a link, which could fail the connection as a whole. Note that this is not perfect. Ideally, the internal state would have a more context sensitive ignore flag so that one could still use a BSS as a link in some situation. Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Benjamin Berg This avoids e.g. trying to use a BSS that is rejected by mac80211 as a link, which could fail the connection as a whole. Note that this is not perfect. Ideally, the internal state would have a more context sensitive ignore flag so that one could still use a BSS as a link in some situation. Signed-off-by: Benjamin Berg Signed-off-by: Andrei Otcheretianski --- wpa_supplicant/bss.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c index 9f48da31b0..401df12fea 100644 --- a/wpa_supplicant/bss.c +++ b/wpa_supplicant/bss.c @@ -19,6 +19,7 @@ #include "scan.h" #include "bss.h" #include "rsn_supp/wpa.h" +#include "bssid_ignore.h" static void wpa_bss_set_hessid(struct wpa_bss *bss) { @@ -1534,13 +1535,16 @@ wpa_bss_parse_ml_rnr_ap_info(struct wpa_supplicant *wpa_s, wpa_printf(MSG_DEBUG, "MLD: mld ID=%u, link ID=%u", *mld_params, link_id); + if (!neigh_bss) { *missing |= BIT(link_id); - } else if (!ssid || - bss_params & RNR_BSS_PARAM_SAME_SSID || - bss_params & RNR_BSS_PARAM_CO_LOCATED || - wpa_scan_res_match(wpa_s, 0, neigh_bss, - ssid, 1, 0)) { + } else if ((!ssid || + bss_params & RNR_BSS_PARAM_SAME_SSID || + bss_params & RNR_BSS_PARAM_CO_LOCATED || + wpa_scan_res_match(wpa_s, 0, neigh_bss, + ssid, 1, 0)) && + !wpa_bssid_ignore_is_listed(wpa_s, + neigh_bss->bssid)) { struct mld_link *l; l = &bss->mld_links[bss->n_mld_links]; From patchwork Mon Nov 20 23:51:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866366 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=L3eSRV+q; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=OTtfqYoZ; 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 4SZ48Z4TjTz1ySS for ; Tue, 21 Nov 2023 10:53:34 +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=R4cVJc6VNpboxEQepiU6sgmn/voejcK39ptl7fLEakw=; b=L3eSRV+qYqmfhK CFHYnMKrmOyKgGAaxn/nUsRIYUI7Yg1Dzha+8R4wKvL8opCzCevvFfUTCyQKRlhbh/6Emv/Jx/+J+ VUkn0e4EWmW/2F8kqwLuyss49tTO7WRPAPcACFwTLZMYv6p3uIa/fzo9jCbs4w1zplLTcvN9Ajnsy MFWXd53BE/OboVgkonUKEv78mTcRVCsHniIFiTRPWhuizeInNO0wGvHhCQ1hsf+62FaX7Kn2lhbY4 WcnDArpzxVOkwAB2+s62I0BL2t3BEDIgmrAIqVQBnVAG2s+o1r9XD+L51EVf/8qBCkUWgdUemRuhm LczY4C7oeqPiWaDhGpbg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4X-00F5qD-1O; Mon, 20 Nov 2023 23:52:57 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4K-00F5ga-1T for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:52:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524364; x=1732060364; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dKGNtBmSgn7FWbn38ESH7vXG0n5HCKIXbKB4o48HItc=; b=OTtfqYoZBgLLhQ24BpY3yi7gNJ+awyRBNspYKVCvEV2Z+u3GV8i4mPCa MP2nW6TLl4oYaxUoQn30nhFyxmmXOt8YUqUeEDU6obFdjDfHsn2SPIoa4 8oYG7Olq6n4RaqrAUD1gZHhZAxt3FGXCmJRPFTQBwdu269UlRZiREvDTM ll6aA3q+n/EWzHsL+XFCJNtYbukVmlac2XMRe7n5ZwM1jNWTx1Yjq6MUs lBcK0xt/1D7EwRAMy6jUY8ErcK8w+mZVKmwOg5J8neSt3OjP86Ne6nM+K KwDMW+hIPZQqLChJa1tqP+iB41857S+SG2eyxvzQNNwMD/JkmV5v/13za A==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769765" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769765" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871382" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871382" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:42 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Benjamin Berg Subject: [PATCH 14/42] MLD: ignore failed links from association Date: Tue, 21 Nov 2023 01:51:28 +0200 Message-Id: <20231120235156.363852-15-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155244_534277_A8D48973 X-CRM114-Status: GOOD ( 16.90 ) X-Spam-Score: -0.4 (/) 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: Benjamin Berg If for some reason association fails and a link which has an error is reported, then add that specific link to the ignore list. After that, immediately retrigger the connection code. In the usual case [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Benjamin Berg If for some reason association fails and a link which has an error is reported, then add that specific link to the ignore list. After that, immediately retrigger the connection code. In the usual case, we are then going to reconnect to the same BSS but with that particular link not being included in the connection. Signed-off-by: Benjamin Berg --- src/drivers/driver.h | 1 + wpa_supplicant/sme.c | 33 ++++++++++++++++++++++++++++++--- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/drivers/driver.h b/src/drivers/driver.h index d7f4c599dd..d6c490d1c8 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -949,6 +949,7 @@ struct wpa_driver_mld_params { const u8 *bssid; const u8 *ies; size_t ies_len; + int error; } mld_links[MAX_NUM_MLD_LINKS]; }; diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index b4fe088149..f6f7e7fa75 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -28,6 +28,7 @@ #include "p2p_supplicant.h" #include "notify.h" #include "bss.h" +#include "bssid_ignore.h" #include "scan.h" #include "sme.h" #include "hs20_supplicant.h" @@ -2595,11 +2596,37 @@ mscs_fail: } if (wpa_drv_associate(wpa_s, ¶ms) < 0) { + u8 n_failed_links = 0; + int i; + wpa_msg(wpa_s, MSG_INFO, "SME: Association request to the " "driver failed"); - wpas_connection_failed(wpa_s, wpa_s->pending_bssid, NULL); - wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); - os_memset(wpa_s->pending_bssid, 0, ETH_ALEN); + + /* Prepare list of failed links for error report */ + for (i = 0; i < MAX_NUM_MLD_LINKS; i++) { + if (!(wpa_s->valid_links & BIT(i)) || + wpa_s->mlo_assoc_link_id == i || + !params.mld_params.mld_links[i].error) + continue; + + wpa_bssid_ignore_add(wpa_s, wpa_s->links[i].bssid); + n_failed_links += 1; + } + + if (n_failed_links) { + /* Deauth and connect (possibly to the same BSS) */ + wpa_drv_deauthenticate(wpa_s, + wpa_s->ap_mld_addr, + WLAN_REASON_DEAUTH_LEAVING); + wpas_connect_work_done(wpa_s); + wpa_supplicant_mark_disassoc(wpa_s); + wpas_request_connection(wpa_s); + } else { + wpas_connection_failed(wpa_s, wpa_s->pending_bssid, + NULL); + wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); + os_memset(wpa_s->pending_bssid, 0, ETH_ALEN); + } return; } From patchwork Mon Nov 20 23:51:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1867417 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=xgVB6+T/; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=ZjXm4VYB; 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 4Sb6MP4g6Wz1ySX for ; Thu, 23 Nov 2023 03:36:31 +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=L7ge0hnEkLtqR/V3nTXAP5nPZeQlf7LwJto/hvZxIsg=; b=xgVB6+T/u3Gd0w fn6EMVnHjSPojtS5gTOjgWrZR26CkV/XH4PPhCd3WjOR0jCoPEe+K7tcZMuXJ0VLaZs2afBkdDfjz uDXypoJLTGPDG0UrP5LjsK+P1hMQLgvKxiuG9Q1arDuO8//sXKdbmkdUW0Z5yZ7Ia6AkixWDz3yoV w9VpijrRjaTPGnDQBzi4yz6464VndIW/hPy4N3udWahkz+2zXVraaxg4MMnhODKFP6dpzL8qDxRw+ zD/DweSKvZ2xdETt90HaW56xGad5qAHJeSLpNYjxW/qjxhZzYSQgZgfCYOKqr2MrIairDghlIb/5D O67RZPdENu2oDlK0NcnQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5qCD-002Ul0-1x; Wed, 22 Nov 2023 16:35:25 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4M-00F5hg-0R for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:52:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524366; x=1732060366; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=l6dsGMhSlVvyVTd1+jU55CjXzhU30GvBOxzR7m7vWC8=; b=ZjXm4VYB9FzMndF/ye4DJ64kC0GyHB3JTaQhIJQL35bcpzu9HfC4Li0L rEcB9NafgwaIv3la+KapkxKdZp63+QgHAnKTDLLvknU2SiRhptY6NIYdL sFiy9SyCzXUPHeoYtwY4AEYTnlbDEK5cvmr0PTbMbsh5Nhm0gP5wDzT3i VBb6D/v8mEuxrynZ+2F+j7dnH3087+Xx1QobkYH54lBrfyM5TnuNYTzuu 9JnSnjR2tJmsv8+Mff5a59PfrQ1r9qzEdwT+r4tVzf4bdJvzdCCM5zUxO fuZi1BjRMR3yyzoIpEjSi2VnV44ZEGS2axQV2AU2lvd2ALFTDiJ1PvpYO Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769769" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769769" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871388" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871388" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:43 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Benjamin Berg , Andrei Otcheretianski Subject: [PATCH 15/42] nl80211: Add support to parse out link from error reply Date: Tue, 21 Nov 2023 01:51:29 +0200 Message-Id: <20231120235156.363852-16-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155246_339945_5FE3FC04 X-CRM114-Status: GOOD ( 23.49 ) X-Spam-Score: -0.4 (/) 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: Benjamin Berg The kernel may report the link that caused an error by setting NLMSGERR_ATTR_OFFS pointing to the NL80211_ATTR_MLO_LINKS element that was the reason for the error. Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender X-Mailman-Approved-At: Wed, 22 Nov 2023 08:35:23 -0800 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: Benjamin Berg The kernel may report the link that caused an error by setting NLMSGERR_ATTR_OFFS pointing to the NL80211_ATTR_MLO_LINKS element that was the reason for the error. Parse this information if the optional struct nl80211_err_info is passed to send_and_recv_msgs. Signed-off-by: Benjamin Berg Signed-off-by: Andrei Otcheretianski --- src/drivers/driver_nl80211.c | 301 ++++++++++++++++++------------ src/drivers/driver_nl80211.h | 7 +- src/drivers/driver_nl80211_capa.c | 13 +- src/drivers/driver_nl80211_scan.c | 21 ++- 4 files changed, 206 insertions(+), 136 deletions(-) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 229c78a6d2..5124a95e95 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -341,17 +341,26 @@ static int finish_handler(struct nl_msg *msg, void *arg) return NL_SKIP; } +struct nl80211_ack_err_args { + int err; + struct nl_msg *orig_msg; + struct nl80211_err_info *err_info; +}; + static int error_handler(struct sockaddr_nl *nla, struct nlmsgerr *err, void *arg) { + struct nl80211_ack_err_args *err_args = arg; struct nlmsghdr *nlh = (struct nlmsghdr *) err - 1; + struct nlmsghdr *orig_nlh = nlmsg_hdr(err_args->orig_msg); int len = nlh->nlmsg_len; struct nlattr *attrs; struct nlattr *tb[NLMSGERR_ATTR_MAX + 1]; - int *ret = arg; int ack_len = sizeof(*nlh) + sizeof(int) + sizeof(*nlh); - *ret = err->error; + err_args->err = err->error; + if (err_args->err_info) + err_args->err_info->link_id = -1; if (!(nlh->nlmsg_flags & NLM_F_ACK_TLVS)) return NL_SKIP; @@ -373,6 +382,43 @@ static int error_handler(struct sockaddr_nl *nla, struct nlmsgerr *err, len, (char *) nla_data(tb[NLMSGERR_ATTR_MSG])); } + if (!err_args->err_info) + return NL_SKIP; + + /* Check if it was a per-link error report */ + if (tb[NLMSGERR_ATTR_OFFS] && + os_memcmp(orig_nlh, &err->msg, sizeof(err->msg)) == 0) { + struct nlattr *mlo_links, *link_attr; + u32 offset = nla_get_u32(tb[NLMSGERR_ATTR_OFFS]); + int rem; + + mlo_links = nlmsg_find_attr(orig_nlh, GENL_HDRLEN, + NL80211_ATTR_MLO_LINKS); + if (!mlo_links) + return NL_SKIP; + + nla_for_each_nested(link_attr, mlo_links, rem) { + struct nlattr *link_id; + size_t link_offset = (void *)link_attr - (void *)orig_nlh; + + if (offset < link_offset || + offset >= link_offset + link_attr->nla_len) + continue; + + link_id = nla_find(nla_data(link_attr), + nla_len(link_attr), + NL80211_ATTR_MLO_LINK_ID); + if (link_id) { + err_args->err_info->link_id = + nla_get_u8(link_id); + wpa_printf(MSG_DEBUG, "nl80211: kernel reports error for link: %d", + err_args->err_info->link_id); + + break; + } + } + } + return NL_SKIP; } @@ -445,10 +491,12 @@ static int send_and_recv(struct nl80211_global *global, int (*valid_handler)(struct nl_msg *, void *), void *valid_data, int (*ack_handler_custom)(struct nl_msg *, void *), - void *ack_data) + void *ack_data, + struct nl80211_err_info *err_info) { struct nl_cb *cb; - int err = -ENOMEM, opt; + struct nl80211_ack_err_args err; + int opt; if (!msg) return -ENOMEM; @@ -467,26 +515,28 @@ static int send_and_recv(struct nl80211_global *global, setsockopt(nl_socket_get_fd(nl_handle), SOL_NETLINK, NETLINK_CAP_ACK, &opt, sizeof(opt)); - err = nl_send_auto_complete(nl_handle, msg); - if (err < 0) { + err.err = nl_send_auto_complete(nl_handle, msg); + if (err.err < 0) { wpa_printf(MSG_INFO, "nl80211: nl_send_auto_complete() failed: %s", - nl_geterror(err)); + nl_geterror(err.err)); /* Need to convert libnl error code to an errno value. For now, * just hardcode this to EBADF; the real error reason is shown * in that error print above. */ - err = -EBADF; + err.err = -EBADF; goto out; } - err = 1; + err.err = 1; + err.orig_msg = msg; + err.err_info = err_info; nl_cb_err(cb, NL_CB_CUSTOM, error_handler, &err); - nl_cb_set(cb, NL_CB_FINISH, NL_CB_CUSTOM, finish_handler, &err); + nl_cb_set(cb, NL_CB_FINISH, NL_CB_CUSTOM, finish_handler, &err.err); if (ack_handler_custom) { struct nl80211_ack_ext_arg *ext_arg = ack_data; - ext_arg->err = &err; + ext_arg->err = &err.err; nl_cb_set(cb, NL_CB_ACK, NL_CB_CUSTOM, ack_handler_custom, ack_data); } else { @@ -497,7 +547,7 @@ static int send_and_recv(struct nl80211_global *global, nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, valid_handler, valid_data); - while (err > 0) { + while (err.err > 0) { int res = nl_recvmsgs(nl_handle, cb); if (res == -NLE_DUMP_INTR) { @@ -512,7 +562,7 @@ static int send_and_recv(struct nl80211_global *global, * will stop and return an error. */ wpa_printf(MSG_DEBUG, "nl80211: %s; convert to -EAGAIN", nl_geterror(res)); - err = -EAGAIN; + err.err = -EAGAIN; } else if (res < 0) { wpa_printf(MSG_INFO, "nl80211: %s->nl_recvmsgs failed: %d (%s)", @@ -524,7 +574,7 @@ static int send_and_recv(struct nl80211_global *global, /* Always clear the message as it can potentially contain keys */ nl80211_nlmsg_clear(msg); nlmsg_free(msg); - return err; + return err.err; } @@ -533,11 +583,12 @@ int send_and_recv_msgs(struct wpa_driver_nl80211_data *drv, int (*valid_handler)(struct nl_msg *, void *), void *valid_data, int (*ack_handler_custom)(struct nl_msg *, void *), - void *ack_data) + void *ack_data, + struct nl80211_err_info *err_info) { return send_and_recv(drv->global, drv->global->nl, msg, valid_handler, valid_data, - ack_handler_custom, ack_data); + ack_handler_custom, ack_data, err_info); } @@ -554,7 +605,8 @@ static int send_and_recv_msgs_owner(struct wpa_driver_nl80211_data *drv, void *valid_data, int (*ack_handler_custom)(struct nl_msg *, void *), - void *ack_data) + void *ack_data, + struct nl80211_err_info *err_info) { if (!msg) return -ENOMEM; @@ -580,23 +632,24 @@ static int send_and_recv_msgs_owner(struct wpa_driver_nl80211_data *drv, return send_and_recv(drv->global, handle ? handle : drv->global->nl, msg, valid_handler, valid_data, - ack_handler_custom, ack_data); + ack_handler_custom, ack_data, err_info); } - static int send_and_recv_msgs_connect_handle(struct wpa_driver_nl80211_data *drv, struct nl_msg *msg, struct i802_bss *bss, - int set_owner) + int set_owner, + struct nl80211_err_info *err_info) { struct nl_sock *nl_connect = get_connect_handle(bss); if (nl_connect) return send_and_recv_msgs_owner(drv, msg, nl_connect, set_owner, process_bss_event, bss, NULL, - NULL); + NULL, err_info); else - return send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + return send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, + err_info); } @@ -665,7 +718,7 @@ static int nl_get_multicast_id(struct nl80211_global *global, } ret = send_and_recv(global, global->nl, msg, family_handler, &res, - NULL, NULL); + NULL, NULL, NULL); if (ret == 0) ret = res.id; return ret; @@ -794,7 +847,7 @@ int nl80211_get_wiphy_index(struct i802_bss *bss) return -1; if (send_and_recv_msgs(bss->drv, msg, netdev_info_handler, &data, - NULL, NULL) == 0) + NULL, NULL, NULL) == 0) return data.wiphy_idx; return -1; } @@ -812,7 +865,7 @@ static enum nl80211_iftype nl80211_get_ifmode(struct i802_bss *bss) return NL80211_IFTYPE_UNSPECIFIED; if (send_and_recv_msgs(bss->drv, msg, netdev_info_handler, &data, - NULL, NULL) == 0) + NULL, NULL, NULL) == 0) return data.nlmode; return NL80211_IFTYPE_UNSPECIFIED; } @@ -829,7 +882,7 @@ static int nl80211_get_macaddr(struct i802_bss *bss) return -1; return send_and_recv_msgs(bss->drv, msg, netdev_info_handler, &data, - NULL, NULL); + NULL, NULL, NULL); } @@ -842,7 +895,7 @@ static int nl80211_get_4addr(struct i802_bss *bss) if (!(msg = nl80211_cmd_msg(bss, 0, NL80211_CMD_GET_INTERFACE)) || send_and_recv_msgs(bss->drv, msg, netdev_info_handler, &data, - NULL, NULL)) + NULL, NULL, NULL)) return -1; return data.use_4addr; } @@ -865,7 +918,7 @@ static int nl80211_register_beacons(struct wpa_driver_nl80211_data *drv, } ret = send_and_recv(drv->global, w->nl_beacons, msg, NULL, NULL, - NULL, NULL); + NULL, NULL, NULL); if (ret) { wpa_printf(MSG_DEBUG, "nl80211: Register beacons command " "failed: ret=%d (%s)", @@ -1123,7 +1176,7 @@ static int nl80211_get_sta_mlo_info(void *priv, msg = nl80211_drv_msg(drv, 0, NL80211_CMD_GET_INTERFACE); if (send_and_recv_msgs(drv, msg, get_mlo_info, - &drv->sta_mlo_info, NULL, NULL)) + &drv->sta_mlo_info, NULL, NULL, NULL)) return -1; } @@ -1666,7 +1719,7 @@ try_again: os_memset(&arg, 0, sizeof(arg)); arg.drv = drv; ret = send_and_recv_msgs(drv, msg, nl80211_get_assoc_freq_handler, - &arg, NULL, NULL); + &arg, NULL, NULL, NULL); if (ret == -EAGAIN) { count++; if (count >= 10) { @@ -1700,7 +1753,7 @@ try_again: os_memset(&arg, 0, sizeof(arg)); arg.drv = drv; ret = send_and_recv_msgs(drv, msg, nl80211_get_assoc_freq_handler, - &arg, NULL, NULL); + &arg, NULL, NULL, NULL); if (ret == -EAGAIN) { count++; if (count >= 10) { @@ -1789,7 +1842,7 @@ int nl80211_get_link_noise(struct wpa_driver_nl80211_data *drv, msg = nl80211_drv_msg(drv, NLM_F_DUMP, NL80211_CMD_GET_SURVEY); return send_and_recv_msgs(drv, msg, get_link_noise, sig_change, - NULL, NULL); + NULL, NULL, NULL); } @@ -1853,7 +1906,8 @@ static int nl80211_channel_info(void *priv, struct wpa_channel_info *ci) struct nl_msg *msg; msg = nl80211_drv_msg(drv, 0, NL80211_CMD_GET_INTERFACE); - return send_and_recv_msgs(drv, msg, get_channel_info, ci, NULL, NULL); + return send_and_recv_msgs(drv, msg, get_channel_info, ci, NULL, NULL, + NULL); } @@ -1902,7 +1956,7 @@ static int wpa_driver_nl80211_set_country(void *priv, const char *alpha2_arg) nlmsg_free(msg); return -EINVAL; } - if (send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL)) + if (send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL)) return -EINVAL; return 0; } @@ -1949,7 +2003,7 @@ static int wpa_driver_nl80211_get_country(void *priv, char *alpha2) alpha2[0] = '\0'; ret = send_and_recv_msgs(drv, msg, nl80211_get_country, alpha2, - NULL, NULL); + NULL, NULL, NULL); if (!alpha2[0]) ret = -1; @@ -2418,7 +2472,7 @@ static int nl80211_register_frame(struct i802_bss *bss, } ret = send_and_recv(drv->global, nl_handle, msg, NULL, NULL, - NULL, NULL); + NULL, NULL, NULL); if (ret) { wpa_printf(MSG_DEBUG, "nl80211: Register frame command " "failed (type=%u): ret=%d (%s)", @@ -2679,7 +2733,7 @@ static int nl80211_register_spurious_class3(struct i802_bss *bss) msg = nl80211_bss_msg(bss, 0, NL80211_CMD_UNEXPECTED_FRAME); ret = send_and_recv(bss->drv->global, bss->nl_mgmt, msg, NULL, NULL, - NULL, NULL); + NULL, NULL, NULL); if (ret) { wpa_printf(MSG_DEBUG, "nl80211: Register spurious class3 " "failed: ret=%d (%s)", @@ -2833,7 +2887,7 @@ static void nl80211_del_p2pdev(struct i802_bss *bss) int ret; msg = nl80211_cmd_msg(bss, 0, NL80211_CMD_DEL_INTERFACE); - ret = send_and_recv_msgs(bss->drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(bss->drv, msg, NULL, NULL, NULL, NULL, NULL); wpa_printf(MSG_DEBUG, "nl80211: Delete P2P Device %s (0x%llx): %s", bss->ifname, (long long unsigned int) bss->wdev_id, @@ -2848,7 +2902,7 @@ static int nl80211_set_p2pdev(struct i802_bss *bss, int start) msg = nl80211_cmd_msg(bss, 0, start ? NL80211_CMD_START_P2P_DEVICE : NL80211_CMD_STOP_P2P_DEVICE); - ret = send_and_recv_msgs(bss->drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(bss->drv, msg, NULL, NULL, NULL, NULL, NULL); wpa_printf(MSG_DEBUG, "nl80211: %s P2P Device %s (0x%llx): %s", start ? "Start" : "Stop", @@ -2920,7 +2974,7 @@ static void qca_vendor_test(struct wpa_driver_nl80211_data *drv) nla_nest_end(msg, params); ret = send_and_recv_msgs(drv, msg, qca_vendor_test_cmd_handler, drv, - NULL, NULL); + NULL, NULL, NULL); wpa_printf(MSG_DEBUG, "nl80211: QCA vendor test command returned %d (%s)", ret, strerror(-ret)); @@ -3067,7 +3121,7 @@ static int wpa_driver_nl80211_del_beacon(struct i802_bss *bss, } } - return send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + return send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); } @@ -3345,7 +3399,7 @@ static int issue_key_mgmt_set_key(struct wpa_driver_nl80211_data *drv, nlmsg_free(msg); return -1; } - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); if (ret) { wpa_printf(MSG_DEBUG, "nl80211: Key management set key failed: ret=%d (%s)", @@ -3385,7 +3439,7 @@ static int nl80211_set_pmk(struct wpa_driver_nl80211_data *drv, return -ENOBUFS; } - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); if (ret) { wpa_printf(MSG_DEBUG, "nl80211: Set PMK failed: ret=%d (%s)", ret, strerror(-ret)); @@ -3559,7 +3613,7 @@ static int wpa_driver_nl80211_set_key(struct i802_bss *bss, goto fail; } - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); if ((ret == -ENOENT || ret == -ENOLINK) && alg == WPA_ALG_NONE) ret = 0; if (ret) @@ -3628,7 +3682,7 @@ static int wpa_driver_nl80211_set_key(struct i802_bss *bss, goto fail; } - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); if (ret) wpa_printf(MSG_DEBUG, "nl80211: set_key default failed; err=%d %s", @@ -3754,9 +3808,10 @@ int wpa_driver_nl80211_mlme(struct wpa_driver_nl80211_data *drv, if (nl_connect) ret = send_and_recv(drv->global, nl_connect, msg, - process_bss_event, bss, NULL, NULL); + process_bss_event, bss, NULL, NULL, NULL); else - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, + NULL); if (ret) { wpa_dbg(drv->ctx, MSG_DEBUG, "nl80211: MLME command failed: reason=%u ret=%d (%s)", @@ -4034,7 +4089,7 @@ retry: goto fail; } - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); msg = NULL; if (ret) { wpa_dbg(drv->ctx, MSG_DEBUG, @@ -4395,7 +4450,7 @@ static int nl80211_set_bss(struct i802_bss *bss, int cts, int preamble, return -ENOBUFS; } - return send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + return send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); } @@ -4454,7 +4509,7 @@ static int wpa_driver_nl80211_set_acl(void *priv, } nlmsg_free(acl); - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); if (ret) { wpa_printf(MSG_DEBUG, "nl80211: Failed to set MAC ACL: %d (%s)", ret, strerror(-ret)); @@ -4506,7 +4561,7 @@ static int nl80211_set_mesh_config(void *priv, return ret; } - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); if (ret) { wpa_printf(MSG_ERROR, "nl80211: Mesh config set failed: %d (%s)", @@ -4652,7 +4707,7 @@ static int nl80211_set_multicast_to_unicast(struct i802_bss *bss, return -ENOBUFS; } - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); switch (ret) { case 0: @@ -5370,7 +5425,7 @@ static int wpa_driver_nl80211_set_ap(void *priv, int_array_len(params->allowed_freqs)); #endif /* CONFIG_DRIVER_NL80211_QCA */ - ret = send_and_recv_msgs_connect_handle(drv, msg, bss, 1); + ret = send_and_recv_msgs_connect_handle(drv, msg, bss, 1, NULL); if (ret) { wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)", ret, strerror(-ret)); @@ -5476,7 +5531,7 @@ static int nl80211_set_channel(struct i802_bss *bss, } } - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); if (ret == 0) { nl80211_link_set_freq(bss, freq->link_id, freq->freq); return 0; @@ -5817,7 +5872,7 @@ static int wpa_driver_nl80211_sta_add(void *priv, goto fail; } - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); msg = NULL; if (ret) wpa_printf(MSG_DEBUG, "nl80211: %s result: %d (%s)", @@ -5888,7 +5943,7 @@ static int wpa_driver_nl80211_sta_remove(struct i802_bss *bss, const u8 *addr, return -ENOBUFS; } - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); wpa_printf(MSG_DEBUG, "nl80211: sta_remove -> DEL_STATION %s " MACSTR " --> %d (%s)", bss->ifname, MAC2STR(addr), ret, strerror(-ret)); @@ -5919,7 +5974,7 @@ void nl80211_remove_iface(struct wpa_driver_nl80211_data *drv, int ifidx) } msg = nl80211_ifindex_msg(drv, ifidx, 0, NL80211_CMD_DEL_INTERFACE); - if (send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL) == 0) + if (send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL) == 0) return; wpa_printf(MSG_ERROR, "Failed to remove interface (ifidx=%d)", ifidx); } @@ -6003,7 +6058,7 @@ static int nl80211_create_iface_once(struct wpa_driver_nl80211_data *drv, nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr)) goto fail; - ret = send_and_recv_msgs(drv, msg, handler, arg, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, handler, arg, NULL, NULL, NULL); msg = NULL; if (ret) { fail: @@ -6185,7 +6240,7 @@ static int nl80211_tx_control_port(void *priv, const u8 *dest, os_memset(&ext_arg, 0, sizeof(struct nl80211_ack_ext_arg)); ext_arg.ext_data = &cookie; ret = send_and_recv_msgs(bss->drv, msg, NULL, NULL, - ack_handler_cookie, &ext_arg); + ack_handler_cookie, &ext_arg, NULL); if (ret) { wpa_printf(MSG_DEBUG, "nl80211: tx_control_port failed: ret=%d (%s)", @@ -6352,7 +6407,7 @@ static int wpa_driver_nl80211_sta_set_flags(void *priv, const u8 *addr, if (nla_put(msg, NL80211_ATTR_STA_FLAGS2, sizeof(upd), &upd)) goto fail; - return send_and_recv_msgs(bss->drv, msg, NULL, NULL, NULL, NULL); + return send_and_recv_msgs(bss->drv, msg, NULL, NULL, NULL, NULL, NULL); fail: nlmsg_free(msg); return -ENOBUFS; @@ -6375,7 +6430,7 @@ static int driver_nl80211_sta_set_airtime_weight(void *priv, const u8 *addr, nla_put_u16(msg, NL80211_ATTR_AIRTIME_WEIGHT, weight)) goto fail; - ret = send_and_recv_msgs(bss->drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(bss->drv, msg, NULL, NULL, NULL, NULL, NULL); if (ret) { wpa_printf(MSG_DEBUG, "nl80211: SET_STATION[AIRTIME_WEIGHT] failed: ret=%d (%s)", @@ -6425,7 +6480,8 @@ static int nl80211_leave_ibss(struct wpa_driver_nl80211_data *drv, int ret; msg = nl80211_drv_msg(drv, 0, NL80211_CMD_LEAVE_IBSS); - ret = send_and_recv_msgs_connect_handle(drv, msg, drv->first_bss, 1); + ret = send_and_recv_msgs_connect_handle(drv, msg, drv->first_bss, 1, + NULL); if (ret) { wpa_printf(MSG_DEBUG, "nl80211: Leave IBSS failed: ret=%d " "(%s)", ret, strerror(-ret)); @@ -6572,7 +6628,8 @@ retry: if (ret < 0) goto fail; - ret = send_and_recv_msgs_connect_handle(drv, msg, drv->first_bss, 1); + ret = send_and_recv_msgs_connect_handle(drv, msg, drv->first_bss, 1, + NULL); msg = NULL; if (ret) { wpa_printf(MSG_DEBUG, "nl80211: Join IBSS failed: ret=%d (%s)", @@ -7142,7 +7199,7 @@ skip_auth_type: if (ret) goto fail; - ret = send_and_recv_msgs_connect_handle(drv, msg, bss, 1); + ret = send_and_recv_msgs_connect_handle(drv, msg, bss, 1, NULL); msg = NULL; if (ret) { wpa_printf(MSG_DEBUG, "nl80211: MLME connect failed: ret=%d " @@ -7258,7 +7315,8 @@ static int wpa_driver_nl80211_associate( goto fail; } - ret = send_and_recv_msgs_connect_handle(drv, msg, drv->first_bss, 1); + ret = send_and_recv_msgs_connect_handle(drv, msg, drv->first_bss, 1, + NULL); msg = NULL; if (ret) { wpa_dbg(drv->ctx, MSG_DEBUG, @@ -7289,7 +7347,7 @@ static int nl80211_set_mode(struct wpa_driver_nl80211_data *drv, if (!msg || nla_put_u32(msg, NL80211_ATTR_IFTYPE, mode)) goto fail; - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); msg = NULL; if (!ret) return 0; @@ -7553,7 +7611,7 @@ static int wpa_driver_nl80211_set_supp_port(void *priv, int authorized) return -ENOBUFS; } - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); if (!ret) return 0; wpa_printf(MSG_DEBUG, "nl80211: Failed to set STA flag: %d (%s)", @@ -7620,7 +7678,8 @@ static int i802_get_seqnum(const char *iface, void *priv, const u8 *addr, } os_memset(seq, 0, 6); - res = send_and_recv_msgs(drv, msg, get_key_handler, seq, NULL, NULL); + res = send_and_recv_msgs(drv, msg, get_key_handler, seq, NULL, NULL, + NULL); if (res) { wpa_printf(MSG_DEBUG, "nl80211: Failed to get current TX sequence for a key (link_id=%d idx=%d): %d (%s)", @@ -7650,7 +7709,7 @@ static int i802_set_rts(void *priv, int rts) return -ENOBUFS; } - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); if (!ret) return 0; wpa_printf(MSG_DEBUG, "nl80211: Failed to set RTS threshold %d: " @@ -7678,7 +7737,7 @@ static int i802_set_frag(void *priv, int frag) return -ENOBUFS; } - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); if (!ret) return 0; wpa_printf(MSG_DEBUG, "nl80211: Failed to set fragmentation threshold " @@ -7700,7 +7759,7 @@ static int i802_flush(void *priv) * XXX: FIX! this needs to flush all VLANs too */ msg = nl80211_bss_msg(bss, 0, NL80211_CMD_DEL_STATION); - res = send_and_recv_msgs(bss->drv, msg, NULL, NULL, NULL, NULL); + res = send_and_recv_msgs(bss->drv, msg, NULL, NULL, NULL, NULL, NULL); if (res) { wpa_printf(MSG_DEBUG, "nl80211: Station flush failed: ret=%d " "(%s)", res, strerror(-res)); @@ -8031,7 +8090,7 @@ int nl80211_get_link_signal(struct wpa_driver_nl80211_data *drv, return -ENOBUFS; } - return send_and_recv_msgs(drv, msg, get_sta_handler, data, NULL, NULL); + return send_and_recv_msgs(drv, msg, get_sta_handler, data, NULL, NULL, NULL); } @@ -8048,7 +8107,7 @@ static int i802_read_sta_data(struct i802_bss *bss, } return send_and_recv_msgs(bss->drv, msg, get_sta_handler, data, - NULL, NULL); + NULL, NULL, NULL); } @@ -8110,7 +8169,7 @@ static int i802_set_tx_queue_params(void *priv, int queue, int aifs, nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID, link_id)) goto fail; - res = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + res = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); wpa_printf(MSG_DEBUG, "nl80211: TX queue param set: queue=%d aifs=%d cw_min=%d cw_max=%d burst_time=%d --> res=%d", queue, aifs, cw_min, cw_max, burst_time, res); @@ -8145,7 +8204,7 @@ static int i802_set_sta_vlan(struct i802_bss *bss, const u8 *addr, return -ENOBUFS; } - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); if (ret < 0) { wpa_printf(MSG_ERROR, "nl80211: NL80211_ATTR_STA_VLAN (addr=" MACSTR " ifname=%s vlan_id=%d) failed: %d (%s)", @@ -9005,7 +9064,8 @@ static int nl80211_send_frame_cmd(struct i802_bss *bss, goto fail; cookie = 0; - ret = send_and_recv_msgs(drv, msg, cookie_handler, &cookie, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, cookie_handler, &cookie, NULL, NULL, + NULL); msg = NULL; if (ret) { wpa_printf(MSG_DEBUG, "nl80211: Frame command failed: ret=%d " @@ -9139,7 +9199,7 @@ static void nl80211_frame_wait_cancel(struct i802_bss *bss, u64 cookie) return; } - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); if (ret) wpa_printf(MSG_DEBUG, "nl80211: wait cancel failed: ret=%d " "(%s)", ret, strerror(-ret)); @@ -9188,7 +9248,8 @@ static int wpa_driver_nl80211_remain_on_channel(void *priv, unsigned int freq, } cookie = 0; - ret = send_and_recv_msgs(drv, msg, cookie_handler, &cookie, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, cookie_handler, &cookie, NULL, NULL, + NULL); if (ret == 0) { wpa_printf(MSG_DEBUG, "nl80211: Remain-on-channel cookie " "0x%llx for freq=%u MHz duration=%u", @@ -9228,7 +9289,7 @@ static int wpa_driver_nl80211_cancel_remain_on_channel(void *priv) return -1; } - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); if (ret == 0) return 0; wpa_printf(MSG_DEBUG, "nl80211: Failed to cancel remain-on-channel: " @@ -9325,7 +9386,7 @@ static int nl80211_disable_11b_rates(struct wpa_driver_nl80211_data *drv, nla_nest_end(msg, bands); - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); if (ret) { wpa_printf(MSG_DEBUG, "nl80211: Set TX rates failed: ret=%d " "(%s)", ret, strerror(-ret)); @@ -9382,7 +9443,7 @@ static void nl80211_remove_links(struct i802_bss *bss) return; } - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); if (ret) { wpa_printf(MSG_ERROR, "nl80211: remove link (%d) failed. ret=%d (%s)", @@ -9481,7 +9542,7 @@ static int nl80211_signal_monitor(void *priv, int threshold, int hysteresis) } nla_nest_end(msg, cqm); - return send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + return send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); } @@ -9519,7 +9580,8 @@ static int nl80211_get_channel_width(struct wpa_driver_nl80211_data *drv, struct nl_msg *msg; msg = nl80211_drv_msg(drv, 0, NL80211_CMD_GET_INTERFACE); - return send_and_recv_msgs(drv, msg, get_channel_width, sig, NULL, NULL); + return send_and_recv_msgs(drv, msg, get_channel_width, sig, NULL, NULL, + NULL); } @@ -9604,7 +9666,7 @@ static int nl80211_get_links_noise(struct wpa_driver_nl80211_data *drv, msg = nl80211_drv_msg(drv, NLM_F_DUMP, NL80211_CMD_GET_SURVEY); return send_and_recv_msgs(drv, msg, get_links_noise, mlo_sig, - NULL, NULL); + NULL, NULL, NULL); } @@ -9659,7 +9721,7 @@ static int nl80211_get_links_channel_width(struct wpa_driver_nl80211_data *drv, msg = nl80211_drv_msg(drv, 0, NL80211_CMD_GET_INTERFACE); return send_and_recv_msgs(drv, msg, get_links_channel_width, mlo_sig, - NULL, NULL); + NULL, NULL, NULL); } @@ -9890,7 +9952,7 @@ static int nl80211_pmkid(struct i802_bss *bss, int cmd, return -ENOBUFS; } - return send_and_recv_msgs(bss->drv, msg, NULL, NULL, NULL, NULL); + return send_and_recv_msgs(bss->drv, msg, NULL, NULL, NULL, NULL, NULL); } @@ -9966,7 +10028,7 @@ static int nl80211_flush_pmkid(void *priv) msg = nl80211_bss_msg(bss, 0, NL80211_CMD_FLUSH_PMKSA); if (!msg) return -ENOBUFS; - return send_and_recv_msgs(bss->drv, msg, NULL, NULL, NULL, NULL); + return send_and_recv_msgs(bss->drv, msg, NULL, NULL, NULL, NULL, NULL); } @@ -10131,7 +10193,7 @@ static int wpa_driver_nl80211_get_survey(void *priv, unsigned int freq) do { wpa_printf(MSG_DEBUG, "nl80211: Fetch survey data"); err = send_and_recv_msgs(drv, msg, survey_handler, - survey_results, NULL, NULL); + survey_results, NULL, NULL, NULL); } while (err > 0); if (err) @@ -10171,7 +10233,7 @@ static void nl80211_set_rekey_info(void *priv, const u8 *kek, size_t kek_len, nla_nest_end(msg, replay_nested); - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); if (ret == -EOPNOTSUPP) { wpa_printf(MSG_DEBUG, "nl80211: Driver does not support rekey offload"); @@ -10238,7 +10300,8 @@ static void nl80211_poll_client(void *priv, const u8 *own_addr, const u8 *addr, return; } - ret = send_and_recv_msgs(drv, msg, cookie_handler, &cookie, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, cookie_handler, &cookie, NULL, NULL, + NULL); if (ret < 0) { wpa_printf(MSG_DEBUG, "nl80211: Client probe request for " MACSTR " failed: ret=%d (%s)", @@ -10264,7 +10327,7 @@ static int nl80211_set_power_save(struct i802_bss *bss, int enabled) return -ENOBUFS; } - ret = send_and_recv_msgs(bss->drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(bss->drv, msg, NULL, NULL, NULL, NULL, NULL); if (ret < 0) { wpa_printf(MSG_DEBUG, "nl80211: Setting PS state %s failed: %d (%s)", @@ -10324,7 +10387,7 @@ static int nl80211_start_radar_detection(void *priv, return -1; } - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); if (ret == 0) return 0; wpa_printf(MSG_DEBUG, "nl80211: Failed to start radar detection: " @@ -10421,7 +10484,7 @@ static int nl80211_send_tdls_mgmt(void *priv, const u8 *dst, u8 action_code, nla_put(msg, NL80211_ATTR_IE, len, buf)) goto fail; - return send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + return send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); fail: nlmsg_free(msg); @@ -10471,7 +10534,7 @@ static int nl80211_tdls_oper(void *priv, enum tdls_oper oper, const u8 *peer) return -ENOBUFS; } - res = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + res = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); wpa_printf(MSG_DEBUG, "nl80211: TDLS_OPER: oper=%d mac=" MACSTR " --> res=%d (%s)", nl80211_oper, MAC2STR(peer), res, strerror(-res)); @@ -10505,7 +10568,7 @@ nl80211_tdls_enable_channel_switch(void *priv, const u8 *addr, u8 oper_class, return ret; } - return send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + return send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); } @@ -10531,7 +10594,7 @@ nl80211_tdls_disable_channel_switch(void *priv, const u8 *addr) return -ENOBUFS; } - return send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + return send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); } #endif /* CONFIG TDLS */ @@ -10676,7 +10739,7 @@ static int wpa_driver_nl80211_update_ft_ies(void *priv, const u8 *md, return -ENOBUFS; } - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); if (ret) { wpa_printf(MSG_DEBUG, "nl80211: update_ft_ies failed " "err=%d (%s)", ret, strerror(-ret)); @@ -10704,7 +10767,7 @@ static int nl80211_update_dh_ie(void *priv, const u8 *peer_mac, return -ENOBUFS; } - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); if (ret) { wpa_printf(MSG_DEBUG, "nl80211: update_dh_ie failed err=%d (%s)", @@ -10957,7 +11020,7 @@ static int wpa_driver_nl80211_status(void *priv, char *buf, size_t buflen) nl80211_cmd(drv, msg, 0, NL80211_CMD_GET_REG) && nla_put_u32(msg, NL80211_ATTR_WIPHY, drv->wiphy_idx) == 0) { if (send_and_recv_msgs(drv, msg, nl80211_get_country, - alpha2, NULL, NULL) == 0 && + alpha2, NULL, NULL, NULL) == 0 && alpha2[0]) { res = os_snprintf(pos, end - pos, "country=%s\n", alpha2); @@ -11119,7 +11182,7 @@ static int nl80211_switch_channel(void *priv, struct csa_settings *settings) goto fail; nla_nest_end(msg, beacon_csa); - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); if (ret) { wpa_printf(MSG_DEBUG, "nl80211: switch_channel failed err=%d (%s)", ret, strerror(-ret)); @@ -11200,7 +11263,7 @@ static int nl80211_switch_color(void *priv, struct cca_settings *settings) } nla_nest_end(msg, beacon_cca); - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); if (ret) { wpa_printf(MSG_DEBUG, "nl80211: switch_color failed err=%d (%s)", @@ -11241,7 +11304,7 @@ static int nl80211_add_ts(void *priv, u8 tsid, const u8 *addr, return -ENOBUFS; } - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); if (ret) wpa_printf(MSG_DEBUG, "nl80211: add_ts failed err=%d (%s)", ret, strerror(-ret)); @@ -11268,7 +11331,7 @@ static int nl80211_del_ts(void *priv, u8 tsid, const u8 *addr) return -ENOBUFS; } - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); if (ret) wpa_printf(MSG_DEBUG, "nl80211: del_ts failed err=%d (%s)", ret, strerror(-ret)); @@ -11375,7 +11438,7 @@ static int nl80211_vendor_cmd(void *priv, unsigned int vendor_id, ret = send_and_recv_msgs_owner(drv, msg, get_connect_handle(bss), 0, cmd_reply_handler, buf, - NULL, NULL); + NULL, NULL, NULL); if (ret) wpa_printf(MSG_DEBUG, "nl80211: command failed err=%d", ret); @@ -11400,7 +11463,7 @@ static int nl80211_vendor_cmd(void *priv, unsigned int vendor_id, goto fail; ret = send_and_recv_msgs(drv, msg, vendor_reply_handler, buf, - NULL, NULL); + NULL, NULL, NULL); if (ret) wpa_printf(MSG_DEBUG, "nl80211: vendor command failed err=%d", ret); @@ -11429,7 +11492,7 @@ static int nl80211_set_qos_map(void *priv, const u8 *qos_map_set, return -ENOBUFS; } - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); if (ret) wpa_printf(MSG_DEBUG, "nl80211: Setting QoS Map failed"); @@ -11465,7 +11528,7 @@ static int nl80211_get_wowlan(void *priv) msg = nl80211_drv_msg(drv, 0, NL80211_CMD_GET_WOWLAN); ret = send_and_recv_msgs(drv, msg, get_wowlan_handler, &wowlan_enabled, - NULL, NULL); + NULL, NULL, NULL); if (ret) { wpa_printf(MSG_DEBUG, "nl80211: Getting wowlan status failed"); return 0; @@ -11512,7 +11575,7 @@ static int nl80211_set_wowlan(void *priv, nla_nest_end(msg, wowlan_triggers); - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); if (ret) wpa_printf(MSG_DEBUG, "nl80211: Setting wowlan failed"); @@ -11551,7 +11614,7 @@ static int nl80211_roaming(void *priv, int allowed, const u8 *bssid) } nla_nest_end(msg, params); - return send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + return send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); } @@ -11579,7 +11642,7 @@ static int nl80211_disable_fils(void *priv, int disable) } nla_nest_end(msg, params); - return send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + return send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); } @@ -11636,7 +11699,7 @@ static int nl80211_set_bssid_tmp_disallow(void *priv, unsigned int num_bssid, nla_nest_end(msg, nlbssids); nla_nest_end(msg, params); - return send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + return send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); fail: nlmsg_free(msg); @@ -11674,7 +11737,7 @@ static int nl80211_add_sta_node(void *priv, const u8 *addr, u16 auth_alg) } nla_nest_end(msg, params); - return send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + return send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); } #endif /* CONFIG_DRIVER_NL80211_QCA */ @@ -11859,7 +11922,7 @@ static int nl80211_join_mesh(struct i802_bss *bss, if (nl80211_put_mesh_config(msg, ¶ms->conf) < 0) goto fail; - ret = send_and_recv_msgs_connect_handle(drv, msg, bss, 1); + ret = send_and_recv_msgs_connect_handle(drv, msg, bss, 1, NULL); msg = NULL; if (ret) { wpa_printf(MSG_DEBUG, "nl80211: mesh join failed: ret=%d (%s)", @@ -11916,7 +11979,7 @@ static int wpa_driver_nl80211_leave_mesh(void *priv) wpa_printf(MSG_DEBUG, "nl80211: mesh leave (ifindex=%d)", drv->ifindex); msg = nl80211_drv_msg(drv, 0, NL80211_CMD_LEAVE_MESH); - ret = send_and_recv_msgs_connect_handle(drv, msg, bss, 0); + ret = send_and_recv_msgs_connect_handle(drv, msg, bss, 0, NULL); if (ret) { wpa_printf(MSG_DEBUG, "nl80211: mesh leave failed: ret=%d (%s)", ret, strerror(-ret)); @@ -11952,7 +12015,7 @@ static int nl80211_probe_mesh_link(void *priv, const u8 *addr, const u8 *eth, return -ENOBUFS; } - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); if (ret) { wpa_printf(MSG_DEBUG, "nl80211: mesh link probe to " MACSTR " failed: ret=%d (%s)", @@ -13536,7 +13599,7 @@ static int nl80211_update_connection_params( nl80211_put_fils_connect_params(drv, params, msg)) goto fail; - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); msg = NULL; if (ret) wpa_dbg(drv->ctx, MSG_DEBUG, @@ -13579,7 +13642,7 @@ static int nl80211_send_external_auth_status(void *priv, (params->bssid && nla_put(msg, NL80211_ATTR_BSSID, ETH_ALEN, params->bssid))) goto fail; - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); msg = NULL; if (ret) { wpa_printf(MSG_DEBUG, @@ -13619,7 +13682,7 @@ static int nl80211_set_4addr_mode(void *priv, const char *bridge_ifname, bss->added_if_into_bridge = 0; } - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); msg = NULL; if (ret && val && nl80211_get_4addr(bss) == 1) { wpa_printf(MSG_DEBUG, @@ -13717,7 +13780,7 @@ static int nl80211_link_add(void *priv, u8 link_id, const u8 *addr) return -ENOBUFS; } - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); if (ret) { wpa_printf(MSG_DEBUG, "nl80211: add link failed. ret=%d (%s)", ret, strerror(-ret)); diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h index d419739936..f82f604e90 100644 --- a/src/drivers/driver_nl80211.h +++ b/src/drivers/driver_nl80211.h @@ -269,6 +269,10 @@ struct wpa_driver_nl80211_data { struct nl_msg; +struct nl80211_err_info { + int link_id; +}; + void * nl80211_cmd(struct wpa_driver_nl80211_data *drv, struct nl_msg *msg, int flags, uint8_t cmd); struct nl_msg * nl80211_cmd_msg(struct i802_bss *bss, int flags, uint8_t cmd); @@ -279,7 +283,8 @@ int send_and_recv_msgs(struct wpa_driver_nl80211_data *drv, struct nl_msg *msg, int (*valid_handler)(struct nl_msg *, void *), void *valid_data, int (*ack_handler_custom)(struct nl_msg *, void *), - void *ack_data); + void *ack_data, + struct nl80211_err_info *err_info); struct nl_sock * get_connect_handle(struct i802_bss *bss); int nl80211_create_iface(struct wpa_driver_nl80211_data *drv, const char *ifname, enum nl80211_iftype iftype, diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c index 544e54dbc7..8e033ceb0e 100644 --- a/src/drivers/driver_nl80211_capa.c +++ b/src/drivers/driver_nl80211_capa.c @@ -51,7 +51,7 @@ static u32 get_nl80211_protocol_features(struct wpa_driver_nl80211_data *drv) } if (send_and_recv_msgs(drv, msg, protocol_feature_handler, &feat, - NULL, NULL) == 0) + NULL, NULL, NULL) == 0) return feat; return 0; @@ -1202,7 +1202,8 @@ static int wpa_driver_nl80211_get_info(struct wpa_driver_nl80211_data *drv, return -1; } - if (send_and_recv_msgs(drv, msg, wiphy_info_handler, info, NULL, NULL)) + if (send_and_recv_msgs(drv, msg, wiphy_info_handler, info, NULL, NULL, + NULL)) return -1; if (info->auth_supported) @@ -1312,7 +1313,7 @@ static void qca_nl80211_check_dfs_capa(struct wpa_driver_nl80211_data *drv) } ret = send_and_recv_msgs(drv, msg, dfs_info_handler, &dfs_capability, - NULL, NULL); + NULL, NULL, NULL); if (!ret && dfs_capability) drv->capa.flags |= WPA_DRIVER_FLAGS_DFS_OFFLOAD; } @@ -1400,7 +1401,7 @@ static void qca_nl80211_get_features(struct wpa_driver_nl80211_data *drv) os_memset(&info, 0, sizeof(info)); info.capa = &drv->capa; ret = send_and_recv_msgs(drv, msg, features_info_handler, &info, - NULL, NULL); + NULL, NULL, NULL); if (ret || !info.flags) return; @@ -2541,7 +2542,7 @@ static int nl80211_set_regulatory_flags(struct wpa_driver_nl80211_data *drv, } return send_and_recv_msgs(drv, msg, nl80211_get_reg, results, - NULL, NULL); + NULL, NULL, NULL); } @@ -2634,7 +2635,7 @@ nl80211_get_hw_feature_data(void *priv, u16 *num_modes, u16 *flags, } if (send_and_recv_msgs(drv, msg, phy_info_handler, &result, - NULL, NULL) == 0) { + NULL, NULL, NULL) == 0) { struct hostapd_hw_modes *modes; nl80211_set_regulatory_flags(drv, &result); diff --git a/src/drivers/driver_nl80211_scan.c b/src/drivers/driver_nl80211_scan.c index 5bd3e3b46e..736db64063 100644 --- a/src/drivers/driver_nl80211_scan.c +++ b/src/drivers/driver_nl80211_scan.c @@ -83,7 +83,7 @@ static int nl80211_get_noise_for_scan_results( os_memset(info, 0, sizeof(*info)); msg = nl80211_drv_msg(drv, NLM_F_DUMP, NL80211_CMD_GET_SURVEY); return send_and_recv_msgs(drv, msg, get_noise_for_scan_results, info, - NULL, NULL); + NULL, NULL, NULL); } @@ -95,7 +95,7 @@ static int nl80211_abort_scan(struct i802_bss *bss) wpa_printf(MSG_DEBUG, "nl80211: Abort scan"); msg = nl80211_cmd_msg(bss, 0, NL80211_CMD_ABORT_SCAN); - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); if (ret) { wpa_printf(MSG_DEBUG, "nl80211: Abort scan failed: ret=%d (%s)", ret, strerror(-ret)); @@ -126,7 +126,7 @@ static int nl80211_abort_vendor_scan(struct wpa_driver_nl80211_data *drv, nla_nest_end(msg, params); - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); msg = NULL; if (ret) { wpa_printf(MSG_INFO, @@ -389,7 +389,7 @@ int wpa_driver_nl80211_scan(struct i802_bss *bss, goto fail; } - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); msg = NULL; if (ret) { wpa_printf(MSG_DEBUG, "nl80211: Scan trigger failed: ret=%d " @@ -642,7 +642,7 @@ int wpa_driver_nl80211_sched_scan(void *priv, params->sched_scan_start_delay)) goto fail; - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); /* TODO: if we get an error here, we should fall back to normal scan */ @@ -679,7 +679,7 @@ int wpa_driver_nl80211_stop_sched_scan(void *priv) #endif /* ANDROID */ msg = nl80211_drv_msg(drv, 0, NL80211_CMD_STOP_SCHED_SCAN); - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); if (ret) { wpa_printf(MSG_DEBUG, "nl80211: Sched scan stop failed: ret=%d (%s)", @@ -984,7 +984,8 @@ try_again: arg.drv = drv; arg.res = res; - ret = send_and_recv_msgs(drv, msg, bss_info_handler, &arg, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, bss_info_handler, &arg, NULL, NULL, + NULL); if (ret == -EAGAIN) { count++; if (count >= 10) { @@ -1069,7 +1070,7 @@ void nl80211_dump_scan(struct wpa_driver_nl80211_data *drv) msg = nl80211_cmd_msg(drv->first_bss, NLM_F_DUMP, NL80211_CMD_GET_SCAN); if (msg) send_and_recv_msgs(drv, msg, nl80211_dump_scan_handler, &ctx, - NULL, NULL); + NULL, NULL, NULL); } @@ -1263,7 +1264,7 @@ int wpa_driver_nl80211_vendor_scan(struct i802_bss *bss, nla_nest_end(msg, attr); ret = send_and_recv_msgs(drv, msg, scan_cookie_handler, &cookie, - NULL, NULL); + NULL, NULL, NULL); msg = NULL; if (ret) { wpa_printf(MSG_DEBUG, @@ -1326,7 +1327,7 @@ int nl80211_set_default_scan_ies(void *priv, const u8 *ies, size_t ies_len) nla_nest_end(msg, attr); - ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL, NULL); msg = NULL; if (ret) { wpa_printf(MSG_ERROR, From patchwork Mon Nov 20 23:51:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866367 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=WV/CqUNw; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=W2E4qIyt; 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 4SZ48b4HWwz1ySN for ; Tue, 21 Nov 2023 10:53:35 +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=rWvXmr+5TwJ0/p1GjJL3Z1Bh7JB8Pn+WJgD06WaGSaE=; b=WV/CqUNwG34UTL X2V6Z0Om8esGOomDzOa1fYHPzkNKgw4aT8cSa8/aLE3ZzdkF2ESTUR4W8Jghy9avzSI2/OLXUeK/J QPlWXry34Oi3x/EGUfO/QDbYVXDD4cbMOFrjDj6iA464Wxtv2Y3ZoDiwPHd6yX14tk1PRUJDeSyRQ ZCbAnXnOx5XrrK4OliH176rz2ma0PjL18LmXFbE0AzDHPuzSLb8eCEcajiD8ZjToJlWLbK/ed5bu5 pIpYvo5kZXBWZwanNTxS55BzTOlwo/uFVJhTZLlDMCo5VBmQb+qkVfeBfoV8fMAClkXDW3+1w3Z3X jGoss8K3puO2BOlziUFg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4a-00F5tt-0L; Mon, 20 Nov 2023 23:53:00 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4N-00F5iV-1Y for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:52:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524367; x=1732060367; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=r0ArZ81hFU9G5t7rlGhExTJ39mRgmWk0PXTkmc9nsZU=; b=W2E4qIytyMvNMjuEYGX5Y+1PTgWiuiUFNepE3UIZlubsT8cEcGy8uzc0 ExkuPeiUAfqC720+E/N6OGjqSAPMIKrdBBz3puw7ka4TJ6tJTQFfElsLk bzeQFeGXA12K5r7992xSZFCDJGZcwdc5RUiP24MnrfWcjd3UQ6w60Ifcm nmaq1RDdNNELxdnvfBKMA0HUTX5dbwTdqyvb+x+N417lQG2KFr49H/Ix+ DMyKvtsdJsYB5VknYd82X+vHN4y/jVCyBY1R0n8cAmeH4m03F5vCxmUwf 4wcULQGGF3m8qldUv7Y8ANOxUxDbhCb8SdCa3DOKuBQ4lRfbVunLRPm44 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769771" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769771" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871393" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871393" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:45 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Benjamin Berg , Andrei Otcheretianski Subject: [PATCH 16/42] nl80211: Report link specific association failures from the kernel Date: Tue, 21 Nov 2023 01:51:30 +0200 Message-Id: <20231120235156.363852-17-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155247_565486_BBDD4A57 X-CRM114-Status: GOOD ( 13.57 ) X-Spam-Score: -0.4 (/) 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: Benjamin Berg If a link specific error occured, mark the offending link within the association parameters. Signed-off-by: Benjamin Berg Signed-off-by: Andrei Otcheretianski --- src/drivers/driver_nl80211.c | 16 +++++++++++++++- 1 file changed, 15 [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Benjamin Berg If a link specific error occured, mark the offending link within the association parameters. Signed-off-by: Benjamin Berg Signed-off-by: Andrei Otcheretianski --- src/drivers/driver_nl80211.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 5124a95e95..ff40a80700 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -7257,6 +7257,7 @@ static int wpa_driver_nl80211_associate( { struct i802_bss *bss = priv; struct wpa_driver_nl80211_data *drv = bss->drv; + struct nl80211_err_info err_info; int ret = -1; struct nl_msg *msg; @@ -7316,13 +7317,26 @@ static int wpa_driver_nl80211_associate( } ret = send_and_recv_msgs_connect_handle(drv, msg, drv->first_bss, 1, - NULL); + &err_info); msg = NULL; if (ret) { wpa_dbg(drv->ctx, MSG_DEBUG, "nl80211: MLME command failed (assoc): ret=%d (%s)", ret, strerror(-ret)); nl80211_dump_scan(drv); + + /* Mark failed link within params */ + if (err_info.link_id >= 0) { + if (err_info.link_id >= MAX_NUM_MLD_LINKS || + !(params->mld_params.valid_links & + BIT(err_info.link_id))) { + wpa_printf(MSG_DEBUG, + "nl80211: Invalid errorred link_id %d", + err_info.link_id); + goto fail; + } + params->mld_params.mld_links[err_info.link_id].error = ret; + } } else { wpa_printf(MSG_DEBUG, "nl80211: Association request send successfully"); From patchwork Mon Nov 20 23:51:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866372 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=nELzC32D; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=lPQ7618t; 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 4SZ48q6Ftgz1ySV for ; Tue, 21 Nov 2023 10:53:47 +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=xGb9n6AGMZhwlf5VariJUVI6ABx7ubB9eV5EMXMrprQ=; b=nELzC32DUvkb4a dLE3Q13NfIuDhesKLyE4LEd0LpDUITq6hRr4mPgcDyTHs8vOBR53TEllbM1kei+y2L0A2/nt1hudR yQeP4baVBH3dxNNYgkOO3/W4VAms9JMsmxE67b/tdHU8zg5j//OTy3s3+z5mr7Qw0w+VHKwO0sGGn O1aTodxBajHcWEhRnELoaXcrKnFrb6nOezmYyM78W0RoNdbLJqpQu6VffEK63/KZkfavsFIH7OtKM olxU8K/nqTjH4aDe6XDwvnBoeYTknp5DgHAJLl3WPVyjZcYpUFCFg5qDtcWOG4CDLkJsVDOSqLBCk sRG5oRoZfK1fyW0nMOKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4e-00F5wt-03; Mon, 20 Nov 2023 23:53:04 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4O-00F5jA-2A for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:52:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524368; x=1732060368; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WqpRHPDQcefK8IC20BbsjymnHmkNJYdLF5VG+LsDyWI=; b=lPQ7618tus1t6b+HfmU6EYL8hTE8HYbw6wtFyNnsuRfEfSrhklzXEpoa JW3NbFv7+wPtv5YHzyVjsz2ADyIcZPwIROmfr/qM4FMQNEZxBAODYjKAF D9H7DqAkPR5Qgc9o5RBMPnpLX0DjNKSTZXoTimSCHF3P+i+VZ0P2SZqkq F6tJNJwcDa9J+fEG8ZqsS/572NBtKchBpq1gdalDCzAbWss0vA54GBOsc 7/07pe5z5YHaj2j8Ht/Po/yA4bP35iv07IpEzM8BRjjgHaD7zTwrLFuSq jz0T/48xgSTz0wusXDDUMFJgsaDZ+MbqIQumIChAORdJERw9D0TNHuiyl A==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769773" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769773" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871397" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871397" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:46 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Benjamin Berg , Andrei Otcheretianski Subject: [PATCH 17/42] AP: Use a struct for probe resp in/out params Date: Tue, 21 Nov 2023 01:51:31 +0200 Message-Id: <20231120235156.363852-18-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155248_768422_B1DEB453 X-CRM114-Status: GOOD ( 22.46 ) X-Spam-Score: -0.4 (/) 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: Benjamin Berg This effectively moves setting the csa/ecsa/cca position to happen only when a probe response for offloading is generated. One could probably avoid the global variable alltogether, as the value is immediately consumed into struct {csa,cca}_settings. Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Benjamin Berg This effectively moves setting the csa/ecsa/cca position to happen only when a probe response for offloading is generated. One could probably avoid the global variable alltogether, as the value is immediately consumed into struct {csa,cca}_settings. Signed-off-by: Benjamin Berg Signed-off-by: Andrei Otcheretianski --- src/ap/beacon.c | 141 +++++++++++++++++++++++++++++++----------------- 1 file changed, 92 insertions(+), 49 deletions(-) diff --git a/src/ap/beacon.c b/src/ap/beacon.c index d5f6821e7d..67e69c7af3 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -564,13 +564,25 @@ static u8 * hostapd_eid_mbssid_config(struct hostapd_data *hapd, u8 *eid, return eid; } +struct probe_resp_params { + const struct ieee80211_mgmt *req; + bool is_p2p; -static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd, - const struct ieee80211_mgmt *req, - int is_p2p, size_t *resp_len, - const u8 *known_bss, u8 known_bss_len) -{ struct ieee80211_mgmt *resp; + size_t resp_len; + u8 *csa_pos; + u8 *ecsa_pos; + const u8 *known_bss; + u8 known_bss_len; + +#ifdef CONFIG_IEEE80211AX + u8 *cca_pos; +#endif /* CONFIG_IEEE80211AX */ +}; + +void hostapd_gen_probe_resp(struct hostapd_data *hapd, + struct probe_resp_params *params) +{ u8 *pos, *epos, *csa_pos; size_t buflen; @@ -633,19 +645,20 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd, #endif /* CONFIG_IEEE80211BE */ buflen += hostapd_eid_mbssid_len(hapd, WLAN_FC_STYPE_PROBE_RESP, NULL, - known_bss, known_bss_len, NULL); + params->known_bss, + params->known_bss_len, NULL); buflen += hostapd_eid_rnr_len(hapd, WLAN_FC_STYPE_PROBE_RESP); buflen += hostapd_mbo_ie_len(hapd); buflen += hostapd_eid_owe_trans_len(hapd); buflen += hostapd_eid_dpp_cc_len(hapd); - resp = os_zalloc(buflen); - if (resp == NULL) - return NULL; + params->resp = os_zalloc(buflen); + if (!params->resp) + return; - epos = ((u8 *) resp) + MAX_PROBERESP_LEN; + epos = ((u8 *) params->resp) + MAX_PROBERESP_LEN; - resp->frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT, + params->resp->frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT, WLAN_FC_STYPE_PROBE_RESP); /* Unicast the response to all requests on bands other than 6 GHz. For * the 6 GHz, unicast is used only if the actual SSID is not included in @@ -653,23 +666,22 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd, * Std 802.11ax-2021, 26.17.2.3.2. Broadcast address is also used for * the Probe Response frame template for the unsolicited (i.e., not as * a response to a specific request) case. */ - if (req && (!is_6ghz_op_class(hapd->iconf->op_class) || + if (params->req && (!is_6ghz_op_class(hapd->iconf->op_class) || hapd->conf->ignore_broadcast_ssid)) - os_memcpy(resp->da, req->sa, ETH_ALEN); + os_memcpy(params->resp->da, params->req->sa, ETH_ALEN); else - os_memset(resp->da, 0xff, ETH_ALEN); + os_memset(params->resp->da, 0xff, ETH_ALEN); + os_memcpy(params->resp->sa, hapd->own_addr, ETH_ALEN); - os_memcpy(resp->sa, hapd->own_addr, ETH_ALEN); - - os_memcpy(resp->bssid, hapd->own_addr, ETH_ALEN); - resp->u.probe_resp.beacon_int = + os_memcpy(params->resp->bssid, hapd->own_addr, ETH_ALEN); + params->resp->u.probe_resp.beacon_int = host_to_le16(hapd->iconf->beacon_int); /* hardware or low-level driver will setup seq_ctrl and timestamp */ - resp->u.probe_resp.capab_info = + params->resp->u.probe_resp.capab_info = host_to_le16(hostapd_own_capab_info(hapd)); - pos = resp->u.probe_resp.variable; + pos = params->resp->u.probe_resp.variable; *pos++ = WLAN_EID_SSID; *pos++ = hapd->conf->ssid.ssid_len; os_memcpy(pos, hapd->conf->ssid.ssid, hapd->conf->ssid.ssid_len); @@ -689,7 +701,9 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd, /* CSA IE */ csa_pos = hostapd_eid_csa(hapd, pos); if (csa_pos != pos) - hapd->cs_c_off_proberesp = csa_pos - (u8 *) resp - 1; + params->csa_pos = csa_pos - 1; + else + params->csa_pos = NULL; pos = csa_pos; /* ERP Information element */ @@ -701,15 +715,17 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd, pos = hostapd_get_rsne(hapd, pos, epos - pos); pos = hostapd_eid_bss_load(hapd, pos, epos - pos); pos = hostapd_eid_mbssid(hapd, pos, epos, WLAN_FC_STYPE_PROBE_RESP, 0, - NULL, known_bss, known_bss_len, NULL, NULL, - NULL, 0); + NULL, params->known_bss, + params->known_bss_len, NULL, NULL, NULL, 0); pos = hostapd_eid_rm_enabled_capab(hapd, pos, epos - pos); pos = hostapd_get_mde(hapd, pos, epos - pos); /* eCSA IE */ csa_pos = hostapd_eid_ecsa(hapd, pos); if (csa_pos != pos) - hapd->cs_c_off_ecsa_proberesp = csa_pos - (u8 *) resp - 1; + params->ecsa_pos = csa_pos - 1; + else + params->ecsa_pos = NULL; pos = csa_pos; pos = hostapd_eid_supported_op_classes(hapd, pos); @@ -720,7 +736,7 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd, * when a list of known BSSes is included in the Probe Request frame. */ pos = hostapd_eid_ext_capab(hapd, pos, hapd->iconf->mbssid >= MBSSID_ENABLED && - !known_bss_len); + !params->known_bss_len); pos = hostapd_eid_time_adv(hapd, pos); pos = hostapd_eid_time_zone(hapd, pos); @@ -768,7 +784,9 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd, /* BSS Color Change Announcement element */ cca_pos = hostapd_eid_cca(hapd, pos); if (cca_pos != pos) - hapd->cca_c_off_proberesp = cca_pos - (u8 *) resp - 2; + params->cca_pos = cca_pos - 2; + else + params->cca_pos = NULL; pos = cca_pos; pos = hostapd_eid_spatial_reuse(hapd, pos); @@ -807,7 +825,7 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd, #endif /* CONFIG_WPS */ #ifdef CONFIG_P2P - if ((hapd->conf->p2p & P2P_ENABLED) && is_p2p && + if ((hapd->conf->p2p & P2P_ENABLED) && params->is_p2p && hapd->p2p_probe_resp_ie) { os_memcpy(pos, wpabuf_head(hapd->p2p_probe_resp_ie), wpabuf_len(hapd->p2p_probe_resp_ie)); @@ -824,9 +842,10 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd, pos = hostapd_eid_hs20_indication(hapd, pos); #endif /* CONFIG_HS20 */ - pos = hostapd_eid_mbo(hapd, pos, (u8 *) resp + buflen - pos); - pos = hostapd_eid_owe_trans(hapd, pos, (u8 *) resp + buflen - pos); - pos = hostapd_eid_dpp_cc(hapd, pos, (u8 *) resp + buflen - pos); + pos = hostapd_eid_mbo(hapd, pos, (u8 *) params->resp + buflen - pos); + pos = hostapd_eid_owe_trans(hapd, pos, + (u8 *) params->resp + buflen - pos); + pos = hostapd_eid_dpp_cc(hapd, pos, (u8 *) params->resp + buflen - pos); if (hapd->conf->vendor_elements) { os_memcpy(pos, wpabuf_head(hapd->conf->vendor_elements), @@ -834,8 +853,7 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd, pos += wpabuf_len(hapd->conf->vendor_elements); } - *resp_len = pos - (u8 *) resp; - return (u8 *) resp; + params->resp_len = pos - (u8 *)params->resp; } @@ -1041,17 +1059,17 @@ void handle_probe_req(struct hostapd_data *hapd, const struct ieee80211_mgmt *mgmt, size_t len, int ssi_signal) { - u8 *resp; struct ieee802_11_elems elems; const u8 *ie; size_t ie_len; - size_t i, resp_len; + size_t i; int noack; enum ssid_match_result res; int ret; u16 csa_offs[2]; size_t csa_offs_len; struct radius_sta rad_info; + struct probe_resp_params params; if (hapd->iconf->rssi_ignore_probe_request && ssi_signal && ssi_signal < hapd->iconf->rssi_ignore_probe_request) @@ -1283,10 +1301,12 @@ void handle_probe_req(struct hostapd_data *hapd, wpa_msg_ctrl(hapd->msg_ctx, MSG_INFO, RX_PROBE_REQUEST "sa=" MACSTR " signal=%d", MAC2STR(mgmt->sa), ssi_signal); - resp = hostapd_gen_probe_resp(hapd, mgmt, elems.p2p != NULL, - &resp_len, elems.mbssid_known_bss, - elems.mbssid_known_bss_len); - if (resp == NULL) + params.req = mgmt; + params.is_p2p = !!elems.p2p; + params.known_bss = elems.mbssid_known_bss; + params.known_bss_len = elems.mbssid_known_bss_len; + hostapd_gen_probe_resp(hapd, ¶ms); + if (!params.resp) return; /* @@ -1298,24 +1318,23 @@ void handle_probe_req(struct hostapd_data *hapd, csa_offs_len = 0; if (hapd->csa_in_progress) { - if (hapd->cs_c_off_proberesp) + if (params.csa_pos) csa_offs[csa_offs_len++] = - hapd->cs_c_off_proberesp; + params.csa_pos - (u8 *)params.resp; - if (hapd->cs_c_off_ecsa_proberesp) + if (params.ecsa_pos) csa_offs[csa_offs_len++] = - hapd->cs_c_off_ecsa_proberesp; + params.ecsa_pos - (u8 *)params.resp; } - ret = hostapd_drv_send_mlme(hostapd_mbssid_get_tx_bss(hapd), resp, - resp_len, noack, + ret = hostapd_drv_send_mlme(hapd, params.resp, params.resp_len, noack, csa_offs_len ? csa_offs : NULL, csa_offs_len, 0); if (ret < 0) wpa_printf(MSG_INFO, "handle_probe_req: send failed"); - os_free(resp); + os_free(params.resp); wpa_printf(MSG_EXCESSIVE, "STA " MACSTR " sent probe request for %s " "SSID", MAC2STR(mgmt->sa), @@ -1326,6 +1345,8 @@ void handle_probe_req(struct hostapd_data *hapd, static u8 * hostapd_probe_resp_offloads(struct hostapd_data *hapd, size_t *resp_len) { + struct probe_resp_params params; + /* check probe response offloading caps and print warnings */ if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_PROBE_RESP_OFFLOAD)) return NULL; @@ -1355,7 +1376,22 @@ static u8 * hostapd_probe_resp_offloads(struct hostapd_data *hapd, "this"); /* Generate a Probe Response template for the non-P2P case */ - return hostapd_gen_probe_resp(hapd, NULL, 0, resp_len, NULL, 0); + params.req = NULL; + params.is_p2p = false; + params.known_bss = NULL; + params.known_bss_len = 0; + + hostapd_gen_probe_resp(hapd, ¶ms); + *resp_len = params.resp_len; + + /* TODO: Avoid passing these through struct hostapd_data */ + hapd->cs_c_off_proberesp = params.csa_pos - (u8 *)params.resp; + hapd->cs_c_off_ecsa_proberesp = params.ecsa_pos - (u8 *)params.resp; +#ifdef CONFIG_IEEE80211AX + hapd->cca_c_off_proberesp = params.cca_pos - (u8 *)params.resp; +#endif /* CONFIG_IEEE80211AX */ + + return (u8 *)params.resp; } #endif /* NEED_AP_MLME */ @@ -1366,15 +1402,22 @@ static u8 * hostapd_probe_resp_offloads(struct hostapd_data *hapd, static u8 * hostapd_unsol_bcast_probe_resp(struct hostapd_data *hapd, struct wpa_driver_ap_params *params) { + struct probe_resp_params probe_params; + if (!is_6ghz_op_class(hapd->iconf->op_class)) return NULL; params->unsol_bcast_probe_resp_interval = hapd->conf->unsol_bcast_probe_resp_interval; - return hostapd_gen_probe_resp(hapd, NULL, 0, - ¶ms->unsol_bcast_probe_resp_tmpl_len, - NULL, 0); + probe_params.req = NULL; + probe_params.is_p2p = false; + probe_params.known_bss = NULL; + probe_params.known_bss_len = 0; + + hostapd_gen_probe_resp(hapd, &probe_params); + params->unsol_bcast_probe_resp_tmpl_len = probe_params.resp_len; + return (u8 *)probe_params.resp; } #endif /* CONFIG_IEEE80211AX */ From patchwork Mon Nov 20 23:51:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866405 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=molU0T2q; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Wj6ZpHL4; 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 4SZ5gb2Ymjz1ySS for ; Tue, 21 Nov 2023 12:02:01 +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=DthuCghXuFIpeXOjhtHPN5lT8QNmw0C+cZgkfQ2sKSs=; b=molU0T2qE21PUd 4Vpkl4VYZJ2R1p7sqHX62bBZVEpXM15f99kraYLXpcD/vAK1jXrilK7A1gLyPqJtDzqWSn9IHJoSr BILQkXKsA2tJXAqz+RBSsdH4SqyD7Lvtb78SesiKIWtRPllNg/YLHjnp7UgL1mXJ401Q+vjyoRwYp H5BbQZHlvSepq6IwGhn4WOMb4YFFuK4MsXRE6VQ4fr++xX1quOKGFsDMeSo6/t9Exm3S+LfH3Gzc8 P1WI+vHwaFbiDj89h0DKk6xKELhBm3lWFlJYvhNYeVQDw+2TnO1NpSzRJaZQDmgBTnqU6Qj1cQOJC 7LFyv3FmIFdG+AWd6+KQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5F8i-00FHUO-1n; Tue, 21 Nov 2023 01:01:20 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4Q-00F5iV-0K for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:52:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524370; x=1732060370; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ss/RdXFZ4FqpSR536C4NIImBK01HmSuZro87i4r1BWE=; b=Wj6ZpHL4zrHX5aIqUQ3sO64+4TeX9plfEjygDCmm0nSsErKwbFbpxUH+ p1lPlkz9yY6VSDQEst6PoQ1ICY0z2WuMWpJoPj4o5+bk1rY5xu89MHwNp G8ybm8YeU0iESwkglxbXyJe1PDZqhgSlQhTdzm6CmmuLflcqFvXFx9Qpd /zZ0l2FSds/3YIbIh/x/nux8ldn072PxpjNokOFvAcGZmx0FQYHvn+dHv 02PkiPPMET/+FcFZ/lty5FkVLCqOLHIvWaCv/JT3whNejA/jcAm5n9CSC LIMqHi5IzQbfR3dE7Ods59ypVXYS0PGuAeANfBrpgE8kDMy1j6aM3akPy Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769776" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769776" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871403" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871403" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:48 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Benjamin Berg , Andrei Otcheretianski Subject: [PATCH 18/42] AP: Split probe response IE generation into separate function Date: Tue, 21 Nov 2023 01:51:32 +0200 Message-Id: <20231120235156.363852-19-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155250_217888_E74A07D1 X-CRM114-Status: GOOD ( 17.95 ) X-Spam-Score: -0.4 (/) 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: Benjamin Berg To support ML probe request we will need to include IEs from the other hapd instances in the response. Split the function to allow just generating the per-instance IEs separately. Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Benjamin Berg To support ML probe request we will need to include IEs from the other hapd instances in the response. Split the function to allow just generating the per-instance IEs separately. Signed-off-by: Benjamin Berg Signed-off-by: Andrei Otcheretianski --- src/ap/beacon.c | 103 ++++++++++++++++++++++++++++++------------------ 1 file changed, 64 insertions(+), 39 deletions(-) diff --git a/src/ap/beacon.c b/src/ap/beacon.c index 67e69c7af3..232098328d 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -580,16 +580,11 @@ struct probe_resp_params { #endif /* CONFIG_IEEE80211AX */ }; -void hostapd_gen_probe_resp(struct hostapd_data *hapd, - struct probe_resp_params *params) +static size_t hostapd_probe_resp_elems_len(struct hostapd_data *hapd, + struct probe_resp_params *params) { - u8 *pos, *epos, *csa_pos; - size_t buflen; - - hapd = hostapd_mbssid_get_tx_bss(hapd); + size_t buflen = 0; -#define MAX_PROBERESP_LEN 768 - buflen = MAX_PROBERESP_LEN; #ifdef CONFIG_WPS if (hapd->wps_probe_resp_ie) buflen += wpabuf_len(hapd->wps_probe_resp_ie); @@ -652,36 +647,19 @@ void hostapd_gen_probe_resp(struct hostapd_data *hapd, buflen += hostapd_eid_owe_trans_len(hapd); buflen += hostapd_eid_dpp_cc_len(hapd); - params->resp = os_zalloc(buflen); - if (!params->resp) - return; - - epos = ((u8 *) params->resp) + MAX_PROBERESP_LEN; - - params->resp->frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT, - WLAN_FC_STYPE_PROBE_RESP); - /* Unicast the response to all requests on bands other than 6 GHz. For - * the 6 GHz, unicast is used only if the actual SSID is not included in - * the Beacon frames. Otherwise, broadcast response is used per IEEE - * Std 802.11ax-2021, 26.17.2.3.2. Broadcast address is also used for - * the Probe Response frame template for the unsolicited (i.e., not as - * a response to a specific request) case. */ - if (params->req && (!is_6ghz_op_class(hapd->iconf->op_class) || - hapd->conf->ignore_broadcast_ssid)) - os_memcpy(params->resp->da, params->req->sa, ETH_ALEN); - else - os_memset(params->resp->da, 0xff, ETH_ALEN); - os_memcpy(params->resp->sa, hapd->own_addr, ETH_ALEN); + return buflen; +} - os_memcpy(params->resp->bssid, hapd->own_addr, ETH_ALEN); - params->resp->u.probe_resp.beacon_int = - host_to_le16(hapd->iconf->beacon_int); +static u8 * hostapd_probe_resp_fill_elems(struct hostapd_data *hapd, + struct probe_resp_params *params, + u8 *pos, + size_t len) +{ + u8 *csa_pos; + u8 *epos; - /* hardware or low-level driver will setup seq_ctrl and timestamp */ - params->resp->u.probe_resp.capab_info = - host_to_le16(hostapd_own_capab_info(hapd)); + epos = pos + len; - pos = params->resp->u.probe_resp.variable; *pos++ = WLAN_EID_SSID; *pos++ = hapd->conf->ssid.ssid_len; os_memcpy(pos, hapd->conf->ssid.ssid, hapd->conf->ssid.ssid_len); @@ -842,10 +820,9 @@ void hostapd_gen_probe_resp(struct hostapd_data *hapd, pos = hostapd_eid_hs20_indication(hapd, pos); #endif /* CONFIG_HS20 */ - pos = hostapd_eid_mbo(hapd, pos, (u8 *) params->resp + buflen - pos); - pos = hostapd_eid_owe_trans(hapd, pos, - (u8 *) params->resp + buflen - pos); - pos = hostapd_eid_dpp_cc(hapd, pos, (u8 *) params->resp + buflen - pos); + pos = hostapd_eid_mbo(hapd, pos, epos - pos); + pos = hostapd_eid_owe_trans(hapd, pos, epos - pos); + pos = hostapd_eid_dpp_cc(hapd, pos, epos - pos); if (hapd->conf->vendor_elements) { os_memcpy(pos, wpabuf_head(hapd->conf->vendor_elements), @@ -853,6 +830,54 @@ void hostapd_gen_probe_resp(struct hostapd_data *hapd, pos += wpabuf_len(hapd->conf->vendor_elements); } + return pos; +} + + +void hostapd_gen_probe_resp(struct hostapd_data *hapd, + struct probe_resp_params *params) +{ + u8 *pos; + size_t buflen; + + hapd = hostapd_mbssid_get_tx_bss(hapd); + +#define MAX_PROBERESP_LEN 768 + buflen = MAX_PROBERESP_LEN; + + buflen += hostapd_probe_resp_elems_len(hapd, params); + + params->resp = os_zalloc(buflen); + if (!params->resp) + return; + + params->resp->frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT, + WLAN_FC_STYPE_PROBE_RESP); + /* Unicast the response to all requests on bands other than 6 GHz. For + * the 6 GHz, unicast is used only if the actual SSID is not included in + * the Beacon frames. Otherwise, broadcast response is used per IEEE + * Std 802.11ax-2021, 26.17.2.3.2. Broadcast address is also used for + * the Probe Response frame template for the unsolicited (i.e., not as + * a response to a specific request) case. */ + if (params->req && (!is_6ghz_op_class(hapd->iconf->op_class) || + hapd->conf->ignore_broadcast_ssid)) + os_memcpy(params->resp->da, params->req->sa, ETH_ALEN); + else + os_memset(params->resp->da, 0xff, ETH_ALEN); + os_memcpy(params->resp->sa, hapd->own_addr, ETH_ALEN); + + os_memcpy(params->resp->bssid, hapd->own_addr, ETH_ALEN); + params->resp->u.probe_resp.beacon_int = + host_to_le16(hapd->iconf->beacon_int); + + /* hardware or low-level driver will setup seq_ctrl and timestamp */ + params->resp->u.probe_resp.capab_info = + host_to_le16(hostapd_own_capab_info(hapd)); + + pos = hostapd_probe_resp_fill_elems(hapd, params, + params->resp->u.probe_resp.variable, + buflen); + params->resp_len = pos - (u8 *)params->resp; } From patchwork Mon Nov 20 23:51:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866374 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=pyYw5gdG; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=bxAGl2OS; 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 4SZ48r720kz1ySS for ; Tue, 21 Nov 2023 10:53:48 +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=4rw/FtbPv+U38ttJoTUgjNZcRqLu+6GQNlv/zC1e9Ls=; b=pyYw5gdG2b51dO t2NRggfrWCMmQAihwE9Z5k3hWNshesI/TPH2KxPZbEcxiNflbQGWNq63gwotkupaaElawP9RbcLlP INKIUdbtmupVNgGcH0l9FrFl8pN2UKu0JN4MaFqBE701V5LI1NA4fgGmG/M80Mw44T3/neqgF5YCu ZljuBhjlotBykObL1tG0186zRw0QP/MCs2dgZkbKb+CkaAcKO+w+tMCoGDLDaig+1VLemwscwv4xb NU6BL8PVz+Uk5UZqRdxMIB3p7n3lk3MCd9zt6c+3/LMmvQRaIMnDIvJDaM6086POVEvUAlUgfu6I+ m7dMZNJ8l5EvvwpgvM0A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4i-00F61l-2p; Mon, 20 Nov 2023 23:53:08 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4R-00F5l1-28 for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:52:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524371; x=1732060371; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IvVB05UbDP4Lqz6cYCCDmJMAGPnQB4bg9ayjur0tEJM=; b=bxAGl2OS6rKR9fRtRpdlCV1WqLcLQp+YBpfKt+NMOV0iKJzsd4zrF+if Jd8CQfXsYJpq5hnfJ8+AIlZnvjIE/O49B+HoPO1/G9WHaQPZmRtPbKY/w 0f7gjcxu9gPH2y6oU/onbE90WL5aLAwP0STe+BLnkrBgIFYs2qI3hPAE3 yT0xMCIQc5PzPqLT3dmsJnhwgK5sW8EPBRIwe3lfbPOhjXRd0Glr3/arz 515L3e3pvK2cauPgHIkTI63GJ39IBb71HW8srSMfD8xPhTGqqD2jQJUyZ IhQeBALQdnXZNeG60wgQWkQHQWlG7UsD8+ElJkbl2mx4H7O62EOlKXs2g Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769779" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769779" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871406" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871406" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:49 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Benjamin Berg , Andrei Otcheretianski Subject: [PATCH 19/42] AP: Add parsing of ML probe requests Date: Tue, 21 Nov 2023 01:51:33 +0200 Message-Id: <20231120235156.363852-20-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155251_787487_7AD3704B X-CRM114-Status: GOOD ( 14.56 ) X-Spam-Score: -0.4 (/) 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: Benjamin Berg This adds the parsing of ML probe requests. Handling will be added by a later patch. Signed-off-by: Benjamin Berg Signed-off-by: Andrei Otcheretianski --- src/ap/beacon.c | 14 ++++++ src/common/ieee802_11_common.c | 79 ++++++ [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Benjamin Berg This adds the parsing of ML probe requests. Handling will be added by a later patch. Signed-off-by: Benjamin Berg Signed-off-by: Andrei Otcheretianski --- src/ap/beacon.c | 14 ++++++ src/common/ieee802_11_common.c | 79 ++++++++++++++++++++++++++++++++++ src/common/ieee802_11_common.h | 2 + 3 files changed, 95 insertions(+) diff --git a/src/ap/beacon.c b/src/ap/beacon.c index 232098328d..e8acedd32b 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -1095,6 +1095,10 @@ void handle_probe_req(struct hostapd_data *hapd, size_t csa_offs_len; struct radius_sta rad_info; struct probe_resp_params params; +#ifdef CONFIG_IEEE80211BE + int mld_id; + u16 links; +#endif if (hapd->iconf->rssi_ignore_probe_request && ssi_signal && ssi_signal < hapd->iconf->rssi_ignore_probe_request) @@ -1326,6 +1330,16 @@ void handle_probe_req(struct hostapd_data *hapd, wpa_msg_ctrl(hapd->msg_ctx, MSG_INFO, RX_PROBE_REQUEST "sa=" MACSTR " signal=%d", MAC2STR(mgmt->sa), ssi_signal); +#ifdef CONFIG_IEEE80211BE + if (hapd->conf->mld_ap && elems.probe_req_mle && + parse_ml_probe_req((struct ieee80211_eht_ml *)elems.probe_req_mle, + elems.probe_req_mle_len, &mld_id, &links)) { + wpa_printf(MSG_DEBUG, + "MLD: Got ML probe request with AP MLD ID %d for links %04x", + mld_id, links); + } +#endif /* CONFIG_IEEE80211BE */ + params.req = mgmt; params.is_p2p = !!elems.p2p; params.known_bss = elems.mbssid_known_bss; diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c index 06f82ce303..27d3ff41e5 100644 --- a/src/common/ieee802_11_common.c +++ b/src/common/ieee802_11_common.c @@ -3212,6 +3212,85 @@ struct wpabuf * ieee802_11_defrag(const u8 *data, size_t len, bool ext_elem) } +bool parse_ml_probe_req(const struct ieee80211_eht_ml *ml, size_t ml_len, + int *mld_id, u16 *links) +{ + u16 ml_control; + const struct element *sub; + const u8 *pos; + size_t len; + + *mld_id = -1; + *links = 0xffff; + + ml_control = le_to_host16(ml->ml_control); + + if ((ml_control & MULTI_LINK_CONTROL_TYPE_MASK) != + MULTI_LINK_CONTROL_TYPE_PROBE_REQ) { + wpa_printf(MSG_DEBUG, "MLD: not an ML probe req"); + return false; + } + + if (sizeof(struct ieee80211_eht_ml) + 1 > ml_len) { + wpa_printf(MSG_DEBUG, "MLD: ML probe req too short"); + return false; + } + + pos = ml->variable; + len = pos[0]; + if (len < 1 || sizeof(struct ieee80211_eht_ml) + len > ml_len) { + wpa_printf(MSG_DEBUG, "MLD: ML probe request with invalid length"); + return false; + } + + if (ml_control & EHT_ML_PRES_BM_PROBE_REQ_AP_MLD_ID) { + if (len < 2) { + wpa_printf(MSG_DEBUG, + "MLD: ML probe req too short for MLD ID"); + return false; + } + + *mld_id = pos[1]; + } + pos += len; + + /* Parse sub-elements (if there are any) */ + len = ml_len - len - sizeof(struct ieee80211_eht_ml); + for_each_element_id(sub, 0, pos, len) { + const struct ieee80211_eht_per_sta_profile *sta; + u16 sta_control; + + if (*links == 0xffff) + *links = 0; + + if (sub->datalen < + sizeof(struct ieee80211_eht_per_sta_profile)) { + wpa_printf(MSG_DEBUG, + "MLD: ML probe req %d too short for sta profile", + sub->datalen); + return false; + } + + sta = (struct ieee80211_eht_per_sta_profile *)sub->data; + + /* + * Extract the link ID, do not return whether a complete or + * partial profile was requested. + */ + sta_control = le_to_host16(sta->sta_control); + *links |= BIT(sta_control & EHT_PER_STA_CTRL_LINK_ID_MSK); + } + + if (!for_each_element_completed(sub, pos, len)) { + wpa_printf(MSG_DEBUG, + "MLD: ML probe req sub-elements parsing error"); + return false; + } + + return true; +} + + const u8 * get_ml_ie(const u8 *ies, size_t len, u8 type) { const struct element *elem; diff --git a/src/common/ieee802_11_common.h b/src/common/ieee802_11_common.h index a7d407b65d..6e7d770c0b 100644 --- a/src/common/ieee802_11_common.h +++ b/src/common/ieee802_11_common.h @@ -350,6 +350,8 @@ int ieee802_edmg_is_allowed(struct ieee80211_edmg_config allowed, struct ieee80211_edmg_config requested); struct wpabuf * ieee802_11_defrag(const u8 *data, size_t len, bool ext_elem); +bool parse_ml_probe_req(const struct ieee80211_eht_ml *ml, size_t ml_len, + int *mld_id, u16 *links); const u8 * get_ml_ie(const u8 *ies, size_t len, u8 type); const u8 * get_basic_mle_mld_addr(const u8 *buf, size_t len); From patchwork Mon Nov 20 23:51:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866375 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=A9gVSM0C; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=b5H88DKN; 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 4SZ48t3s09z1ySN for ; Tue, 21 Nov 2023 10:53:50 +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=Qgq3ygUouG9wgBz1GKfLGJDkRfmiPMMJgN2SYSHeOx8=; b=A9gVSM0CkqlHzn W13DmhFaQD177k6RTjUVVglK7xqteRwMjwcaR29eQWu/+bg1jguHEbT0jDsFoJtOwQ4v4hfd9uvLW V07YshH+65iM/3BpuMmlk9iA5jxw/cD3z5YSSn7a4n+b/mZyqhnDUAX5uxg8JPqp7lvttOdSdu3tM o27wMgPfSaVOOGLDTApPUUslnXuVhI0HOnqbSy34GHXCoS0M7knsup++gQ9YOg3D0+959luIJSh2B V7XKcFwylxQOMG4JBx0czea8nEFQqtVOPCHbOsSTyfir3Iuz1g+5fqkCSdLBAG0lw+6+5zSou0A3K JBCOUnKkFuEBe4MupOXg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4p-00F68C-2d; Mon, 20 Nov 2023 23:53:15 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4S-00F5iV-2c for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:52:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524372; x=1732060372; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1gdpIrokTj2COf3CCeGiS3y2LBro5zpYMO3U/uhE/Y0=; b=b5H88DKNXheHFehO3TqDl/ZfwaLeDKe5tmBn2aepBAJqIxBtTOgC32Za VA41hyGQaJ3TlnROl9ndbfFSOnLS14s+TnwZUMjaqsfgBS8XDq5cziAG6 LFdDIazcwiJXZ2633W4bhMkKTmkAww6Lcm0wn/hyOgRZpp9f1fjZcup88 iX+MMQOJHDx8Ri3ibOCWOlVbfUoncvwtJpl1VareicAfrJBn/5z4wFKxP wLRCKtHENTeiwNRf+WX4gFclZbTmTH9EvfCMqZ2in6AH/nQhCDL9+Zx30 y0QHjtIak/Bg9XnDiHiCSM50e7fWkeb5BIoj7ZhqD1SI6tH84NheBbcpG w==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769784" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769784" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871409" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871409" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:51 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Benjamin Berg Subject: [PATCH 20/42] AP: MLO: Add helper to iterate all links of an MLD AP Date: Tue, 21 Nov 2023 01:51:34 +0200 Message-Id: <20231120235156.363852-21-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155252_970006_6D0EFD17 X-CRM114-Status: GOOD ( 11.08 ) X-Spam-Score: -0.4 (/) 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: Benjamin Berg This adds a simple for_each_mld_link helper that sets first variable to the hapd data for every link. It takes the interfaces and MLD ID as arguments and two extra integers as scratch variables (for t [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Benjamin Berg This adds a simple for_each_mld_link helper that sets first variable to the hapd data for every link. It takes the interfaces and MLD ID as arguments and two extra integers as scratch variables (for the interface and bss offsets). Signed-off-by: Benjamin Berg --- src/ap/hostapd.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h index 6f0c0fc66d..cbfd352eee 100644 --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h @@ -776,4 +776,24 @@ int hostapd_mbssid_get_bss_index(struct hostapd_data *hapd); struct hostapd_data * hostapd_mld_get_link_bss(struct hostapd_data *hapd, u8 link_id); int hostapd_link_remove(struct hostapd_data *hapd, u32 count); + +#ifdef CONFIG_IEEE80211BE +#define for_each_mld_link(_link, _bss_idx, _iface_idx, _ifaces, _mld_id) \ + for (_iface_idx = 0; \ + _iface_idx < (_ifaces)->count; \ + _iface_idx++) \ + for (_bss_idx = 0; \ + _bss_idx < \ + (_ifaces)->iface[_iface_idx]->num_bss; \ + _bss_idx++) \ + for (_link = \ + (_ifaces)->iface[_iface_idx]->bss[_bss_idx]; \ + _link && _link->conf->mld_ap && \ + _link->conf->mld_id == _mld_id; \ + _link = NULL) +#else +#define for_each_mld_link(_link, _bss_idx, _iface_idx, _ifaces, _mld_id) \ + if (false) +#endif /* CONFIG_IEEE80211BE */ + #endif /* HOSTAPD_H */ From patchwork Mon Nov 20 23:51:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866379 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=1mKpsF/g; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=MfWiDStX; 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 4SZ4964x7yz1ySN for ; Tue, 21 Nov 2023 10:54:02 +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=nS/pGB7QRnYdrvuQjTYaCiQde5GpKY5aD2g81qIpO3A=; b=1mKpsF/gV6nHNI KsqizoCPhognvd9+K7shnomZHx+aLbCJTkPUeZnycS1VbK1DD8u7PBpVDFHroxWtP9Lu5mRpl21OT iFKrltTay04YEVbDoT+m2ej/I6nj6sEaJ+0UWuKtoGo4r7phbQEDN21pXiAABj0nZnxFuKdvv5sRx 11eN/yELrZVJ56AdSA6ARFCq6ixeHYFAfOH6nY0XUf3W8ip9tiPCVjedwY5CMI8ZAkA/0/eGCzSWx ltnoXhL9WXa8N6k6JK7u7iKGBXqZGxmG3puUf2504vOpzjNiltCEovsA+fdNUmAc/oSoNNiK6MkNu li8jL1GjdLej1nX5N59g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4y-00F6ID-1o; Mon, 20 Nov 2023 23:53:24 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4U-00F5l1-0J for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:52:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524374; x=1732060374; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+YDRKhH5mfOZiGaEdldogN2nPyn7hRqHm8vzMRbNP/M=; b=MfWiDStXu7tNStPTlDnKBNt0/vcpRoOAxR0ysHy59GNhLh5H+q6jeBjN ytn9BUZS9UfeYiU7iuuKzW1o/hpgnz+pW6eGkylUkOssy+HnvvIyjfRNw CfH4ZlX+movrgi88SbQMQEgIWsykoBShwgVZYu4AJWCdgN4gcxvSMczcT 0c2M9LnVcwn3N3CBj7zDdTvwJnjigACdIX5IvzAq+YneaRcu2RAguFFDK CQa9ZkGYsaNFA+wLUSEcUqu4cvm465o5kBvW2menT07gh1ebwl4e6BKs0 zJ3/ncPWfP0PFbvuHWbSjpg5/8juNysGVrlYv0Doyrr9mAUjPpaPEx5bM g==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769789" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769789" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871412" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871412" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:52 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Benjamin Berg , Andrei Otcheretianski Subject: [PATCH 21/42] ML: Add basic handling of ML probe requests Date: Tue, 21 Nov 2023 01:51:35 +0200 Message-Id: <20231120235156.363852-22-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155254_222880_53434B08 X-CRM114-Status: GOOD ( 26.53 ) X-Spam-Score: -0.4 (/) 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: Benjamin Berg This responds by simply embedding most of the IEs from the other links into the ML element. This is not correct really, as inheritance rules should be applied and an inheritance element may need to be [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Benjamin Berg This responds by simply embedding most of the IEs from the other links into the ML element. This is not correct really, as inheritance rules should be applied and an inheritance element may need to be added. Signed-off-by: Benjamin Berg Signed-off-by: Andrei Otcheretianski --- src/ap/beacon.c | 216 +++++++++++++++++++++++++++++++++------- src/ap/ieee802_11.h | 3 + src/ap/ieee802_11_eht.c | 64 ++++++++++-- 3 files changed, 241 insertions(+), 42 deletions(-) diff --git a/src/ap/beacon.c b/src/ap/beacon.c index e8acedd32b..c72da1b88d 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -568,6 +568,11 @@ struct probe_resp_params { const struct ieee80211_mgmt *req; bool is_p2p; + /* Generated IEs will be included inside an ML element */ + bool is_ml_sta_info; + struct hostapd_data *mld_ap; + struct mld_info *mld_info; + struct ieee80211_mgmt *resp; size_t resp_len; u8 *csa_pos; @@ -629,20 +634,18 @@ static size_t hostapd_probe_resp_elems_len(struct hostapd_data *hapd, if (hapd->iconf->punct_bitmap) buflen += EHT_OPER_DISABLED_SUBCHAN_BITMAP_SIZE; - /* - * TODO: Multi-Link element has variable length and can be - * long based on the common info and number of per - * station profiles. For now use 256. - */ - if (hapd->conf->mld_ap) - buflen += 256; + if (!params->is_ml_sta_info && hapd->conf->mld_ap) { + struct hostapd_data *ml_elem_ap = + params->mld_ap ? params->mld_ap : hapd; + + buflen += hostapd_eid_eht_ml_beacon_len( + ml_elem_ap, params->mld_info, !!params->mld_ap); + } } #endif /* CONFIG_IEEE80211BE */ - buflen += hostapd_eid_mbssid_len(hapd, WLAN_FC_STYPE_PROBE_RESP, NULL, - params->known_bss, - params->known_bss_len, NULL); - buflen += hostapd_eid_rnr_len(hapd, WLAN_FC_STYPE_PROBE_RESP); + if (!params->is_ml_sta_info) + buflen += hostapd_eid_rnr_len(hapd, WLAN_FC_STYPE_PROBE_RESP); buflen += hostapd_mbo_ie_len(hapd); buflen += hostapd_eid_owe_trans_len(hapd); buflen += hostapd_eid_dpp_cc_len(hapd); @@ -660,10 +663,13 @@ static u8 * hostapd_probe_resp_fill_elems(struct hostapd_data *hapd, epos = pos + len; - *pos++ = WLAN_EID_SSID; - *pos++ = hapd->conf->ssid.ssid_len; - os_memcpy(pos, hapd->conf->ssid.ssid, hapd->conf->ssid.ssid_len); - pos += hapd->conf->ssid.ssid_len; + if (!params->is_ml_sta_info) { + *pos++ = WLAN_EID_SSID; + *pos++ = hapd->conf->ssid.ssid_len; + os_memcpy(pos, hapd->conf->ssid.ssid, + hapd->conf->ssid.ssid_len); + pos += hapd->conf->ssid.ssid_len; + } /* Supported rates */ pos = hostapd_eid_supp_rates(hapd, pos); @@ -676,13 +682,18 @@ static u8 * hostapd_probe_resp_fill_elems(struct hostapd_data *hapd, /* Power Constraint element */ pos = hostapd_eid_pwr_constraint(hapd, pos); - /* CSA IE */ - csa_pos = hostapd_eid_csa(hapd, pos); - if (csa_pos != pos) - params->csa_pos = csa_pos - 1; - else - params->csa_pos = NULL; - pos = csa_pos; + /* + * CSA IE + * TODO: This should be included inside the ML sta profile + */ + if (!params->is_ml_sta_info) { + csa_pos = hostapd_eid_csa(hapd, pos); + if (csa_pos != pos) + params->csa_pos = csa_pos - 1; + else + params->csa_pos = NULL; + pos = csa_pos; + } /* ERP Information element */ pos = hostapd_eid_erp_info(hapd, pos); @@ -698,13 +709,18 @@ static u8 * hostapd_probe_resp_fill_elems(struct hostapd_data *hapd, pos = hostapd_eid_rm_enabled_capab(hapd, pos, epos - pos); pos = hostapd_get_mde(hapd, pos, epos - pos); - /* eCSA IE */ - csa_pos = hostapd_eid_ecsa(hapd, pos); - if (csa_pos != pos) - params->ecsa_pos = csa_pos - 1; - else - params->ecsa_pos = NULL; - pos = csa_pos; + /* + * eCSA IE + * TODO: This should be included inside the ML sta profile + */ + if (!params->is_ml_sta_info) { + csa_pos = hostapd_eid_ecsa(hapd, pos); + if (csa_pos != pos) + params->ecsa_pos = csa_pos - 1; + else + params->ecsa_pos = NULL; + pos = csa_pos; + } pos = hostapd_eid_supported_op_classes(hapd, pos); pos = hostapd_eid_ht_capabilities(hapd, pos); @@ -748,7 +764,8 @@ static u8 * hostapd_probe_resp_fill_elems(struct hostapd_data *hapd, pos = hostapd_eid_wb_chsw_wrapper(hapd, pos); - pos = hostapd_eid_rnr(hapd, pos, WLAN_FC_STYPE_PROBE_RESP); + if (!params->is_ml_sta_info) + pos = hostapd_eid_rnr(hapd, pos, WLAN_FC_STYPE_PROBE_RESP); pos = hostapd_eid_fils_indic(hapd, pos, 0); pos = hostapd_get_rsnxe(hapd, pos, epos - pos); @@ -775,8 +792,14 @@ static u8 * hostapd_probe_resp_fill_elems(struct hostapd_data *hapd, #ifdef CONFIG_IEEE80211BE if (hapd->iconf->ieee80211be && !hapd->conf->disable_11be) { - if (hapd->conf->mld_ap) - pos = hostapd_eid_eht_ml_beacon(hapd, NULL, pos, true); + struct hostapd_data *ml_elem_ap = + params->mld_ap ? params->mld_ap : hapd; + + if (ml_elem_ap->conf->mld_ap) + pos = hostapd_eid_eht_ml_beacon( + ml_elem_ap, params->mld_info, + pos, !!params->mld_ap); + pos = hostapd_eid_eht_capab(hapd, pos, IEEE80211_MODE_AP); pos = hostapd_eid_eht_operation(hapd, pos); } @@ -882,6 +905,117 @@ void hostapd_gen_probe_resp(struct hostapd_data *hapd, } +#ifdef CONFIG_IEEE80211BE +static void hostapd_fill_probe_resp_ml_params(struct hostapd_data *hapd, + struct probe_resp_params *params, + const struct ieee80211_mgmt *mgmt, + int mld_id, u16 links) +{ + struct probe_resp_params sta_info_params; + struct hostapd_data *link; + u8 probed_mld_id, i, j; + + params->mld_ap = NULL; + params->mld_info = os_zalloc(sizeof(*params->mld_info)); + if (!params->mld_info) + return; + + wpa_printf(MSG_DEBUG, + "MLD: Got ML probe request with AP MLD ID %d for links %04x", + mld_id, links); + + /* + * We want to include the AP MLD ID in the response if it was + * included in the request. + */ + probed_mld_id = mld_id != -1 ? mld_id : hapd->conf->mld_id; + + for_each_mld_link(link, i, j, hapd->iface->interfaces, + probed_mld_id) { + struct mld_link_info *link_info; + size_t buflen; + u8 mld_link_id = link->mld_link_id; + u8 *epos; + + /* + * Set mld_ap iff the ML probe request explicitly + * requested a specific MLD ID. In that case, targeted + * AP may have been a nontransmitted BSSID on the same + * interface. + */ + if (mld_id != -1 && link->iface == hapd->iface) + params->mld_ap = link; + + /* Never duplicate main probe response body */ + if (link == hapd) + continue; + + /* Only include requested links */ + if (!(BIT(mld_link_id) & links)) + continue; + + link_info = ¶ms->mld_info->links[mld_link_id]; + + sta_info_params.req = params->req; + sta_info_params.is_p2p = false; + sta_info_params.is_ml_sta_info = true; + sta_info_params.mld_ap = NULL; + sta_info_params.mld_info = NULL; + + buflen = MAX_PROBERESP_LEN; + buflen += hostapd_probe_resp_elems_len(link, &sta_info_params); + + if (buflen > sizeof(link_info->resp_sta_profile)) { + wpa_printf(MSG_DEBUG, + "MLD: Not including link %d in ML probe response (%zu bytes is too long)", + mld_link_id, buflen); + goto fail; + } + + /* + * NOTE: This does not properly handle inheritance and + * various other things. + */ + link_info->valid = true; + epos = link_info->resp_sta_profile; + + /* capabilities is the only fixed parameter */ + WPA_PUT_LE16(link_info->resp_sta_profile, + hostapd_own_capab_info(hapd)); + + epos = hostapd_probe_resp_fill_elems( + link, &sta_info_params, + link_info->resp_sta_profile + 2, + sizeof(link_info->resp_sta_profile) - 2); + link_info->resp_sta_profile_len = + epos - link_info->resp_sta_profile; + os_memcpy(link_info->local_addr, link->own_addr, + ETH_ALEN); + + wpa_printf(MSG_DEBUG, + "MLD: ML probe response includes link sta info for %d: %zu bytes (estimate %zu)", + mld_link_id, + link_info->resp_sta_profile_len, + buflen); + } + + if (mld_id != -1 && !params->mld_ap) { + wpa_printf(MSG_DEBUG, + "MLD: No nontransmitted BSSID for MLD ID %d", + mld_id); + goto fail; + } + + return; + +fail: + os_free(params->mld_info); + params->mld_ap = NULL; + params->mld_info = NULL; +} +#endif /* CONFIG_IEEE80211BE */ + + enum ssid_match_result { NO_SSID_MATCH, EXACT_SSID_MATCH, @@ -1330,13 +1464,14 @@ void handle_probe_req(struct hostapd_data *hapd, wpa_msg_ctrl(hapd->msg_ctx, MSG_INFO, RX_PROBE_REQUEST "sa=" MACSTR " signal=%d", MAC2STR(mgmt->sa), ssi_signal); + os_memset(¶ms, 0, sizeof(params)); + #ifdef CONFIG_IEEE80211BE if (hapd->conf->mld_ap && elems.probe_req_mle && parse_ml_probe_req((struct ieee80211_eht_ml *)elems.probe_req_mle, elems.probe_req_mle_len, &mld_id, &links)) { - wpa_printf(MSG_DEBUG, - "MLD: Got ML probe request with AP MLD ID %d for links %04x", - mld_id, links); + hostapd_fill_probe_resp_ml_params(hapd, ¶ms, mgmt, + mld_id, links); } #endif /* CONFIG_IEEE80211BE */ @@ -1344,7 +1479,12 @@ void handle_probe_req(struct hostapd_data *hapd, params.is_p2p = !!elems.p2p; params.known_bss = elems.mbssid_known_bss; params.known_bss_len = elems.mbssid_known_bss_len; + params.is_ml_sta_info = false; + hostapd_gen_probe_resp(hapd, ¶ms); + + os_free(params.mld_info); + if (!params.resp) return; @@ -1419,6 +1559,9 @@ static u8 * hostapd_probe_resp_offloads(struct hostapd_data *hapd, params.is_p2p = false; params.known_bss = NULL; params.known_bss_len = 0; + params.is_ml_sta_info = false; + params.mld_ap = NULL; + params.mld_info = NULL; hostapd_gen_probe_resp(hapd, ¶ms); *resp_len = params.resp_len; @@ -1453,6 +1596,9 @@ static u8 * hostapd_unsol_bcast_probe_resp(struct hostapd_data *hapd, probe_params.is_p2p = false; probe_params.known_bss = NULL; probe_params.known_bss_len = 0; + probe_params.is_ml_sta_info = false; + probe_params.mld_ap = NULL; + probe_params.mld_info = NULL; hostapd_gen_probe_resp(hapd, &probe_params); params->unsol_bcast_probe_resp_tmpl_len = probe_params.resp_len; diff --git a/src/ap/ieee802_11.h b/src/ap/ieee802_11.h index ada6dc5e88..dce26c398d 100644 --- a/src/ap/ieee802_11.h +++ b/src/ap/ieee802_11.h @@ -94,6 +94,9 @@ u8 * hostapd_eid_eht_ml_beacon(struct hostapd_data *hapd, u8 *eid, bool include_mld_id); u8 * hostapd_eid_eht_ml_assoc(struct hostapd_data *hapd, struct sta_info *info, u8 *eid); +size_t hostapd_eid_eht_ml_beacon_len(struct hostapd_data *hapd, + struct mld_info *info, + bool include_mld_id); struct wpabuf * hostapd_ml_auth_resp(struct hostapd_data *hapd); const u8 * hostapd_process_ml_auth(struct hostapd_data *hapd, const struct ieee80211_mgmt *mgmt, diff --git a/src/ap/ieee802_11_eht.c b/src/ap/ieee802_11_eht.c index 7b60e6647a..3c5334a203 100644 --- a/src/ap/ieee802_11_eht.c +++ b/src/ap/ieee802_11_eht.c @@ -455,7 +455,8 @@ static u8 * hostapd_eid_eht_basic_ml_common(struct hostapd_data *hapd, * BSS Parameters Change Count (1) + EML Capabilities (2) + * MLD Capabilities and Operations (2) */ - common_info_len = 13; +#define EHT_ML_COMMON_INFO_LEN 13 + common_info_len = EHT_ML_COMMON_INFO_LEN; if (include_mld_id) { /* AP MLD ID */ @@ -503,8 +504,9 @@ static u8 * hostapd_eid_eht_basic_ml_common(struct hostapd_data *hapd, * beacon interval (2) + TSF offset (8) + DTIM info (2) + BSS * parameters change counter (1) + station profile length. */ - const size_t fixed_len = 22; - size_t total_len = fixed_len + link->resp_sta_profile_len; +#define EHT_ML_STA_INFO_LEN 22 + size_t total_len = EHT_ML_STA_INFO_LEN + + link->resp_sta_profile_len; /* Skip the local one */ if (link_id == hapd->mld_link_id || !link->valid) @@ -535,10 +537,8 @@ static u8 * hostapd_eid_eht_basic_ml_common(struct hostapd_data *hapd, EHT_PER_STA_CTRL_BSS_PARAM_CNT_PRESENT_MSK; wpabuf_put_le16(buf, control); - /* STA Info */ - /* STA Info Length */ - wpabuf_put_u8(buf, fixed_len - 2); + wpabuf_put_u8(buf, EHT_ML_STA_INFO_LEN - 2); wpabuf_put_data(buf, link->local_addr, ETH_ALEN); wpabuf_put_le16(buf, link_bss->iconf->beacon_int); @@ -563,7 +563,7 @@ static u8 * hostapd_eid_eht_basic_ml_common(struct hostapd_data *hapd, ptr = link->resp_sta_profile; len = link->resp_sta_profile_len; - slice_len = 255 - fixed_len; + slice_len = 255 - EHT_ML_STA_INFO_LEN; wpabuf_put_data(buf, ptr, slice_len); len -= slice_len; @@ -700,6 +700,48 @@ static u8 *hostapd_eid_eht_reconf_ml(struct hostapd_data *hapd, } +static size_t hostapd_eid_eht_ml_len(struct mld_info *info, + bool include_mld_id) +{ + size_t len = 0; + size_t eht_ml_len = 2 + EHT_ML_COMMON_INFO_LEN; + u8 link_id; + + if (include_mld_id) + eht_ml_len += 1; + + for (link_id = 0; + info && link_id < ARRAY_SIZE(info->links); + link_id++) { + struct mld_link_info *link; + int sta_len = EHT_ML_STA_INFO_LEN; + + link = &info->links[link_id]; + if (!link->valid) + continue; + + sta_len += link->resp_sta_profile_len; + + /* Element data and (fragmentation) headers */ + eht_ml_len += sta_len; + eht_ml_len += 2 + sta_len / 255 * 2; + } + + /* Element data */ + len += eht_ml_len; + + /* First header (254 bytes of data) */ + len += 3; + + /* Fragmentation headers; +1 for shorter first chunk */ + len += (eht_ml_len + 1) / 255 * 2; + + return len; +} +#undef EHT_ML_COMMON_INFO_LEN +#undef EHT_ML_STA_INFO_LEN + + u8 * hostapd_eid_eht_ml_beacon(struct hostapd_data *hapd, struct mld_info *info, u8 *eid, bool include_mld_id) @@ -721,6 +763,14 @@ u8 * hostapd_eid_eht_ml_assoc(struct hostapd_data *hapd, struct sta_info *info, } +size_t hostapd_eid_eht_ml_beacon_len(struct hostapd_data *hapd, + struct mld_info *info, + bool include_mld_id) +{ + return hostapd_eid_eht_ml_len(info, include_mld_id); +} + + struct wpabuf * hostapd_ml_auth_resp(struct hostapd_data *hapd) { struct wpabuf *buf = wpabuf_alloc(12); From patchwork Mon Nov 20 23:51:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866382 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=HCJoU5HZ; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=kgRq5pTY; 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 4SZ49B4ztMz1ySV for ; Tue, 21 Nov 2023 10:54:06 +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=n//YdBcxyzKzajrGCR1r+o8+mw/T8CYjmTaCuXW+ACc=; b=HCJoU5HZnSxnSp nx2rdMHp7gYfHbmfIoxiB56tDCIjWQIfj6weazDRv5g/gwhKv/aLrLmD2svEQWj0+AgLj5OwMto7P YMMGoUjLJM69lKdJ2SN3gDqd6FiilcYMllt6jllolALSF5+sR2P2TiBGNqPRxoFov0Gn5/KnWjmsk oG1Rxkvg/fT95MyXIXDWNAqWvBD7Dok/VdqgIAmSWWh2yhd3LRrttSBY8UoFDCsFWY54SHvkCoYqh Veez8ZsgQL1yyAzwHBgoKGLvG8O3k2ug/LLnIxb36R1WVEVNhvarQKGZPsqboUJ2Ftf/aH8ge5GeA fOzBxVfR3YFlToo+RvXQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E54-00F6Pu-0q; Mon, 20 Nov 2023 23:53:30 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4V-00F5iV-0u for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:52:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524375; x=1732060375; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=P+P3bEgIT/ekWUc6eHYZ3vSJCwMKOTeXi5eXbrD/8C8=; b=kgRq5pTYAg/dtSs+g/oNWT33o4EKlttePOn5q514IyWEiik2lP4fRUiV dqcwwpZKe5x4l95u4pjr7xad0RHLpZF+SL7JibA3A5FtlsCt1drnshFS0 JI71c0haRClmsv1eDhP1ZHZXqOC+/pEQW6xt+I2Z5k5UTt6fjK2IBGuim GK8bQPH46+/GeT75LNxVdhlmQD+b74T8P8C6WywVq2oiAatWXy8zyW4PE j1rkMqwoUnHsCgILhcZxv8Dxpzv5qDvA+pQGBU+JtTvI64M9ctykQB0p3 GBbU+hOHsZ7Kp5bC8b6acKoKPKe8otM5aVdgISwGLuMS7CCvwJdYni/kw A==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769793" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769793" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871415" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871415" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:53 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Andrei Otcheretianski , Benjamin Berg Subject: [PATCH 22/42] AP: Don't include MLD ID in beacons Date: Tue, 21 Nov 2023 01:51:36 +0200 Message-Id: <20231120235156.363852-23-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155255_439196_AE90DB48 X-CRM114-Status: GOOD ( 11.75 ) X-Spam-Score: -0.4 (/) 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: The IEEE 802.11be/D3.0 specification section 9.4.2.312.2.3 states that the MLD ID should only be included in some ML probe responses. Beacons shouldn't include MLD ID. Signed-off-by: Benjamin Berg Signed-off-by: Andrei Otcheretianski --- src/ap/beacon.c | 2 +- tests/hwsim/test_eht.py | 2 +- 2 files changed, [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 The IEEE 802.11be/D3.0 specification section 9.4.2.312.2.3 states that the MLD ID should only be included in some ML probe responses. Beacons shouldn't include MLD ID. Signed-off-by: Benjamin Berg Signed-off-by: Andrei Otcheretianski --- src/ap/beacon.c | 2 +- tests/hwsim/test_eht.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ap/beacon.c b/src/ap/beacon.c index c72da1b88d..66e59ebf69 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -2195,7 +2195,7 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd, if (hapd->iconf->ieee80211be && !hapd->conf->disable_11be) { if (hapd->conf->mld_ap) tailpos = hostapd_eid_eht_ml_beacon(hapd, NULL, - tailpos, true); + tailpos, false); tailpos = hostapd_eid_eht_capab(hapd, tailpos, IEEE80211_MODE_AP); tailpos = hostapd_eid_eht_operation(hapd, tailpos); diff --git a/tests/hwsim/test_eht.py b/tests/hwsim/test_eht.py index 3e4c10ff67..530128c9c6 100644 --- a/tests/hwsim/test_eht.py +++ b/tests/hwsim/test_eht.py @@ -250,7 +250,7 @@ def test_eht_mld_discovery(dev, apdev): rnr_pattern = re.compile(".*ap_info.*, mld ID=0, link ID=", re.MULTILINE) - ml_pattern = re.compile(".*multi-link:.*, MLD ID=0x0", re.MULTILINE) + ml_pattern = re.compile(".*multi-link:.*, MLD addr=.*", re.MULTILINE) bss = wpas.request("BSS " + hapd0.own_addr()) logger.info("BSS 0: " + str(bss)) From patchwork Mon Nov 20 23:51:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866383 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=fWN3efKj; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=H8lb3vRz; 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 4SZ49D6WDxz1ySN for ; Tue, 21 Nov 2023 10:54:08 +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=QH3hOWFOXBSYXbnJLywx64KxmnoqemtzZ2FaX+56p5M=; b=fWN3efKjB6PmxS 4hkD5miCfhvPx2lzbXyMpYLknA/96Rrjmn44kcKyhISU6/PMYle0/flRrUXtD1T6OkeG+cyPr28X5 71TIIDtoBTtDftcbIysLz3wckWowBLu7zPVd9wA+ZoEOM3EoSnu4PZQ13GcXGw5F72+Gl72f437a+ AOjpKclSnKv9XP9jaEOuCYBJxiRpRx/1Ajr09Zt17tfZHj5pvGznsqD+P3iXXI0GbVyhue2XMvDAX HmEMKXxXmD8CQDO1HAJsg9WaqAHt12ukyBT1u9u8gojnxHHRloGpXeB36/MkAGfRxjK/KWadqIZoT 2LMocGO9wlGorWbdzXgQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E58-00F6UF-1P; Mon, 20 Nov 2023 23:53:34 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4X-00F5q7-0A for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:52:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524377; x=1732060377; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=itu8Mv6sOjslbiy/WMBScmNzWzhFyG8np6/vvBOWRNo=; b=H8lb3vRzJabHVo69tY/ggbNFMCsKAlGsWkzV8llt+wAb5x13NJTjJZVT z0ufZBzizUdY7sAOJbNOQYB/Mee+JAY3zqL1oCnxNE8xRVrSaL+5kh/RS V+46051V2q4uMjKtFZRc3n6iKyqKKxK1HwXO2tvO0vSLEZvXQT7yqimse tnRfqKcNULDPuYY2knjjpByG4KiJ7+Q091+lTpTCtXbGofBweUOybiFEP 1dKfkUzGbquk6iSle7T6sXnVlSLPw7+KOWl233nuQnLKSeOqq46KM/Jcf se/d8Y1TX12W7+yX94l69i0yhY9h4w797D1j7d+UHyUJisDWK6IVILaln w==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769795" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769795" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871420" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871420" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:55 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Ilan Peer , Andrei Otcheretianski Subject: [PATCH 23/42] scan: Include AP MLD ID in ML probe request if needed Date: Tue, 21 Nov 2023 01:51:37 +0200 Message-Id: <20231120235156.363852-24-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155257_192197_29FC8640 X-CRM114-Status: GOOD ( 16.97 ) X-Spam-Score: -0.4 (/) 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: Ilan Peer According to section 35.3.4.2 in Draft P802.11be_D3.1, the AP MLD ID must be included in the Probe Request ML element in case it is sent to a transmitted BSS in which case it should be set to 0. If it [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Ilan Peer According to section 35.3.4.2 in Draft P802.11be_D3.1, the AP MLD ID must be included in the Probe Request ML element in case it is sent to a transmitted BSS in which case it should be set to 0. If it is sent to an non-transmitted BSSID, the AP MLD ID should not be included. Signed-off-by: Ilan Peer Signed-off-by: Andrei Otcheretianski --- wpa_supplicant/bss.c | 7 ++++++- wpa_supplicant/bss.h | 3 ++- wpa_supplicant/events.c | 20 +++++++++++++++++--- wpa_supplicant/sme.c | 3 +-- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c index 401df12fea..510eedb87f 100644 --- a/wpa_supplicant/bss.c +++ b/wpa_supplicant/bss.c @@ -1570,6 +1570,7 @@ wpa_bss_parse_ml_rnr_ap_info(struct wpa_supplicant *wpa_s, * should be initialized and #MAX_NUM_MLD_LINKS elements long * @missing_links: Result bitmask of links that were not discovered (or %NULL) * @ssid: Target SSID (or %NULL) + * @ap_mld_id: on return would hold the corresponding AP MLD ID (or %NULL) * Returns: 0 on success or -1 for non-MLD or parsing failures * * Parses the Basic Multi-Link element of the BSS into @link_info using the scan @@ -1581,7 +1582,8 @@ int wpa_bss_parse_basic_ml_element(struct wpa_supplicant *wpa_s, struct wpa_bss *bss, u8 *ap_mld_addr, u16 *missing_links, - struct wpa_ssid *ssid) + struct wpa_ssid *ssid, + u8 *ap_mld_id) { struct ieee802_11_elems elems; struct wpabuf *mlbuf; @@ -1743,6 +1745,9 @@ int wpa_bss_parse_basic_ml_element(struct wpa_supplicant *wpa_s, if (missing_links) *missing_links = missing; + if (ap_mld_id) + *ap_mld_id = mbssid_idx; + ret = 0; out: wpabuf_free(mlbuf); diff --git a/wpa_supplicant/bss.h b/wpa_supplicant/bss.h index bacf0a8e9c..7b13ef96b8 100644 --- a/wpa_supplicant/bss.h +++ b/wpa_supplicant/bss.h @@ -216,7 +216,8 @@ int wpa_bss_parse_basic_ml_element(struct wpa_supplicant *wpa_s, struct wpa_bss *bss, u8 *ap_mld_addr, u16 *missing_links, - struct wpa_ssid *ssid); + struct wpa_ssid *ssid, + u8 *ap_mld_id); u16 wpa_bss_parse_reconf_ml_element(struct wpa_supplicant *wpa_s, struct wpa_bss *bss); diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index bd6630ea7e..e47445e3f7 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -1135,7 +1135,7 @@ static bool wpas_valid_ml_bss(struct wpa_supplicant *wpa_s, struct wpa_bss *bss) { u16 removed_links; - if (wpa_bss_parse_basic_ml_element(wpa_s, bss, NULL, NULL, NULL)) + if (wpa_bss_parse_basic_ml_element(wpa_s, bss, NULL, NULL, NULL, NULL)) return true; if (bss->n_mld_links == 0) @@ -1853,6 +1853,7 @@ static int wpa_supplicant_connect_ml_missing(struct wpa_supplicant *wpa_s, { int *freqs; u16 missing_links = 0, removed_links; + u8 ap_mld_id; if (!((wpa_s->drv_flags2 & WPA_DRIVER_FLAGS2_MLO) && (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME))) @@ -1860,7 +1861,8 @@ static int wpa_supplicant_connect_ml_missing(struct wpa_supplicant *wpa_s, /* Try to resolve any missing link information */ if (wpa_bss_parse_basic_ml_element(wpa_s, selected, NULL, - &missing_links, ssid) || + &missing_links, ssid, + &ap_mld_id) || !missing_links) return 0; @@ -1892,7 +1894,19 @@ static int wpa_supplicant_connect_ml_missing(struct wpa_supplicant *wpa_s, wpa_s->manual_scan_freqs = freqs; os_memcpy(wpa_s->ml_probe_bssid, selected->bssid, ETH_ALEN); - wpa_s->ml_probe_mld_id = -1; + + /* + * In case the ML probe request is intended to retrieve information from + * the transmitted BSS, then the AP MLD ID should be included and should + * be set to zero. + * In case the ML probe requested is intended to retrieve information + * from a non-transmitted BSS, the the AP MLD ID should not be included. + */ + if (ap_mld_id) + wpa_s->ml_probe_mld_id = -1; + else + wpa_s->ml_probe_mld_id = 0; + wpa_s->ml_probe_links = missing_links; wpa_s->normal_scans = 0; diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index f6f7e7fa75..4d75c0a676 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -577,10 +577,9 @@ static void sme_send_authentication(struct wpa_supplicant *wpa_s, if (wpa_s->drv_flags2 & WPA_DRIVER_FLAGS2_MLO && !wpa_bss_parse_basic_ml_element(wpa_s, bss, wpa_s->ap_mld_addr, - NULL, ssid) && bss->n_mld_links) { + NULL, ssid, NULL) && bss->n_mld_links) { wpa_printf(MSG_DEBUG, "MLD: In authentication"); wpas_sme_set_mlo_links(wpa_s, bss); - #ifdef CONFIG_TESTING_OPTIONS bss = wpas_ml_connect_pref(wpa_s, bss); From patchwork Mon Nov 20 23:51:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866385 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=gNdk++mZ; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=M60e9Egn; 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 4SZ49G013Rz1ySN for ; Tue, 21 Nov 2023 10:54:09 +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=Vpzm951DMaOQfOrGAnCCc+p2wJQEqvS/L3FYskJPqQQ=; b=gNdk++mZPBHWJH a9IgZOV4sSs7eOSO90dVTT7Uz/usEo4MPgzUyHlxJVP67GfHHhSvH4TVLfRLgUWOkTLmWxAU+sBck VggwXx0MJBXXYdB8k19nEOY9GHtP++xPYf/MpmOVTR1VAI5Q5B/HlT7L224xAt1ah7M1NzfHMCVlF 6gqJaD2u1BccScJMsGrt/t+qUFidGeR1MaDq6YP0GcwcH2Sqk40Z4W0MY9J9RNJN8l1bGKUQQpGgq nlVkTssot6kXcztLDeS2VgoaMnoMlgediRKY4tQVAsvqZrZ2w07JNB24t2udUL2QUDGYy0iYyAMy/ u3c/ztZanUekJFeP6bXQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E5A-00F6Wj-25; Mon, 20 Nov 2023 23:53:36 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4X-00F5l1-2l for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:52:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524377; x=1732060377; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Uqros3eVTUA4k7426kAf1c2wB94MoZSxa6O1FGbUI3Y=; b=M60e9EgnAkH8iez/yr+ewZS5tIY63MYZdG6h/+BkKhs7OlwqI6wwgisr g6Mr3rlEiGq9xj3zwLOn99vwS15oNgHZKpGan3Kuh6nFF/pmgci+GnQMQ ekZaF3UiMZkODPCx+Vh066WLWP+CpJtsfEYZMR/RiRDyzrnGyv9I05X8s C2mzLmd07CVc7rWNKyuzIBLPOVTit2p5zcatBW7A8kX9oJM/JQez/rQOJ nO4rxzW42j3a//diVzdFCRd8m4HVDmzugkm4kO/5xTMib8JkgJjPq3bes 5XCGjGWh8F64lAOxrMGF8CWOVrd/zM7VT5DI0OnL/diIW2F04yFlRLS66 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769807" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769807" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871424" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871424" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:56 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Ilan Peer Subject: [PATCH 24/42] scan: MLD: Include SSID in ML probe request Date: Tue, 21 Nov 2023 01:51:38 +0200 Message-Id: <20231120235156.363852-25-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155258_150624_02C81CB5 X-CRM114-Status: GOOD ( 10.33 ) X-Spam-Score: -0.4 (/) 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: Ilan Peer To improve chances with APs that do not reply to probe request with short SSID or with direct BSSID. Signed-off-by: Ilan Peer --- wpa_supplicant/events.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Ilan Peer To improve chances with APs that do not reply to probe request with short SSID or with direct BSSID. Signed-off-by: Ilan Peer --- wpa_supplicant/events.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index e47445e3f7..b77cc83c94 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -1907,6 +1907,24 @@ static int wpa_supplicant_connect_ml_missing(struct wpa_supplicant *wpa_s, else wpa_s->ml_probe_mld_id = 0; + if (ssid && ssid->ssid_len) { + os_free(wpa_s->ssids_from_scan_req); + wpa_s->num_ssids_from_scan_req = 0; + + wpa_s->ssids_from_scan_req = + os_zalloc(sizeof(struct wpa_ssid_value)); + + if (wpa_s->ssids_from_scan_req) { + wpa_printf(MSG_DEBUG, + "MLD: ML probe: with direct SSID"); + + wpa_s->num_ssids_from_scan_req = 1; + wpa_s->ssids_from_scan_req[0].ssid_len = ssid->ssid_len; + os_memcpy(wpa_s->ssids_from_scan_req[0].ssid, + ssid->ssid, ssid->ssid_len); + } + } + wpa_s->ml_probe_links = missing_links; wpa_s->normal_scans = 0; From patchwork Mon Nov 20 23:51:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866384 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=V9Cbh/JP; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=XBtlftsr; 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 4SZ49F2R52z1ySS for ; Tue, 21 Nov 2023 10:54:09 +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=b6myafe7+gbTjssQ64wYJJntFX1xmeCO63qYTL4nFvI=; b=V9Cbh/JP1uepin v2fMYEmN7jPvmrcVuRwSg9Guta6yhKZ1GIML9dudHkDUEmDvW2HlCUic40SecIbwAD8ukzYXHHpAx yNXz11ZQi6qVAQLPb+btPxo3u1L3ANvd/HKPetOAfw9Ac+fe7kOrA7v0kmMmIYydejT0CcdXswOS4 /MPPJBZxTAv0W4Lon3oCEOv/tQTh6AA+q03JCeEviVIDUs6JLiKn4CId28lJ0RGW7zjB9Etifbc/U 4KPvNv0OUgWqWnFINUmQa5xuZLUv+O3Natr+9haju2RF3uCXzlkOl40NqO0GZuYlTj1qxtoz2xWvt 7lFofDOIrWtKEdb3RtUw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E5C-00F6YS-1Z; Mon, 20 Nov 2023 23:53:38 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4Y-00F5iV-34 for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:53:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524378; x=1732060378; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LQZPM2ENe6nh6EV3XJ8QAWpcrYODC1RnENxJs+H7ycg=; b=XBtlftsr8ZUGPtDWjDGZWOcV1/BezvMktucX3j3Ig9DMDgc/RhrSWHEq nVOVwfBu76FJoFPieiByV+IJVCO/n1tvMSD5bLvOlDYu3uFbg4KQMDT8I pzxmHeqo+fRwEakQcdnSboqFBr1bFsBmpwyYsMhEdj5V/9msGfzz5xQPY CZdF0urwFEARViNaVhwsjRezxoIR4FF5f7+Qpe6Ra/zAkHpkaZQ8lKuL+ 3LD5fybAvW5OOBhxCw1moiwahsTJvqJPcUalQctTJx16z9HR8nG65fq74 +ZNYeSXXn+smKqvWPk/rLisb79NRsOyNZvmwXPuYHbGrVGUFNoqHpzPMl g==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769808" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769808" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871429" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871429" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:57 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Andrei Otcheretianski Subject: [PATCH 25/42] AP: Avoid setting same MLD and link address Date: Tue, 21 Nov 2023 01:51:39 +0200 Message-Id: <20231120235156.363852-26-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155259_047374_A735940A X-CRM114-Status: GOOD ( 14.63 ) X-Spam-Score: -0.4 (/) 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: For MLD AP, when bssid configuration is specified without mld_addr, first link address is used as mld address as well. Though the spec allows it, current implementation and the kernel aren't happy abo [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 For MLD AP, when bssid configuration is specified without mld_addr, first link address is used as mld address as well. Though the spec allows it, current implementation and the kernel aren't happy about it. Better avoid this. Signed-off-by: Andrei Otcheretianski --- hostapd/main.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hostapd/main.c b/hostapd/main.c index fcb01f60e1..32083c0840 100644 --- a/hostapd/main.c +++ b/hostapd/main.c @@ -241,14 +241,19 @@ static int hostapd_driver_init(struct hostapd_iface *iface) params.global_priv = global.drv_priv[i]; break; } + params.bssid = b; #ifdef CONFIG_IEEE80211BE /* * Use the configured MLD MAC address as the interface hardware address * if this AP is a part of an AP MLD. */ - if (!is_zero_ether_addr(hapd->conf->mld_addr) && hapd->conf->mld_ap) - params.bssid = hapd->conf->mld_addr; + if (hapd->conf->mld_ap) { + if (!is_zero_ether_addr(hapd->conf->mld_addr)) + params.bssid = hapd->conf->mld_addr; + else + params.bssid = NULL; + } #endif /* CONFIG_IEEE80211BE */ params.ifname = hapd->conf->iface; From patchwork Mon Nov 20 23:51:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866386 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=urxP7moh; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=L1Z26bwC; 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 4SZ49K5Qc9z1ySN for ; Tue, 21 Nov 2023 10:54:13 +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=kVT+8zlXRHua0I8q4ZSD0NhQVUd8VI8Alh0vDziA/ow=; b=urxP7moh5vcgZ2 lSyZxC4O1PM3hhtL3QaBSBd86z533PY820LB3udTSQIdM9BY6dqXPp6cI/8jgn9L+VTY9uVQcbfaO Ir3cYZ9RRML2L7tauGYL20XAdpQVX+ur6PvCJqXehxiryZkm7MPDQBpYznO/EQKOjJUW8E6TFnkW4 givuaskwoVEeEqtskmV3+H/eIwDjdT7FqHpILGQ0x05bQUVxs5opcPbU69bX4wZb7xCHJ0F+Vp8fM /KOJ0LnhMy0/k4ijEeMhdsqiLhW48/1YU/yvLzC+sUE/SaufK5URa9SDGxS3DQBvTQT3Ev8791Wxt 5K9gsM6vlHFDnPsCLvvQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E5E-00F6bU-1i; Mon, 20 Nov 2023 23:53:40 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4a-00F5iV-1G for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:53:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524380; x=1732060380; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MQVrohPh8tpO76xjgFb+xTVmPmKHHxA2K6/kqfOlPZo=; b=L1Z26bwCfvEc9PL9NM0E1wMPVloQypARXaBk+W7wfD5QAQsBG/NSXGuZ H7OtJcJmWoYcS6aHC/c437iSNpm41c1mGiewiWGEzENFmqE0CGSDVFcux n5j04aoomthRZIC5vuLKYIuKWANOxOBx16eAEQZaXN2Qvw2M+PwoMmc+A VpMmj+qOH1nlR0RyZg8j+X9Pi3SGUkn3S7ASX1tZ+/6vydRuyh1Izz68D OhRCBiifM8hRTYtbtreTSMa+EqRdNykvsSIS9jylQxpHO84GVedzmqjXh jJ9xOhzcPPPLX10qpeGkhtcj7TYSUQfxw0X0v3lVULfAMs33gmx7YV9nm w==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769811" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769811" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871432" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871432" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:52:58 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Benjamin Berg , Andrei Otcheretianski Subject: [PATCH 26/42] MLD: Use MLD address for deauthentication Date: Tue, 21 Nov 2023 01:51:40 +0200 Message-Id: <20231120235156.363852-27-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155300_482943_9DCBD1D7 X-CRM114-Status: GOOD ( 14.75 ) X-Spam-Score: -0.4 (/) 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: Benjamin Berg When connecting, pending_bssid is set to the main link that we are authenticating/associating on. Later on, the MLD address will be stored in the bssid, but we may also try to DEAUTH before we are con [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Benjamin Berg When connecting, pending_bssid is set to the main link that we are authenticating/associating on. Later on, the MLD address will be stored in the bssid, but we may also try to DEAUTH before we are connected and then pending_bssid is not yet set to the MLD address. As such, use the ap_mld_addr instead of pending_bssid if n_mld_links is non-zero. This is the sensible thing to do and expected behaviour on nl80211. Signed-off-by: Benjamin Berg Signed-off-by: Andrei Otcheretianski --- wpa_supplicant/sme.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index 4d75c0a676..5240490019 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -2668,10 +2668,16 @@ int sme_update_ft_ies(struct wpa_supplicant *wpa_s, const u8 *md, static void sme_deauth(struct wpa_supplicant *wpa_s, const u8 **link_bssids) { int bssid_changed; + u8 *bssid; bssid_changed = !is_zero_ether_addr(wpa_s->bssid); - if (wpa_drv_deauthenticate(wpa_s, wpa_s->pending_bssid, + if (wpa_s->valid_links) + bssid = wpa_s->ap_mld_addr; + else + bssid = wpa_s->pending_bssid; + + if (wpa_drv_deauthenticate(wpa_s, bssid, WLAN_REASON_DEAUTH_LEAVING) < 0) { wpa_msg(wpa_s, MSG_INFO, "SME: Deauth request to the driver " "failed"); @@ -2707,8 +2713,14 @@ void sme_event_assoc_reject(struct wpa_supplicant *wpa_s, if (wpa_s->current_bss) { struct wpa_bss *bss = wpa_s->current_bss; struct wpa_ssid *ssid = wpa_s->current_ssid; + u8 *bssid; + + if (wpa_s->valid_links) + bssid = wpa_s->ap_mld_addr; + else + bssid = wpa_s->pending_bssid; - wpa_drv_deauthenticate(wpa_s, wpa_s->pending_bssid, + wpa_drv_deauthenticate(wpa_s, bssid, WLAN_REASON_DEAUTH_LEAVING); wpas_connect_work_done(wpa_s); wpa_supplicant_mark_disassoc(wpa_s); From patchwork Mon Nov 20 23:51:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866387 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=lP+y/bBu; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=EGJK0kql; 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 4SZ49N5zGkz1ySN for ; Tue, 21 Nov 2023 10:54:16 +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=VXGGGoczHYUqb3dfqpyIXxALjHiVCCJL6FmAUeARKqk=; b=lP+y/bBu03DOS8 tVRZeRIUS9Ktq0WHApJq285nKXgXHVmyHjnmmHd9y1qHSaUNt0r6a9815M+aTz+CF+vr6jQXZJ9Ki EWOR85kpKS24jnZE9Icr5Upk7vvZzNBBhlm0OTnp6K2NEZ0FzndTpg4lUV5HReReG2CfvX8rUwHNM jTgtwvp+X3d4ogp7dA6UPTPa4CqaKybcg0PMNr7dhqyhNuTIfMyD1lpQ3uty7PmgBXWiyDlppjH0D LqnUYaZSwhtAcDyz8+rQFh6CnhsGWWMz3mBJjOGx5xoMZqPsb3QV8kl7+QXyeIZRMwvGYjftRQaT5 g0S0lkDjsp6rFzgr5l3Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E5H-00F6ec-0b; Mon, 20 Nov 2023 23:53:43 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4b-00F5uJ-1t for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:53:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524381; x=1732060381; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KCPP/mssp9I4Td8d9UfVpiak2AE98svA47bHqJW6bLc=; b=EGJK0kql8o2OCvspAFGfbYbJC4tYObhpOPasLr7MWvec2i0bp2Gyvyzr hY1NcM4fI8S0VnsGZtsyR5sszutBeREEyv1kVr0Ye2xTBqnssy3KcnS5f tBUptskKnnYRRuZksLordSDnW2gUjSvgsBE+LKH1tIp2Hdgq1+6GQTM3d ZjhBtbuUnVWuD01ZVmkZGCnanrFRNICcS6aDfyQUjp+ZwwKqSev1oWPD+ V7KH2EGvU/k7INO/8EBl6tFNy8Q3vR9YJQ/ifmi4sdC7u06Csb0/1VIkt 6jgdXJ2J1NuW2VZCXCxzeuBxtlwpVLG5DaAzVEatAB3WwR66H04iI2lbi g==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769815" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769815" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871439" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871439" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:00 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Ilan Peer Subject: [PATCH 27/42] AP: Use AP MLD address for SA query and response when needed Date: Tue, 21 Nov 2023 01:51:41 +0200 Message-Id: <20231120235156.363852-28-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155301_740689_B1F437FC X-CRM114-Status: GOOD ( 11.32 ) X-Spam-Score: -0.4 (/) 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: Ilan Peer Signed-off-by: Ilan Peer --- src/ap/ieee802_11_shared.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/ap/ieee802_11_shared.c b/src/ap/ieee802_11_shared.c index 31dfb62543..e7e5019de2 100644 --- a/src/ap/ieee802_11_shared.c +++ b/src/ap/ieee802_11_shared.c @@ -51,13 +51,14 @@ u8 * host [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Ilan Peer Signed-off-by: Ilan Peer --- src/ap/ieee802_11_shared.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/ap/ieee802_11_shared.c b/src/ap/ieee802_11_shared.c index 31dfb62543..e7e5019de2 100644 --- a/src/ap/ieee802_11_shared.c +++ b/src/ap/ieee802_11_shared.c @@ -51,13 +51,14 @@ u8 * hostapd_eid_assoc_comeback_time(struct hostapd_data *hapd, void ieee802_11_send_sa_query_req(struct hostapd_data *hapd, const u8 *addr, const u8 *trans_id) { -#ifdef CONFIG_OCV - struct sta_info *sta; -#endif /* CONFIG_OCV */ +#if defined(CONFIG_OCV) || defined(CONFIG_IEEE80211BE) + struct sta_info *sta = ap_get_sta(hapd, addr); +#endif /* CONFIG_OCV || CONFIG_IEEE80211BE */ struct ieee80211_mgmt *mgmt; u8 *oci_ie = NULL; u8 oci_ie_len = 0; u8 *end; + const u8 *own_addr = hapd->own_addr; wpa_printf(MSG_DEBUG, "IEEE 802.11: Sending SA Query Request to " MACSTR, MAC2STR(addr)); @@ -65,7 +66,6 @@ void ieee802_11_send_sa_query_req(struct hostapd_data *hapd, trans_id, WLAN_SA_QUERY_TR_ID_LEN); #ifdef CONFIG_OCV - sta = ap_get_sta(hapd, addr); if (sta && wpa_auth_uses_ocv(sta->wpa_sm)) { struct wpa_channel_info ci; @@ -108,11 +108,16 @@ void ieee802_11_send_sa_query_req(struct hostapd_data *hapd, return; } +#ifdef CONFIG_IEEE80211BE + if (hapd->conf->mld_ap && sta && sta->mld_info.mld_sta) + own_addr = hapd->mld_addr; +#endif /* CONFIG_IEEE80211BE */ + mgmt->frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT, WLAN_FC_STYPE_ACTION); os_memcpy(mgmt->da, addr, ETH_ALEN); - os_memcpy(mgmt->sa, hapd->own_addr, ETH_ALEN); - os_memcpy(mgmt->bssid, hapd->own_addr, ETH_ALEN); + os_memcpy(mgmt->sa, own_addr, ETH_ALEN); + os_memcpy(mgmt->bssid, own_addr, ETH_ALEN); mgmt->u.action.category = WLAN_ACTION_SA_QUERY; mgmt->u.action.u.sa_query_req.action = WLAN_SA_QUERY_REQUEST; os_memcpy(mgmt->u.action.u.sa_query_req.trans_id, trans_id, @@ -141,6 +146,7 @@ static void ieee802_11_send_sa_query_resp(struct hostapd_data *hapd, u8 *oci_ie = NULL; u8 oci_ie_len = 0; u8 *end; + const u8 *own_addr = hapd->own_addr; wpa_printf(MSG_DEBUG, "IEEE 802.11: Received SA Query Request from " MACSTR, MAC2STR(sa)); @@ -200,11 +206,16 @@ static void ieee802_11_send_sa_query_resp(struct hostapd_data *hapd, wpa_printf(MSG_DEBUG, "IEEE 802.11: Sending SA Query Response to " MACSTR, MAC2STR(sa)); +#ifdef CONFIG_IEEE80211BE + if (hapd->conf->mld_ap && sta && sta->mld_info.mld_sta) + own_addr = hapd->mld_addr; +#endif /* CONFIG_IEEE80211BE */ + resp->frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT, WLAN_FC_STYPE_ACTION); os_memcpy(resp->da, sa, ETH_ALEN); - os_memcpy(resp->sa, hapd->own_addr, ETH_ALEN); - os_memcpy(resp->bssid, hapd->own_addr, ETH_ALEN); + os_memcpy(resp->sa, own_addr, ETH_ALEN); + os_memcpy(resp->bssid, own_addr, ETH_ALEN); resp->u.action.category = WLAN_ACTION_SA_QUERY; resp->u.action.u.sa_query_req.action = WLAN_SA_QUERY_RESPONSE; os_memcpy(resp->u.action.u.sa_query_req.trans_id, trans_id, From patchwork Mon Nov 20 23:51:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866389 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=PGHpD5To; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=T3D69bV9; 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 4SZ49V4dNBz1ySS for ; Tue, 21 Nov 2023 10:54:22 +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=HsBAxkwQtyzSezSsbx0pBb4AzxhqJ9t9dSlZggHaVFk=; b=PGHpD5ToRRusUG LStF8TqC4noPOF1y0hEiCWmBH7B9XTZ0A11YsWVzMmHxSODaXT+VckgDtfsQAgO05tgLjC3JX2lg3 pQz2tDtXmnr68wRvWzpP6/mK9FYNN2nIDuB5tPkP9GV1QfWNFnt8sfodP8+VZn2QrS7O2le5E/ecL e1Eos4e02+9I2CPcL85i1ozb5AAFQDnpY4ugDbVlCgvI5bBvuNev5caHaM7c6wXZK8/NlMirJHBdJ xfz++5WUbd/MKsxp9WaXZlCrEPpxj0Tu9ss8shjtp/nmCa4vJwTPy7KjvIA9SUhSSQKbodYFZtB/c 3AoxoMIuXI1rgzxVMS2Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E5K-00F6ii-0R; Mon, 20 Nov 2023 23:53:46 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4d-00F5iV-1c for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:53:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524383; x=1732060383; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RUafr+vcaHB4FQYyAy7LOO1FQTROm6Nq4MEqGZVkEJ8=; b=T3D69bV9xRhAW677MX6FknsMxJE7awuCkXAbYn6Qp1H49i+YteGOhJxS RDkd2pdSmu6oJwrM1Tf0GyiQFDOG/xwtYGi1zbnqI8Q3EIfaI/JZFpYjQ 9e769p+03UmDtCrZfkTayKsNjiJ9lbYgiqSr74AeMA/cX6ySLKqyTX5RN ODMAnhKmXMIwp2/r6NI2EZW5FVu8zu7j5S6oo6dNxvAjvgrqBRp6T1FDa sAbm34ws5zszyNYMlQB3R0ZiAvZtTT0pGq/Hu0y1cNTU8RVe1QgTZqgD3 WAsZoxryfvYGaxxIhwEPb1xPBYFuuXVGq2+YhQRRh6de90xvqWtYz5vhZ A==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769817" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769817" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871446" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871446" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:01 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Ilan Peer , Andrei Otcheretianski Subject: [PATCH 28/42] AP: Handle re-association from an non-AP MLD Date: Tue, 21 Nov 2023 01:51:42 +0200 Message-Id: <20231120235156.363852-29-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155303_638492_62C3C4E3 X-CRM114-Status: GOOD ( 28.48 ) X-Spam-Score: -0.4 (/) 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: Ilan Peer When processing a re/association request frame and no corresponding station is found, try to find the station using the station MLD address from the basic ML element, as it is possible that the statio [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Ilan Peer When processing a re/association request frame and no corresponding station is found, try to find the station using the station MLD address from the basic ML element, as it is possible that the station is trying to re-associate but with different link address (in such a case the underlying driver would not perform address translations). When sending the association response, use the addresses from the request frame and not the AP MLD addresses, again, to avoid the address translation done in the driver. Signed-off-by: Ilan Peer Signed-off-by: Andrei Otcheretianski --- src/ap/ieee802_11.c | 156 +++++++++++++++++++++++++++++----------- src/ap/ieee802_11.h | 3 + src/ap/ieee802_11_eht.c | 82 +++++++++++++++++++++ 3 files changed, 198 insertions(+), 43 deletions(-) diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index 85b02947a8..cc0a0582cf 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -4709,7 +4709,7 @@ static int add_associated_sta(struct hostapd_data *hapd, static u16 send_assoc_resp(struct hostapd_data *hapd, struct sta_info *sta, const u8 *addr, u16 status_code, int reassoc, const u8 *ies, size_t ies_len, int rssi, - int omit_rsnxe) + int omit_rsnxe, int allow_mld_addr_trans) { int send_len; u8 *buf; @@ -4759,7 +4759,8 @@ static u16 send_assoc_resp(struct hostapd_data *hapd, struct sta_info *sta, * Once a non-AP MLD is added to the driver, the addressing should use * MLD MAC address. */ - if (hapd->conf->mld_ap && sta && sta->mld_info.mld_sta) + if (hapd->conf->mld_ap && sta && sta->mld_info.mld_sta && + allow_mld_addr_trans) sa = hapd->mld_addr; #endif /* CONFIG_IEEE80211BE */ @@ -5125,7 +5126,7 @@ void fils_hlp_finish_assoc(struct hostapd_data *hapd, struct sta_info *sta) reply_res = send_assoc_resp(hapd, sta, sta->addr, WLAN_STATUS_SUCCESS, sta->fils_pending_assoc_is_reassoc, sta->fils_pending_assoc_req, - sta->fils_pending_assoc_req_len, 0, 0); + sta->fils_pending_assoc_req_len, 0, 0, 1); os_free(sta->fils_pending_assoc_req); sta->fils_pending_assoc_req = NULL; sta->fils_pending_assoc_req_len = 0; @@ -5159,6 +5160,89 @@ void fils_hlp_timeout(void *eloop_ctx, void *eloop_data) #endif /* CONFIG_FILS */ +#ifdef CONFIG_IEEE80211BE +static struct sta_info * +hostapd_ml_get_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta, + struct hostapd_data **assoc_hapd) +{ + struct hostapd_data *other_hapd = NULL; + struct sta_info *tmp_sta; + + *assoc_hapd = hapd; + + /* The station is the one on which the association was performed */ + if (sta->mld_assoc_link_id == hapd->mld_link_id) + return sta; + + other_hapd = hostapd_mld_get_link_bss(hapd, sta->mld_assoc_link_id); + if (!other_hapd) { + wpa_printf(MSG_DEBUG, "MLD: No link match for link_id=%u", + sta->mld_assoc_link_id); + return sta; + } + + /* + * Iterate over the stations and find the one with the matching link ID + * and association ID. + */ + for (tmp_sta = other_hapd->sta_list; tmp_sta; tmp_sta = tmp_sta->next) { + if (tmp_sta->mld_assoc_link_id == sta->mld_assoc_link_id && + tmp_sta->aid == sta->aid) { + *assoc_hapd = other_hapd; + return tmp_sta; + } + } + + return sta; +} +#endif /* CONFIG_IEEE80211BE */ + + +static struct sta_info *handle_mlo_translate(struct hostapd_data *hapd, + struct ieee80211_mgmt *mgmt, + size_t len, int reassoc, + struct hostapd_data **assoc_hapd) +{ + struct sta_info *sta = NULL; + +#ifdef CONFIG_IEEE80211BE + struct ieee802_11_elems elems; + u8 mld_addr[ETH_ALEN]; + const u8 *pos; + + if (!hapd->iconf->ieee80211be || hapd->conf->disable_11be) + return NULL; + + if (reassoc) { + len -= IEEE80211_HDRLEN + sizeof(mgmt->u.reassoc_req); + pos = mgmt->u.reassoc_req.variable; + } else { + len -= IEEE80211_HDRLEN + sizeof(mgmt->u.assoc_req); + pos = mgmt->u.assoc_req.variable; + } + + if (ieee802_11_parse_elems(pos, len, &elems, 1) == ParseFailed) + return NULL; + + if (hostapd_process_ml_assoc_req_addr(hapd, elems.basic_mle, + elems.basic_mle_len, + mld_addr)) + return NULL; + + sta = ap_get_sta(hapd, mld_addr); + if (!sta) + return NULL; + + wpa_printf(MSG_DEBUG, + "MLD: assoc: mld=" MACSTR ", link=" MACSTR, + MAC2STR(mld_addr), MAC2STR(mgmt->sa)); + + sta = hostapd_ml_get_assoc_sta(hapd, sta, assoc_hapd); +#endif /* CONFIG_IEEE80211BE */ + + return sta; +} + static void handle_assoc(struct hostapd_data *hapd, const struct ieee80211_mgmt *mgmt, size_t len, @@ -5176,6 +5260,7 @@ static void handle_assoc(struct hostapd_data *hapd, #endif /* CONFIG_FILS */ int omit_rsnxe = 0; bool set_beacon = false; + bool mld_addrs_not_translated = false; if (len < IEEE80211_HDRLEN + (reassoc ? sizeof(mgmt->u.reassoc_req) : sizeof(mgmt->u.assoc_req))) { @@ -5233,6 +5318,25 @@ static void handle_assoc(struct hostapd_data *hapd, } sta = ap_get_sta(hapd, mgmt->sa); + + /* + * It is possible that the association frame is from an associated + * non-AP MLD station, that tries to re-associate using different link + * addresses. In such a case, try to find the station based on the AP + * MLD address. + */ + if (!sta) { + struct hostapd_data *assoc_hapd; + sta = handle_mlo_translate(hapd, (struct ieee80211_mgmt *)mgmt, + len, reassoc, &assoc_hapd); + if (sta) { + wpa_printf(MSG_DEBUG, + "MLD: Switching to assoc hapd/station"); + hapd = assoc_hapd; + mld_addrs_not_translated = true; + } + } + #ifdef CONFIG_IEEE80211R_AP if (sta && sta->auth_alg == WLAN_AUTH_FT && (sta->flags & WLAN_STA_AUTH) == 0) { @@ -5553,8 +5657,12 @@ static void handle_assoc(struct hostapd_data *hapd, #endif /* CONFIG_FILS */ if (resp >= 0) - reply_res = send_assoc_resp(hapd, sta, mgmt->sa, resp, reassoc, - pos, left, rssi, omit_rsnxe); + reply_res = send_assoc_resp(hapd, + mld_addrs_not_translated ? + NULL : sta, + mgmt->sa, resp, reassoc, + pos, left, rssi, omit_rsnxe, + !mld_addrs_not_translated); os_free(tmp); /* @@ -5645,44 +5753,6 @@ static void hostapd_disassoc_sta(struct hostapd_data *hapd, } -#ifdef CONFIG_IEEE80211BE -static struct sta_info * -hostapd_ml_get_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta, - struct hostapd_data **assoc_hapd) -{ - struct hostapd_data *other_hapd = NULL; - struct sta_info *tmp_sta; - - *assoc_hapd = hapd; - - /* The station is the one on which the association was performed */ - if (sta->mld_assoc_link_id == hapd->mld_link_id) - return sta; - - other_hapd = hostapd_mld_get_link_bss(hapd, sta->mld_assoc_link_id); - if (!other_hapd) { - wpa_printf(MSG_DEBUG, "MLD: No link match for link_id=%u", - sta->mld_assoc_link_id); - return sta; - } - - /* - * Iterate over the stations and find the one with the matching link ID - * and association ID. - */ - for (tmp_sta = other_hapd->sta_list; tmp_sta; tmp_sta = tmp_sta->next) { - if (tmp_sta->mld_assoc_link_id == sta->mld_assoc_link_id && - tmp_sta->aid == sta->aid) { - *assoc_hapd = other_hapd; - return tmp_sta; - } - } - - return sta; -} -#endif /* CONFIG_IEEE80211BE */ - - static bool hostapd_ml_handle_disconnect(struct hostapd_data *hapd, struct sta_info *sta, const struct ieee80211_mgmt *mgmt, diff --git a/src/ap/ieee802_11.h b/src/ap/ieee802_11.h index dce26c398d..3f89874e23 100644 --- a/src/ap/ieee802_11.h +++ b/src/ap/ieee802_11.h @@ -104,6 +104,9 @@ const u8 * hostapd_process_ml_auth(struct hostapd_data *hapd, u16 hostapd_process_ml_assoc_req(struct hostapd_data *hapd, struct ieee802_11_elems *elems, struct sta_info *sta); +int hostapd_process_ml_assoc_req_addr(struct hostapd_data *hapd, + const u8 *basic_mle, size_t basic_mle_len, + u8 *mld_addr); int hostapd_get_aid(struct hostapd_data *hapd, struct sta_info *sta); u16 copy_sta_ht_capab(struct hostapd_data *hapd, struct sta_info *sta, const u8 *ht_capab); diff --git a/src/ap/ieee802_11_eht.c b/src/ap/ieee802_11_eht.c index 3c5334a203..ed4579eac1 100644 --- a/src/ap/ieee802_11_eht.c +++ b/src/ap/ieee802_11_eht.c @@ -1040,6 +1040,88 @@ static int hostapd_mld_validate_assoc_info(struct hostapd_data *hapd, } +int hostapd_process_ml_assoc_req_addr(struct hostapd_data *hapd, + const u8 *basic_mle, size_t basic_mle_len, + u8 *mld_addr) +{ + struct wpabuf *mlbuf = ieee802_11_defrag(basic_mle, basic_mle_len, + true); + struct ieee80211_eht_ml *ml; + struct eht_ml_basic_common_info *common_info; + size_t ml_len, common_info_len; + u8 *pos; + int ret = -1; + u16 ml_control; + + if (!mlbuf) + return WLAN_STATUS_SUCCESS; + + ml = (struct ieee80211_eht_ml *)wpabuf_head(mlbuf); + ml_len = wpabuf_len(mlbuf); + + ml_control = le_to_host16(ml->ml_control); + if ((ml_control & MULTI_LINK_CONTROL_TYPE_MASK) != + MULTI_LINK_CONTROL_TYPE_BASIC) { + wpa_printf(MSG_DEBUG, "MLD: Invalid ML type=%u", + ml_control & MULTI_LINK_CONTROL_TYPE_MASK); + goto out; + } + + /* common info length and MLD address must always be present */ + common_info_len = 7; + + if (ml_control & BASIC_MULTI_LINK_CTRL_PRES_LINK_ID) { + wpa_printf(MSG_DEBUG, "MLD: link ID info not expected"); + goto out; + } + + if (ml_control & BASIC_MULTI_LINK_CTRL_PRES_BSS_PARAM_CH_COUNT) { + wpa_printf(MSG_DEBUG, "MLD: BSS params change not expected"); + goto out; + } + + if (ml_control & BASIC_MULTI_LINK_CTRL_PRES_MSD_INFO) { + wpa_printf(MSG_DEBUG, "MLD: sync delay not expected"); + goto out; + } + + if (ml_control & BASIC_MULTI_LINK_CTRL_PRES_EML_CAPA) + common_info_len += 2; + + if (ml_control & BASIC_MULTI_LINK_CTRL_PRES_MLD_CAPA) + common_info_len += 2; + + if (sizeof(*ml) + common_info_len > ml_len) { + wpa_printf(MSG_DEBUG, "MLD: not enough bytes for common info"); + goto out; + } + + common_info = (struct eht_ml_basic_common_info *)ml->variable; + + /* common information length includes the length octet */ + if (common_info->len != common_info_len) { + wpa_printf(MSG_DEBUG, + "MLD: invalid common info len=%u", common_info->len); + goto out; + } + + pos = common_info->variable; + + if (ml_control & BASIC_MULTI_LINK_CTRL_PRES_EML_CAPA) + pos += 2; + + pos += 2; + + /* get the MLD Address */ + os_memcpy(mld_addr, common_info->mld_addr, ETH_ALEN); + ret = 0; + +out: + wpabuf_free(mlbuf); + return ret; +} + + u16 hostapd_process_ml_assoc_req(struct hostapd_data *hapd, struct ieee802_11_elems *elems, struct sta_info *sta) From patchwork Mon Nov 20 23:51:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866388 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=BR57vxfy; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=l8NHgH0E; 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 4SZ49T6vxRz1ySN for ; Tue, 21 Nov 2023 10:54:21 +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=EhObfQobHEHEzOkrSMnm1z73iNCCbU161nLgdZlRt2o=; b=BR57vxfyKKEtbT AFH3MdwHkoihTCLlFtk8iI5/dU5ZhBwURv95YoujZnQK28MXGy+ipKmgWqJe7UPmEsZfTGUF1nD7F am3SnvmOKX74H5oiSNFGbufBR/O7gOIihQduB9D+iycTZfxLt7yGzNZL67YPRKjALeWiTzbNvs8Ka xIcZ/fxcnItugMdGD+jRKvnOoPgM53wOqZrEDwsJbW9m82pJLt88SR7dGyvS47VKGF3fPHQiNTbvb MKdyrKzxr5sHKa60lXoqnWghFrZdBSl4LDM0o5JiHksJR2ws0stf3yuoByASv7H1XsXHMhrGKNyYb IF8mxPI912eBpBKzvFBA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E5N-00F6mO-01; Mon, 20 Nov 2023 23:53:49 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4e-00F5uJ-1D for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:53:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524384; x=1732060384; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=taWQfUCwz/Y/g3e2Oz9e4YxsfAnQ0uTiTuU7OSbuKU4=; b=l8NHgH0EqgXGJH30Wo+sWT4t/RImxbZc4RMVuj/fzNAqqbkQ7yXqv4F2 JI/11gqSG+tcCrCMFnH3iUrwcI1wx9Wu3ycW4oyb1vxeVSH9TZ5RCub4f bW+1FBjg43nC+I1qOFIjwBz2UUAlEBeO22aHpd1oa7GRggz78OsLlZml6 XWhhipVhj7uKzbRhRQ/1S/jPhNdeq/Gp+loaptvPvELQMvY/0703qbtgz 9PoV27INBJeqLBT6h3cZ23QkGp4LlcxcFiY+6WZxmnKcX2KeIwaTJ/klt XxNWHFnxlAjSgfIdONLGhF2JQnVNCdW4WCJOBtdbz+7RqrKAZv/bNEzTN w==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769820" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769820" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871457" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871457" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:03 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Andrei Otcheretianski Subject: [PATCH 29/42] AP: Get rid of wpa_auth_pmksa_add3 Date: Tue, 21 Nov 2023 01:51:43 +0200 Message-Id: <20231120235156.363852-30-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155304_490256_4F79D8D8 X-CRM114-Status: GOOD ( 13.70 ) X-Spam-Score: -0.4 (/) 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: Simply pass another parameter to wpa_auth_pmksa_add2 instead. Signed-off-by: Andrei Otcheretianski --- src/ap/ctrl_iface_ap.c | 2 +- src/ap/dpp_hostapd.c | 4 ++-- src/ap/ieee802_11.c | 5 +++-- src/ap/wpa_auth.c | 19 + [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 Simply pass another parameter to wpa_auth_pmksa_add2 instead. Signed-off-by: Andrei Otcheretianski --- src/ap/ctrl_iface_ap.c | 2 +- src/ap/dpp_hostapd.c | 4 ++-- src/ap/ieee802_11.c | 5 +++-- src/ap/wpa_auth.c | 19 +------------------ src/ap/wpa_auth.h | 3 --- 5 files changed, 7 insertions(+), 26 deletions(-) diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c index a6fcb7ee49..3c4c4b1f7b 100644 --- a/src/ap/ctrl_iface_ap.c +++ b/src/ap/ctrl_iface_ap.c @@ -1094,7 +1094,7 @@ int hostapd_ctrl_iface_pmksa_add(struct hostapd_data *hapd, char *cmd) return -1; return wpa_auth_pmksa_add2(hapd->wpa_auth, spa, pmk, pmk_len, - pmkid, expiration, akmp); + pmkid, expiration, akmp, NULL); } diff --git a/src/ap/dpp_hostapd.c b/src/ap/dpp_hostapd.c index 7a8ea4e601..1fee2d6a8a 100644 --- a/src/ap/dpp_hostapd.c +++ b/src/ap/dpp_hostapd.c @@ -2133,7 +2133,7 @@ static void hostapd_dpp_rx_peer_disc_req(struct hostapd_data *hapd, else expiration = 0; - if (wpa_auth_pmksa_add3(hapd->wpa_auth, src, intro.pmk, intro.pmk_len, + if (wpa_auth_pmksa_add2(hapd->wpa_auth, src, intro.pmk, intro.pmk_len, intro.pmkid, expiration, WPA_KEY_MGMT_DPP, pkhash) < 0) { wpa_printf(MSG_ERROR, "DPP: Failed to add PMKSA cache entry"); @@ -2907,7 +2907,7 @@ hostapd_dpp_rx_priv_peer_intro_update(struct hostapd_data *hapd, const u8 *src, else expiration = 0; - if (wpa_auth_pmksa_add3(hapd->wpa_auth, src, intro.pmk, intro.pmk_len, + if (wpa_auth_pmksa_add2(hapd->wpa_auth, src, intro.pmk, intro.pmk_len, intro.pmkid, expiration, WPA_KEY_MGMT_DPP, pkhash) < 0) { wpa_printf(MSG_ERROR, "DPP: Failed to add PMKSA cache entry"); diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index cc0a0582cf..ad85f216f2 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -2149,7 +2149,8 @@ prepare_auth_resp_fils(struct hostapd_data *hapd, pmk, pmk_len, sta->fils_erp_pmkid, session_timeout, - wpa_auth_sta_key_mgmt(sta->wpa_sm)) < 0) { + wpa_auth_sta_key_mgmt(sta->wpa_sm), + NULL) < 0) { wpa_printf(MSG_ERROR, "FILS: Failed to add PMKSA cache entry based on ERP"); } @@ -3655,7 +3656,7 @@ static u16 owe_process_assoc_req(struct hostapd_data *hapd, wpa_hexdump_key(MSG_DEBUG, "OWE: PMK", sta->owe_pmk, sta->owe_pmk_len); wpa_hexdump(MSG_DEBUG, "OWE: PMKID", pmkid, PMKID_LEN); wpa_auth_pmksa_add2(hapd->wpa_auth, sta->addr, sta->owe_pmk, - sta->owe_pmk_len, pmkid, 0, WPA_KEY_MGMT_OWE); + sta->owe_pmk_len, pmkid, 0, WPA_KEY_MGMT_OWE, NULL); return WLAN_STATUS_SUCCESS; } diff --git a/src/ap/wpa_auth.c b/src/ap/wpa_auth.c index 385eceaa04..a1223265ed 100644 --- a/src/ap/wpa_auth.c +++ b/src/ap/wpa_auth.c @@ -5679,29 +5679,12 @@ void wpa_auth_add_sae_pmkid(struct wpa_state_machine *sm, const u8 *pmkid) int wpa_auth_pmksa_add2(struct wpa_authenticator *wpa_auth, const u8 *addr, - const u8 *pmk, size_t pmk_len, const u8 *pmkid, - int session_timeout, int akmp) -{ - if (!wpa_auth || wpa_auth->conf.disable_pmksa_caching) - return -1; - - wpa_hexdump_key(MSG_DEBUG, "RSN: Cache PMK (2)", pmk, PMK_LEN); - if (pmksa_cache_auth_add(wpa_auth->pmksa, pmk, pmk_len, pmkid, - NULL, 0, wpa_auth->addr, addr, session_timeout, - NULL, akmp)) - return 0; - - return -1; -} - - -int wpa_auth_pmksa_add3(struct wpa_authenticator *wpa_auth, const u8 *addr, const u8 *pmk, size_t pmk_len, const u8 *pmkid, int session_timeout, int akmp, const u8 *dpp_pkhash) { struct rsn_pmksa_cache_entry *entry; - if (wpa_auth->conf.disable_pmksa_caching) + if (!wpa_auth || wpa_auth->conf.disable_pmksa_caching) return -1; wpa_hexdump_key(MSG_DEBUG, "RSN: Cache PMK (3)", pmk, PMK_LEN); diff --git a/src/ap/wpa_auth.h b/src/ap/wpa_auth.h index d6ed6772bb..841897bf82 100644 --- a/src/ap/wpa_auth.h +++ b/src/ap/wpa_auth.h @@ -476,9 +476,6 @@ int wpa_auth_pmksa_add_sae(struct wpa_authenticator *wpa_auth, const u8 *addr, int akmp); void wpa_auth_add_sae_pmkid(struct wpa_state_machine *sm, const u8 *pmkid); int wpa_auth_pmksa_add2(struct wpa_authenticator *wpa_auth, const u8 *addr, - const u8 *pmk, size_t pmk_len, const u8 *pmkid, - int session_timeout, int akmp); -int wpa_auth_pmksa_add3(struct wpa_authenticator *wpa_auth, const u8 *addr, const u8 *pmk, size_t pmk_len, const u8 *pmkid, int session_timeout, int akmp, const u8 *dpp_pkhash); void wpa_auth_pmksa_remove(struct wpa_authenticator *wpa_auth, From patchwork Mon Nov 20 23:51:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866404 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=4TL9RdZM; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=HesAVv21; 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 4SZ5gc2WZsz1ySW for ; Tue, 21 Nov 2023 12:02:04 +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=an7C6+Bo+lMf1rZyaIkzXVsZ1ubpgsEvsDAQaYrCMDw=; b=4TL9RdZMngcKXv 7ayVyrSBVsnocWfRjxs79KiV75PI/oDC1yLuplMRZW74QOlwwaXOmXzspoXwg+9w0hAgvpidv15Xz W33w3RSnUqq/31KnGdlS8Kd7PzlbpOaWOqD8CvgJDJwgK86L85vIcSVSjCvso/Ucn7HuEPxm+wcZS La3xEu/QOfKyD8aVfQKdkRjsAYomAV7OJyMTz2kLGvLMkBvW2HQZL1M+bTffVuIviqvGSryQZjy3G QQanWtOp5v6MpdTZdnaHBiID7/qUaKowHFjFG4RhIrPy01aEJRYztmeJx0/JRYSaiyu4+oFNRrZsf KZEdwQPSPrQv35r0V6DA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5F8m-00FHVW-2K; Tue, 21 Nov 2023 01:01:24 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4g-00F5iV-2B for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:53:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524386; x=1732060386; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+P9pA1wzdkxDygeyIdArjV5+0LeVIQ6YSoOaVqFBOuQ=; b=HesAVv21+sAJVTIXh3aDi8lBznAbSrwrPup7yRF+80gMkw2Mbl4ujVsx qlCIA1Lm0MYcWOs6sEtHHtcj0hWnYzI0wvq1PKkAjjwDmrsQQiYlC/FQ0 nxSGx6IXieGbh3szckvg+VUVhwENJ8M+ysSYBC7zL/f4Tj6VOBctu19K5 tu5s5DMyPaIaOGppkCjQwP8YNSucYqsRrHQErdxy9rx4exWTb9cR+yQMP Gv2uKn+kMPhckkDd35DpDc4MqQsHInnQSSz/Mt8UajkWrURZlcHCM6UDK UtNR93zZYkycSTc4d+2hJ1UXX4H3cvI2NjzlH7b2cMGMsjLmI8iktvAeE A==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769823" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769823" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871461" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871461" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:04 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Ilan Peer Subject: [PATCH 30/42] AP: MLD: Update all PMKSAs in the AP MLD Date: Tue, 21 Nov 2023 01:51:44 +0200 Message-Id: <20231120235156.363852-31-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155306_855129_26D6E312 X-CRM114-Status: GOOD ( 23.36 ) X-Spam-Score: -0.4 (/) 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: Ilan Peer When a non-AP MLD station associates with an AP MLD and the association is a multi-link association, the PMKSA that is created as part of the connection establishment is also relevant for the other li [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Ilan Peer When a non-AP MLD station associates with an AP MLD and the association is a multi-link association, the PMKSA that is created as part of the connection establishment is also relevant for the other links included in the association. Thus, update the PMKSA cache of the other BSSs (that are part of the MLD connection) with the same PMKSA information. This is useful for cases, where after initial connection establishment, the station disconnect and connects again, but instead of using the original link for the connection it uses a different link. Signed-off-by: Ilan Peer --- src/ap/dpp_hostapd.c | 14 +++---- src/ap/hostapd.c | 3 +- src/ap/ieee802_11.c | 40 ++++++++++++------- src/ap/ieee802_11.h | 4 ++ src/ap/ieee802_11_shared.c | 82 ++++++++++++++++++++++++++++++++++++++ src/ap/wnm_ap.c | 3 +- src/ap/wpa_auth.c | 18 --------- src/ap/wpa_auth.h | 3 -- 8 files changed, 122 insertions(+), 45 deletions(-) diff --git a/src/ap/dpp_hostapd.c b/src/ap/dpp_hostapd.c index 1fee2d6a8a..8fd72b120c 100644 --- a/src/ap/dpp_hostapd.c +++ b/src/ap/dpp_hostapd.c @@ -23,7 +23,7 @@ #include "wpa_auth.h" #include "beacon.h" #include "dpp_hostapd.h" - +#include "ieee802_11.h" static void hostapd_dpp_reply_wait_timeout(void *eloop_ctx, void *timeout_ctx); static void hostapd_dpp_auth_conf_wait_timeout(void *eloop_ctx, @@ -2133,9 +2133,9 @@ static void hostapd_dpp_rx_peer_disc_req(struct hostapd_data *hapd, else expiration = 0; - if (wpa_auth_pmksa_add2(hapd->wpa_auth, src, intro.pmk, intro.pmk_len, - intro.pmkid, expiration, - WPA_KEY_MGMT_DPP, pkhash) < 0) { + if (hostapd_pmksa_add(hapd, src, intro.pmk, intro.pmk_len, + intro.pmkid, expiration, + WPA_KEY_MGMT_DPP, pkhash) < 0) { wpa_printf(MSG_ERROR, "DPP: Failed to add PMKSA cache entry"); goto done; } @@ -2907,9 +2907,9 @@ hostapd_dpp_rx_priv_peer_intro_update(struct hostapd_data *hapd, const u8 *src, else expiration = 0; - if (wpa_auth_pmksa_add2(hapd->wpa_auth, src, intro.pmk, intro.pmk_len, - intro.pmkid, expiration, - WPA_KEY_MGMT_DPP, pkhash) < 0) { + if (hostapd_pmksa_add(hapd, src, intro.pmk, intro.pmk_len, + intro.pmkid, expiration, + WPA_KEY_MGMT_DPP, pkhash) < 0) { wpa_printf(MSG_ERROR, "DPP: Failed to add PMKSA cache entry"); goto done; } diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index b6031014d4..225d50f09a 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -1129,7 +1129,8 @@ hostapd_das_disconnect(void *ctx, struct radius_das_attrs *attr) wpa_printf(MSG_DEBUG, "RADIUS DAS: Found a matching session " MACSTR " - disconnecting", MAC2STR(sta->addr)); - wpa_auth_pmksa_remove(hapd->wpa_auth, sta->addr); + + hostapd_pmksa_remove(hapd, sta->addr); hostapd_drv_sta_deauth(hapd, sta->addr, WLAN_REASON_PREV_AUTH_NOT_VALID); diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index ad85f216f2..4001edf9fc 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -894,6 +894,8 @@ static void sae_sme_send_external_auth_status(struct hostapd_data *hapd, void sae_accept_sta(struct hostapd_data *hapd, struct sta_info *sta) { + int akmp; + #ifndef CONFIG_NO_VLAN struct vlan_description vlan_desc; @@ -931,9 +933,18 @@ void sae_accept_sta(struct hostapd_data *hapd, struct sta_info *sta) crypto_bignum_deinit(sta->sae->peer_commit_scalar_accepted, 0); sta->sae->peer_commit_scalar_accepted = sta->sae->peer_commit_scalar; sta->sae->peer_commit_scalar = NULL; - wpa_auth_pmksa_add_sae(hapd->wpa_auth, sta->addr, - sta->sae->pmk, sta->sae->pmk_len, - sta->sae->pmkid, sta->sae->akmp); + + akmp = sta->sae->akmp; + if (!akmp) { + wpa_printf(MSG_DEBUG, "SAE: set AKMP=SAE for STA " MACSTR, + MAC2STR(sta->addr)); + akmp = WPA_KEY_MGMT_SAE; + } + + hostapd_pmksa_add(hapd, sta->addr, sta->sae->pmk, + sta->sae->pmk_len, sta->sae->pmkid, 0, + akmp, NULL); + sae_sme_send_external_auth_status(hapd, sta, WLAN_STATUS_SUCCESS); } @@ -1092,7 +1103,7 @@ static int sae_sm_step(struct hostapd_data *hapd, struct sta_info *sta, wpa_printf(MSG_DEBUG, "SAE: remove the STA (" MACSTR ") doing reauthentication", MAC2STR(sta->addr)); - wpa_auth_pmksa_remove(hapd->wpa_auth, sta->addr); + hostapd_pmksa_remove(hapd, sta->addr); ap_free_sta(hapd, sta); *sta_removed = 1; } else if (auth_transaction == 1) { @@ -1309,7 +1320,7 @@ static void handle_auth_sae(struct hostapd_data *hapd, struct sta_info *sta, if (sta->mesh_sae_pmksa_caching) { wpa_printf(MSG_DEBUG, "SAE: Cancel use of mesh PMKSA caching because peer starts SAE authentication"); - wpa_auth_pmksa_remove(hapd->wpa_auth, sta->addr); + hostapd_pmksa_remove(hapd, sta->addr); sta->mesh_sae_pmksa_caching = 0; } @@ -2143,14 +2154,13 @@ prepare_auth_resp_fils(struct hostapd_data *hapd, sta->fils_erp_pmkid_set = 0; wpa_auth_add_fils_pmk_pmkid(sta->wpa_sm, pmk, pmk_len, sta->fils_erp_pmkid); - if (!hapd->conf->disable_pmksa_caching && - wpa_auth_pmksa_add2( - hapd->wpa_auth, sta->addr, - pmk, pmk_len, - sta->fils_erp_pmkid, - session_timeout, - wpa_auth_sta_key_mgmt(sta->wpa_sm), - NULL) < 0) { + + if (hostapd_pmksa_add(hapd, sta->addr, + pmk, pmk_len, + sta->fils_erp_pmkid, + session_timeout, + wpa_auth_sta_key_mgmt(sta->wpa_sm), + NULL) < 0) { wpa_printf(MSG_ERROR, "FILS: Failed to add PMKSA cache entry based on ERP"); } @@ -3655,9 +3665,9 @@ static u16 owe_process_assoc_req(struct hostapd_data *hapd, wpa_hexdump_key(MSG_DEBUG, "OWE: PMK", sta->owe_pmk, sta->owe_pmk_len); wpa_hexdump(MSG_DEBUG, "OWE: PMKID", pmkid, PMKID_LEN); - wpa_auth_pmksa_add2(hapd->wpa_auth, sta->addr, sta->owe_pmk, - sta->owe_pmk_len, pmkid, 0, WPA_KEY_MGMT_OWE, NULL); + hostapd_pmksa_add(hapd, sta->addr, sta->owe_pmk, + sta->owe_pmk_len, pmkid, 0, WPA_KEY_MGMT_OWE, NULL); return WLAN_STATUS_SUCCESS; } diff --git a/src/ap/ieee802_11.h b/src/ap/ieee802_11.h index 3f89874e23..e07f83eeb3 100644 --- a/src/ap/ieee802_11.h +++ b/src/ap/ieee802_11.h @@ -256,4 +256,8 @@ const char * sae_get_password(struct hostapd_data *hapd, struct sae_password_entry **pw_entry, struct sae_pt **s_pt, const struct sae_pk **s_pk); +int hostapd_pmksa_add(struct hostapd_data *hapd, const u8 *addr, + const u8 *pmk, size_t pmk_len, const u8 *pmkid, + int session_timeout, int akmp, const u8 *dpp_pkhash); +void hostapd_pmksa_remove(struct hostapd_data *hapd, const u8 *addr); #endif /* IEEE802_11_H */ diff --git a/src/ap/ieee802_11_shared.c b/src/ap/ieee802_11_shared.c index e7e5019de2..8548e6e7fe 100644 --- a/src/ap/ieee802_11_shared.c +++ b/src/ap/ieee802_11_shared.c @@ -1148,3 +1148,85 @@ u16 check_ext_capab(struct hostapd_data *hapd, struct sta_info *sta, return WLAN_STATUS_SUCCESS; } + + +static void hostapd_mld_pmksa_add(struct hostapd_data *hapd, const u8 *addr, + const u8 *pmk, size_t pmk_len, + const u8 *pmkid, + int session_timeout, int akmp, + const u8 *dpp_pkhash) +{ +#ifdef CONFIG_IEEE80211BE + u32 i; + + for (i = 0; i < hapd->iface->interfaces->count; i++) { + struct hostapd_iface *iface = hapd->iface->interfaces->iface[i]; + + if (hapd->iface == iface) + continue; + + if (!iface->bss[0]->conf->mld_ap || + hapd->conf->mld_id != iface->bss[0]->conf->mld_id || + !iface->bss[0]->wpa_auth) + continue; + + wpa_printf(MSG_INFO, "MLD: add PMKSA to link=%u, addr=" MACSTR, + iface->bss[0]->mld_link_id, MAC2STR(addr)); + + wpa_auth_pmksa_add2(iface->bss[0]->wpa_auth, addr, + pmk, pmk_len, pmkid, session_timeout, akmp, + dpp_pkhash); + } +#endif /* CONFIG_IEEE80211BE */ +} + + +int hostapd_pmksa_add(struct hostapd_data *hapd, const u8 *addr, + const u8 *pmk, size_t pmk_len, const u8 *pmkid, + int session_timeout, int akmp, const u8 *dpp_pkhash) +{ + int ret; + + ret = wpa_auth_pmksa_add2(hapd->wpa_auth, addr, pmk, pmk_len, + pmkid, session_timeout, akmp, dpp_pkhash); + + if (ret < 0) + return ret; + + hostapd_mld_pmksa_add(hapd, addr, pmk, pmk_len, pmkid, session_timeout, + akmp, dpp_pkhash); + + return 0; +} + + +static void hostapd_mld_pmksa_remove(struct hostapd_data *hapd, const u8 *addr) +{ +#ifdef CONFIG_IEEE80211BE + u32 i; + + for (i = 0; i < hapd->iface->interfaces->count; i++) { + struct hostapd_iface *iface = hapd->iface->interfaces->iface[i]; + + if (hapd->iface == iface) + continue; + + if (!iface->bss[0]->conf->mld_ap || + hapd->conf->mld_id != iface->bss[0]->conf->mld_id || + !iface->bss[0]->wpa_auth) + continue; + + wpa_printf(MSG_INFO, "MLD: add PMKSA to link=%u", + iface->bss[0]->mld_link_id); + + wpa_auth_pmksa_remove(iface->bss[0]->wpa_auth, addr); + } +#endif /* CONFIG_IEEE80211BE */ +} + + +void hostapd_pmksa_remove(struct hostapd_data *hapd, const u8 *addr) +{ + wpa_auth_pmksa_remove(hapd->wpa_auth, addr); + hostapd_mld_pmksa_remove(hapd, addr); +} diff --git a/src/ap/wnm_ap.c b/src/ap/wnm_ap.c index 153ee40334..a3d94fea00 100644 --- a/src/ap/wnm_ap.c +++ b/src/ap/wnm_ap.c @@ -20,6 +20,7 @@ #include "ap/wpa_auth.h" #include "mbo_ap.h" #include "wnm_ap.h" +#include "ieee802_11.h" #define MAX_TFS_IE_LEN 1024 @@ -862,7 +863,7 @@ static void set_disassoc_timer(struct hostapd_data *hapd, struct sta_info *sta, * full authentication with the authentication server (which may * decide to reject the connection), */ - wpa_auth_pmksa_remove(hapd->wpa_auth, sta->addr); + hostapd_pmksa_remove(hapd, sta->addr); beacon_int = hapd->iconf->beacon_int; if (beacon_int < 1) diff --git a/src/ap/wpa_auth.c b/src/ap/wpa_auth.c index a1223265ed..2057cf393d 100644 --- a/src/ap/wpa_auth.c +++ b/src/ap/wpa_auth.c @@ -5653,24 +5653,6 @@ int wpa_auth_pmksa_add_preauth(struct wpa_authenticator *wpa_auth, } -int wpa_auth_pmksa_add_sae(struct wpa_authenticator *wpa_auth, const u8 *addr, - const u8 *pmk, size_t pmk_len, const u8 *pmkid, - int akmp) -{ - if (wpa_auth->conf.disable_pmksa_caching) - return -1; - - wpa_hexdump_key(MSG_DEBUG, "RSN: Cache PMK from SAE", pmk, pmk_len); - if (!akmp) - akmp = WPA_KEY_MGMT_SAE; - if (pmksa_cache_auth_add(wpa_auth->pmksa, pmk, pmk_len, pmkid, - NULL, 0, wpa_auth->addr, addr, 0, NULL, akmp)) - return 0; - - return -1; -} - - void wpa_auth_add_sae_pmkid(struct wpa_state_machine *sm, const u8 *pmkid) { os_memcpy(sm->pmkid, pmkid, PMKID_LEN); diff --git a/src/ap/wpa_auth.h b/src/ap/wpa_auth.h index 841897bf82..87894c38b4 100644 --- a/src/ap/wpa_auth.h +++ b/src/ap/wpa_auth.h @@ -471,9 +471,6 @@ int wpa_auth_pmksa_add_preauth(struct wpa_authenticator *wpa_auth, const u8 *pmk, size_t len, const u8 *sta_addr, int session_timeout, struct eapol_state_machine *eapol); -int wpa_auth_pmksa_add_sae(struct wpa_authenticator *wpa_auth, const u8 *addr, - const u8 *pmk, size_t pmk_len, const u8 *pmkid, - int akmp); void wpa_auth_add_sae_pmkid(struct wpa_state_machine *sm, const u8 *pmkid); int wpa_auth_pmksa_add2(struct wpa_authenticator *wpa_auth, const u8 *addr, const u8 *pmk, size_t pmk_len, const u8 *pmkid, From patchwork Mon Nov 20 23:51:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866403 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=niv04gLt; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=oGPJza1b; 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 4SZ5gb0lrBz1ySN for ; Tue, 21 Nov 2023 12:02:01 +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=3ET6+k8IKVevQSYqPo6NPOaL8j1WsecEujzEwXsuMkA=; b=niv04gLtJgxX1h ptQ246iXjfRIJZ8uG545kbMeqcNZ5LQ+I5WDjbEzRa/mkefi/WHeH7OoOBy+rI9dyaXPRbGL1SpoW yR0wmNEMJ5WIbpddXuxfUnrxItvYgpBO8hVbmdfSmrXM8qzDf/OAA3DvwWkxwLsDitDswKpmD5y6/ rEcheEcJ/NxPICPinCO+tY3Ho0NEk9rCstJnQV4jvgQQsQ/sme/ocSuLx5LKNfY2TpJBehcepjIM+ Ybn9QyGxPpdpA1GgSTHbXJpVOX8nWNjiIgqPHEQWlimm9YMcGBUBgOCZ8v/l0aP3iOtdxItTyfDG1 c3WKYxySpIDC3Bmriyqw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5F8k-00FHUv-1m; Tue, 21 Nov 2023 01:01:22 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4g-00F5uJ-2D for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:53:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524386; x=1732060386; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vtkdMq2QT3nsAp1MTN24rKbx/kYKSCFBFM1GJilmxQQ=; b=oGPJza1bizhEKnBVr/Lhn7YWYi5H1126zNeAfYoTOXCF6953B2nLPQjO EDpbEjAQhgNBlw4+hNQDVRrU2y3D/FtFePEVgiBk47q3sM3kBBv30iQUG HjQLzS0LQ8YTlX0Irq+tyb9gl8lze7XSlmUh8rVH1HCBzi91X5GY2QRzk O2XSeLkGKhmbbOX8hblqzOIkcyZpKJ2CNY9zP6uE+UeINNWTnIwV90Hwd ovOGL7rZmR3ud0bFxpvr3zRz9rloITqx/PH2OCZ6tp8/hjql7y8CXtWS0 P0QIVKsq8FmIeNE4AwB40ls59cmANCKxJ0+yHNPrR+nhsK6SyZunkMLrq Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769827" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769827" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871467" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871467" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:05 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Andrei Otcheretianski Subject: [PATCH 31/42] wpa_supplicant: Use wpa_msg in bssid_ignore.c Date: Tue, 21 Nov 2023 01:51:45 +0200 Message-Id: <20231120235156.363852-32-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155306_825372_C13864E2 X-CRM114-Status: UNSURE ( 9.51 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.4 (/) 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: This allows to use the messages for testing. Signed-off-by: Andrei Otcheretianski --- wpa_supplicant/bssid_ignore.c | 26 +++++++++++++ 1 file changed, 13 insertions(+), 13 deletions(-) Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 This allows to use the messages for testing. Signed-off-by: Andrei Otcheretianski --- wpa_supplicant/bssid_ignore.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/wpa_supplicant/bssid_ignore.c b/wpa_supplicant/bssid_ignore.c index e37857798a..c837c51787 100644 --- a/wpa_supplicant/bssid_ignore.c +++ b/wpa_supplicant/bssid_ignore.c @@ -85,9 +85,9 @@ int wpa_bssid_ignore_add(struct wpa_supplicant *wpa_s, const u8 *bssid) e->timeout_secs = 60; else e->timeout_secs = 10; - wpa_printf(MSG_INFO, "BSSID " MACSTR - " ignore list count incremented to %d, ignoring for %d seconds", - MAC2STR(bssid), e->count, e->timeout_secs); + wpa_msg(wpa_s, MSG_INFO, "BSSID " MACSTR + " ignore list count incremented to %d, ignoring for %d seconds", + MAC2STR(bssid), e->count, e->timeout_secs); return e->count; } @@ -100,9 +100,9 @@ int wpa_bssid_ignore_add(struct wpa_supplicant *wpa_s, const u8 *bssid) e->start = now; e->next = wpa_s->bssid_ignore; wpa_s->bssid_ignore = e; - wpa_printf(MSG_DEBUG, "Added BSSID " MACSTR - " into ignore list, ignoring for %d seconds", - MAC2STR(bssid), e->timeout_secs); + wpa_msg(wpa_s, MSG_INFO, "Added BSSID " MACSTR + " into ignore list, ignoring for %d seconds", + MAC2STR(bssid), e->timeout_secs); return e->count; } @@ -129,8 +129,8 @@ int wpa_bssid_ignore_del(struct wpa_supplicant *wpa_s, const u8 *bssid) } else { prev->next = e->next; } - wpa_printf(MSG_DEBUG, "Removed BSSID " MACSTR - " from ignore list", MAC2STR(bssid)); + wpa_msg(wpa_s, MSG_INFO, "Removed BSSID " MACSTR + " from ignore list", MAC2STR(bssid)); os_free(e); return 0; } @@ -175,8 +175,8 @@ void wpa_bssid_ignore_clear(struct wpa_supplicant *wpa_s) while (e) { prev = e; e = e->next; - wpa_printf(MSG_DEBUG, "Removed BSSID " MACSTR - " from ignore list (clear)", MAC2STR(prev->bssid)); + wpa_msg(wpa_s, MSG_INFO, "Removed BSSID " MACSTR + " from ignore list (clear)", MAC2STR(prev->bssid)); os_free(prev); } } @@ -209,9 +209,9 @@ void wpa_bssid_ignore_update(struct wpa_supplicant *wpa_s) wpa_s->bssid_ignore = e->next; e = wpa_s->bssid_ignore; } - wpa_printf(MSG_INFO, "Removed BSSID " MACSTR - " from ignore list (expired)", - MAC2STR(to_delete->bssid)); + wpa_msg(wpa_s, MSG_INFO, "Removed BSSID " MACSTR + " from ignore list (expired)", + MAC2STR(to_delete->bssid)); os_free(to_delete); } else { prev = e; From patchwork Mon Nov 20 23:51:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866400 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=dqS5LdLq; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=mv2nYM2l; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=ca0WgeTh; 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 4SZ4Bk2NP9z1yRV for ; Tue, 21 Nov 2023 10:55:26 +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=VhVx9iPIWT68V61konbJ/1p10qlWDoiLzo6869oMea8=; b=dqS5LdLqv3X2bG 42QSREopMccgBrxFUTQBQC5GoeNHFmGVKRvmQD+I2i4L1CeTZTGFw6rrlda9wopZ2BEj5Hkf6mqPb Z4QA/fLd656KIyFr6x9o0dsE3a3p/UxF05Gtmn2mMc4ODQXLvY/42eaKyy2EmSSKoDk0Rh1i5fx3x 1W70TBkc48tyCIFCMvi7EDAebYmPMYlAr29hOKAZN0uK/whiHcMjamsLTagv/X8K8lfHGg+OFZkvi BoeU8R/t8rw3tcFfs28Roxd3jIBBZjGduvwSx6VhK/GpCdzuleSXYJF6/AJCTw9RZAKtH789t4GmI AfQrmt6bxi/nTmNIWVyg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E6F-00F7y0-0d; Mon, 20 Nov 2023 23:54:43 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E56-00F6RB-0Q for hostap@bombadil.infradead.org; Mon, 20 Nov 2023 23:53:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=i1kw0wPnmY45Pxmw7hc2G+8uaXExkYI4qTv+qiNJul8=; b=mv2nYM2ldcNl7cgLOVak6ZpeKq XfFkaMb0WMsZpl1wqHKQ/88S/ODGsKg18wPJ6zcXGAhIVj5OalSwvYWF8GRCAYiZGzH4BoucS2Xnl JgnW7A2NiKQTkbIVmYI4M8Wl1Z4ZNLCXvLufqL/4Nx/cPI0pEGazW/PoV0jXZQoq+ATDEsXAdvlMN SEptCIkYNHs/PZdukI31TUNSnrB00MYltDG4jvFkqcWfKuZskJaojAlgJUxvQ7sZWyi9vsqil8wSS 2bczzxp9/g1+1YkjVCyOEG1Jj2/+ATNOHWVDqXsI7pL7b+HRfn68XTG3N65qNHt2H2rf0AtIDtppk IXoWBCNw==; Received: from mgamail.intel.com ([134.134.136.126]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4q-00BB5c-0J for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:53:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524396; x=1732060396; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=toHSwns8E5HZaRYxHr/Yu05VHtbeypf4+OAfp0fKYwE=; b=ca0WgeTh+1uspOVzOOCKnZragTqbUiQ6c1EBiSWbg40O6xysPRVa4Dw9 1TYIljeNAi0nnaJU4w47hU21fSaHho6g0hWOWsC1SEKTBOHYj6PMWFF0x RnVsLD4ABw25zdjZsgB2JXsjV/QBiEdNQQhXs4JvVMUeA3a9ssaDWqvAy ggIin8Mnxe2Cu40M7wcumf9cES+iovNBVTnoaS5wGAFV9W+oioAxr4aaJ UdF28DsfPTLNS9mVhPc6AY1PhiPN8KsDtgUIC29WAZk9PNcE/G2f+sdIx BVOw0EdwtgqLdfhkOAwBb1U/8RckOPbN9UJQnumNSBvsLXvpAf0hRHGQF w==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769833" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769833" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871473" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871473" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:06 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Benjamin Berg Subject: [PATCH 32/42] hwsim: Avoid exception string matching for failures Date: Tue, 21 Nov 2023 01:51:46 +0200 Message-Id: <20231120235156.363852-33-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_235318_764845_B87B03AD X-CRM114-Status: GOOD ( 11.65 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "desiato.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: Benjamin Berg Future commits change the related code and exception string. Avoiding using the context is easy here and actually avoid two layers of nesting. Signed-off-by: Benjamin Berg --- tests/hwsim/test_ap_eap.py | 44 ++++++++++++++++++++++ 1 file changed, 25 insertions(+), 19 deletions(-) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Benjamin Berg Future commits change the related code and exception string. Avoiding using the context is easy here and actually avoid two layers of nesting. Signed-off-by: Benjamin Berg --- tests/hwsim/test_ap_eap.py | 44 ++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/tests/hwsim/test_ap_eap.py b/tests/hwsim/test_ap_eap.py index 7f36618b8e..66911de0a4 100644 --- a/tests/hwsim/test_ap_eap.py +++ b/tests/hwsim/test_ap_eap.py @@ -3469,26 +3469,32 @@ def test_ap_wpa2_eap_eke_server_oom(dev, apdev): dev[0].request("REMOVE_NETWORK all") for count in range(1, 1000): - try: - with alloc_fail(hapd, count, "eap_server_sm_step"): - dev[0].connect("test-wpa2-eap", - key_mgmt="WPA-EAP WPA-EAP-SHA256", - eap="EKE", identity="eke user", password=pw, - wait_connect=False, scan_freq="2412") - # This would eventually time out, but we can stop after having - # reached the allocation failure. - for i in range(10): - time.sleep(0.1) - if hapd.request("GET_ALLOC_FAIL").startswith('0'): - break - dev[0].request("REMOVE_NETWORK all") - except Exception as e: - if str(e) == "Allocation failure did not trigger": - if count < 30: - raise Exception("Too few allocation failures") - logger.info("%d allocation failures tested" % (count - 1)) + # Fail on allocation number "count" + hapd.request("TEST_ALLOC_FAIL %d:eap_server_sm_step" % count) + + dev[0].connect("test-wpa2-eap", + key_mgmt="WPA-EAP WPA-EAP-SHA256", + eap="EKE", identity="eke user", password=pw, + wait_connect=False, scan_freq="2412") + # This would eventually time out, but we can stop after having + # reached the allocation failure. + for i in range(10): + time.sleep(0.1) + if hapd.request("GET_ALLOC_FAIL").startswith('0'): break - raise e + else: + # Last iteration had no failure + # i.e. we exceeded the number of allocations + dev[0].request("REMOVE_NETWORK all") + logger.info("%d allocation failures tested" % (count - 1)) + break + else: + # All iterations had an allocation failure + hapd.request("TEST_ALLOC_FAIL 0:") + raise Exception("More than %d allocations, test aborted" % (count - 1)) + + if count < 30: + raise Exception("Too few allocation failures") def test_ap_wpa2_eap_ikev2(dev, apdev): """WPA2-Enterprise connection using EAP-IKEv2""" From patchwork Mon Nov 20 23:51:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866402 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=eg0glp57; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=NuGbNUxM; 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 4SZ5gb2knzz1ySV for ; Tue, 21 Nov 2023 12:02:01 +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=MCnt/+OyGooX/5JHJLh3tN83SRKWFLl4YVDbqnxTIgg=; b=eg0glp5707dH0d 6g6Q1iZwlNySelxJBSgIxnBFp8n8Uo/Dj/JrBqqjue3ybO80mtTmGpKbbYIAkc23k95L6mvqeKAjq sfK6AGE+yRoublFg8KLNodt5/MUJPliey3cGPT7jev9TtT6FghNP9Fye/bzX3JsGcDx932FKjaiQO hdunkebdascvCBizQTpmk+DVuJWXBEY9M+fu4sAUkfOXEuAqjPpdtcv7vFgqiQzEsq21ZetdgbGSf uS7Tcdsp05upMgUAs/7g5GIZbLeCkNOw12zSvvAsCDVDFO3bEDGCI2XMXeFQJlRx1SqS4r4I753pX xaZD+0uaOZPBzV5IMPNg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5F8l-00FHVF-20; Tue, 21 Nov 2023 01:01:23 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4j-00F5uJ-0v for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:53:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524389; x=1732060389; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dZWHmSTTe0c7J1vbgAsEgmoK7XRnsjV+0BFMcsqL0yM=; b=NuGbNUxMVEXTNCk3AWRhktPnmjIlhv2SbnMlIXqppi3aZSRd/jKfetJv xA4o/StLvkRY7HIyNwP8u4YNKvSvQFozCRTSa9xog+90JnOiLaFWh1oyu U0BQnhL9ADF9dUXQfuC+RPlrA91vdTh8UEPxAjqIM3pDhDyEShikIFRss k2b97mdexUokbb0Vy6JKCCAzifyt4jewur6Txoa1Oiy7oxzJsAwO7RBw+ stxKaepZJcT/K7kc46JIbfwJiMMOIhUWeu1vwSpMQBdpUcMd7GeyfGmXI 71R/nhfQ7Ov0ZHzmI7fWzF29TOB4BL/BmS1EWQ/hLvRZukD43BIsk7oPg A==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769835" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769835" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871480" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871480" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:07 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Benjamin Berg Subject: [PATCH 33/42] hwsim: Fix some incorrect failure waiting calls Date: Tue, 21 Nov 2023 01:51:47 +0200 Message-Id: <20231120235156.363852-34-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155309_397195_C3D18523 X-CRM114-Status: GOOD ( 12.21 ) X-Spam-Score: -0.4 (/) 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: Benjamin Berg These were either sending the command to the wrong hostap/wpa_supplicant instance or using the wrong command. This currently causes the wait to just immediately stop, but with future commits it would [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Benjamin Berg These were either sending the command to the wrong hostap/wpa_supplicant instance or using the wrong command. This currently causes the wait to just immediately stop, but with future commits it would start failing. Signed-off-by: Benjamin Berg --- tests/hwsim/test_ap_hs20.py | 4 ++-- tests/hwsim/test_rrm.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/hwsim/test_ap_hs20.py b/tests/hwsim/test_ap_hs20.py index 30bacb9697..c77c8d2e96 100644 --- a/tests/hwsim/test_ap_hs20.py +++ b/tests/hwsim/test_ap_hs20.py @@ -5470,7 +5470,7 @@ def run_proxyarp_errors(dev, apdev, params): with fail_test(hapd, 1, "x_snoop_mcast_to_ucast_convert_send"): if "OK" not in hapd.request("DATA_TEST_FRAME ifname=ap-br0 " + binascii.hexlify(pkt).decode()): raise Exception("DATA_TEST_FRAME failed") - wait_fail_trigger(dev[0], "GET_FAIL") + wait_fail_trigger(hapd, "GET_FAIL") with alloc_fail(hapd, 1, "sta_ip6addr_add"): src_ll_opt0 = b"\x01\x01" + binascii.unhexlify(addr0.replace(':', '')) @@ -5479,7 +5479,7 @@ def run_proxyarp_errors(dev, apdev, params): opt=src_ll_opt0) if "OK" not in dev[0].request("DATA_TEST_FRAME " + binascii.hexlify(pkt).decode()): raise Exception("DATA_TEST_FRAME failed") - wait_fail_trigger(dev[0], "GET_ALLOC_FAIL") + wait_fail_trigger(hapd, "GET_ALLOC_FAIL") def test_ap_hs20_connect_deinit(dev, apdev): """Hotspot 2.0 connection interrupted with deinit""" diff --git a/tests/hwsim/test_rrm.py b/tests/hwsim/test_rrm.py index 76d75067fb..4d64d40752 100644 --- a/tests/hwsim/test_rrm.py +++ b/tests/hwsim/test_rrm.py @@ -1134,7 +1134,7 @@ def test_rrm_beacon_req_table_request_oom(dev, apdev): with fail_test(dev[0], 1, "wpa_driver_nl80211_send_action;wpas_rrm_send_msr_report_mpdu"): token = run_req_beacon(hapd, addr, req + "020101" + "0a03000106") - wait_fail_trigger(dev[0], "GET_ALLOC_FAIL") + wait_fail_trigger(dev[0], "GET_FAIL") ev = hapd.wait_event(["BEACON-RESP-RX"], timeout=0.1) if ev is not None: raise Exception("Unexpected beacon report response received (OOM)") From patchwork Mon Nov 20 23:51:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866391 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=XNW6If4a; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=lLyJd+CH; 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 4SZ49p5PCGz1ySN for ; Tue, 21 Nov 2023 10:54:38 +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=GgIlI64CrMufM+yGbTcQGbO1tUAPhOLCktIkf6grM0g=; b=XNW6If4ad0hwM0 u+NDLGLat2VOUFAVRGT2J+j5rE7eNzIXQ0dgRda/3mYNcbxSoTAOYDryeh/2RV2IIUhVVLKnPDuTQ YrvOAmQnDP7j5jlMQi64M2Sl5blJ3WMs9wdv7jEhHnusjySzBV8vp9A/qTw7ynj/wspXyd2J9svsS nfnqbk8xacKNOz6q6rNT/J3QG6YNubs7REQYUWxEyHbx4HwlRZUacvGYc2jxsv8GGSyztHCdNqE0J +CLGMqvHwUcTxJt1uF3nkjwJPs2GHs8KgtdFbDZFREwmOyrwoZUhCXjMZKb0qJP/5cZcjFHr1m/jq jbTrCj+vMTJxCvnXuGpg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E5b-00F76c-2N; Mon, 20 Nov 2023 23:54:03 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4l-00F5uJ-0e for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:53:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524391; x=1732060391; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=evPsWVTXp1sGLVp0Y91LFTpYHgmJ+dY9oKvKWg1dLCg=; b=lLyJd+CHAh/ioo0GU/4oYQoKdSaQ9sVh9caxPE6RHXSgR0VZ+x5iUArR oGkl4pZC047CypS44SsdvL0c3w9G2DVmonTZ5RYWRUbQoO/bmCAlDSZTZ tzBo70Ca4PWYQsdDVjuQr1BQJM1G2t4Dj7qXJ67W1BAWeIzr+Q+2k43w5 ZKT2ehh2BruIgKCxlJZKsDGiRzNwIZHQHeRkT4Z3nsQElaGU183a174kC xLecNKnMnirtp2jJdyXpXvNFu1q0YOiMGyUDUk0E7ypVg49CMeMbPmHn9 S/mCxCkjz++VoX6GXR9+50Fo66qXI3OOs5W6dcJxjm5w7x2M9g/ka5n7y A==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769838" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769838" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871484" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871484" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:08 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Benjamin Berg Subject: [PATCH 34/42] os: allow multiple failures in one test Date: Tue, 21 Nov 2023 01:51:48 +0200 Message-Id: <20231120235156.363852-35-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155311_378435_422AB399 X-CRM114-Status: GOOD ( 21.43 ) X-Spam-Score: -0.4 (/) 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: Benjamin Berg Refactor the backtrace matching a bit in order to allow triggering multiple failures in one test. Signed-off-by: Benjamin Berg --- hostapd/ctrl_iface.c | 77 + src/utils/os.h | 20 +++-- src/utils/os_unix.c | 170 ++++++++++++++++ wpa_suppl [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Benjamin Berg Refactor the backtrace matching a bit in order to allow triggering multiple failures in one test. Signed-off-by: Benjamin Berg --- hostapd/ctrl_iface.c | 77 +--------------- src/utils/os.h | 20 +++-- src/utils/os_unix.c | 170 ++++++++++++++++-------------------- wpa_supplicant/ctrl_iface.c | 74 +--------------- 4 files changed, 98 insertions(+), 243 deletions(-) diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c index 6ad86142e6..8d34cf1627 100644 --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c @@ -2006,74 +2006,6 @@ done: } -static int hostapd_ctrl_test_alloc_fail(struct hostapd_data *hapd, char *cmd) -{ -#ifdef WPA_TRACE_BFD - char *pos; - - wpa_trace_fail_after = atoi(cmd); - pos = os_strchr(cmd, ':'); - if (pos) { - pos++; - os_strlcpy(wpa_trace_fail_func, pos, - sizeof(wpa_trace_fail_func)); - } else { - wpa_trace_fail_after = 0; - } - - return 0; -#else /* WPA_TRACE_BFD */ - return -1; -#endif /* WPA_TRACE_BFD */ -} - - -static int hostapd_ctrl_get_alloc_fail(struct hostapd_data *hapd, - char *buf, size_t buflen) -{ -#ifdef WPA_TRACE_BFD - return os_snprintf(buf, buflen, "%u:%s", wpa_trace_fail_after, - wpa_trace_fail_func); -#else /* WPA_TRACE_BFD */ - return -1; -#endif /* WPA_TRACE_BFD */ -} - - -static int hostapd_ctrl_test_fail(struct hostapd_data *hapd, char *cmd) -{ -#ifdef WPA_TRACE_BFD - char *pos; - - wpa_trace_test_fail_after = atoi(cmd); - pos = os_strchr(cmd, ':'); - if (pos) { - pos++; - os_strlcpy(wpa_trace_test_fail_func, pos, - sizeof(wpa_trace_test_fail_func)); - } else { - wpa_trace_test_fail_after = 0; - } - - return 0; -#else /* WPA_TRACE_BFD */ - return -1; -#endif /* WPA_TRACE_BFD */ -} - - -static int hostapd_ctrl_get_fail(struct hostapd_data *hapd, - char *buf, size_t buflen) -{ -#ifdef WPA_TRACE_BFD - return os_snprintf(buf, buflen, "%u:%s", wpa_trace_test_fail_after, - wpa_trace_test_fail_func); -#else /* WPA_TRACE_BFD */ - return -1; -#endif /* WPA_TRACE_BFD */ -} - - static int hostapd_ctrl_reset_pn(struct hostapd_data *hapd, const char *cmd) { struct sta_info *sta; @@ -3704,16 +3636,15 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd, if (hostapd_ctrl_iface_data_test_frame(hapd, buf + 16) < 0) reply_len = -1; } else if (os_strncmp(buf, "TEST_ALLOC_FAIL ", 16) == 0) { - if (hostapd_ctrl_test_alloc_fail(hapd, buf + 16) < 0) + if (testing_set_fail_pattern(true, buf + 16) < 0) reply_len = -1; } else if (os_strcmp(buf, "GET_ALLOC_FAIL") == 0) { - reply_len = hostapd_ctrl_get_alloc_fail(hapd, reply, - reply_size); + reply_len = testing_get_fail_pattern(true, reply, reply_size); } else if (os_strncmp(buf, "TEST_FAIL ", 10) == 0) { - if (hostapd_ctrl_test_fail(hapd, buf + 10) < 0) + if (testing_set_fail_pattern(false, buf + 10) < 0) reply_len = -1; } else if (os_strcmp(buf, "GET_FAIL") == 0) { - reply_len = hostapd_ctrl_get_fail(hapd, reply, reply_size); + reply_len = testing_get_fail_pattern(false, reply, reply_size); } else if (os_strncmp(buf, "RESET_PN ", 9) == 0) { if (hostapd_ctrl_reset_pn(hapd, buf + 9) < 0) reply_len = -1; diff --git a/src/utils/os.h b/src/utils/os.h index 21ba5c3ff8..83d5ad99b2 100644 --- a/src/utils/os.h +++ b/src/utils/os.h @@ -667,14 +667,22 @@ int os_exec(const char *program, const char *arg, int wait_completion); #if defined(WPA_TRACE_BFD) && defined(CONFIG_TESTING_OPTIONS) -#define TEST_FAIL() testing_test_fail() -int testing_test_fail(void); -extern char wpa_trace_fail_func[256]; -extern unsigned int wpa_trace_fail_after; -extern char wpa_trace_test_fail_func[256]; -extern unsigned int wpa_trace_test_fail_after; +#define TEST_FAIL() testing_test_fail(false) +int testing_test_fail(bool is_alloc); +int testing_set_fail_pattern(bool is_alloc, char *patterns); +int testing_get_fail_pattern(bool is_alloc, char *buf, size_t buflen); #else #define TEST_FAIL() 0 +static inline int testing_set_fail_pattern(bool is_alloc, char *patterns) +{ + return -1; +} + +static inline int testing_get_fail_pattern(bool is_alloc, char *buf, + size_t buflen) +{ + return -1; +} #endif #endif /* OS_H */ diff --git a/src/utils/os_unix.c b/src/utils/os_unix.c index 258deef9dd..d9664b0f79 100644 --- a/src/utils/os_unix.c +++ b/src/utils/os_unix.c @@ -540,39 +540,46 @@ void * os_memdup(const void *src, size_t len) #ifdef WPA_TRACE #if defined(WPA_TRACE_BFD) && defined(CONFIG_TESTING_OPTIONS) -char wpa_trace_fail_func[256] = { 0 }; -unsigned int wpa_trace_fail_after; +struct wpa_trace_test_fail { + unsigned int fail_after; + char pattern[256]; +} wpa_trace_test_fail[5][2]; -static int testing_fail_alloc(void) +int testing_test_fail(bool is_alloc) { + const char *ignore_list[] = { + __func__, "os_malloc", "os_zalloc", "os_calloc", "os_realloc", + "os_realloc_array", "os_strdup", "os_memdup" + }; const char *func[WPA_TRACE_LEN]; - size_t i, res, len; + size_t i, j, res, len, idx; char *pos, *next; int match; - if (!wpa_trace_fail_after) + is_alloc = !!is_alloc; + + for (idx = 0; idx < ARRAY_SIZE(wpa_trace_test_fail[is_alloc]); idx++) { + if (wpa_trace_test_fail[is_alloc][idx].fail_after != 0) + break; + } + if (idx >= ARRAY_SIZE(wpa_trace_test_fail[is_alloc])) return 0; res = wpa_trace_calling_func(func, WPA_TRACE_LEN); i = 0; - if (i < res && os_strcmp(func[i], __func__) == 0) - i++; - if (i < res && os_strcmp(func[i], "os_malloc") == 0) - i++; - if (i < res && os_strcmp(func[i], "os_zalloc") == 0) - i++; - if (i < res && os_strcmp(func[i], "os_calloc") == 0) - i++; - if (i < res && os_strcmp(func[i], "os_realloc") == 0) - i++; - if (i < res && os_strcmp(func[i], "os_realloc_array") == 0) - i++; - if (i < res && os_strcmp(func[i], "os_strdup") == 0) - i++; - if (i < res && os_strcmp(func[i], "os_memdup") == 0) - i++; - pos = wpa_trace_fail_func; + /* Skip this function as well as allocation helpers */ + for (j = 0; j < ARRAY_SIZE(ignore_list) && i < res; j++) { + if (os_strcmp(func[i], ignore_list[j]) == 0) + i++; + } + + pos = wpa_trace_test_fail[is_alloc][idx].pattern; + + /* The prefixes mean: + * - '=': The function needs to be next in the backtrace + * - '?': The function is optionally present in the backtrace + */ match = 0; while (i < res) { @@ -612,10 +619,10 @@ static int testing_fail_alloc(void) if (!match) return 0; - wpa_trace_fail_after--; - if (wpa_trace_fail_after == 0) { - wpa_printf(MSG_INFO, "TESTING: fail allocation at %s", - wpa_trace_fail_func); + wpa_trace_test_fail[is_alloc][idx].fail_after--; + if (wpa_trace_test_fail[is_alloc][idx].fail_after == 0) { + wpa_printf(MSG_INFO, "TESTING: fail at %s", + wpa_trace_test_fail[is_alloc][idx].pattern); for (i = 0; i < res; i++) wpa_printf(MSG_INFO, "backtrace[%d] = %s", (int) i, func[i]); @@ -625,83 +632,58 @@ static int testing_fail_alloc(void) return 0; } - -char wpa_trace_test_fail_func[256] = { 0 }; -unsigned int wpa_trace_test_fail_after; - -int testing_test_fail(void) +int testing_set_fail_pattern(bool is_alloc, char *patterns) { - const char *func[WPA_TRACE_LEN]; - size_t i, res, len; - char *pos, *next; - int match; + char *token, *context = NULL; + size_t idx; + + is_alloc = !!is_alloc; + + os_memset(wpa_trace_test_fail[is_alloc], 0, + sizeof(wpa_trace_test_fail[is_alloc])); + + idx = 0; + while ((token = str_token(patterns, " \n\r\t", &context)) && + idx < ARRAY_SIZE(wpa_trace_test_fail[is_alloc])) { + wpa_trace_test_fail[is_alloc][idx].fail_after = atoi(token); + token = os_strchr(token, ':'); + if (!token) { + os_memset(wpa_trace_test_fail[is_alloc], 0, + sizeof(wpa_trace_test_fail[is_alloc])); + return -1; + } - if (!wpa_trace_test_fail_after) - return 0; + os_strlcpy(wpa_trace_test_fail[is_alloc][idx].pattern, + token + 1, + sizeof(wpa_trace_test_fail[is_alloc][0].pattern)); + idx++; + } - res = wpa_trace_calling_func(func, WPA_TRACE_LEN); - i = 0; - if (i < res && os_strcmp(func[i], __func__) == 0) - i++; + return 0; +} - pos = wpa_trace_test_fail_func; +int testing_get_fail_pattern(bool is_alloc, char *buf, size_t buflen) +{ + size_t idx, ret; + char *pos = buf; + char *end = buf + buflen; - match = 0; - while (i < res) { - int allow_skip = 1; - int maybe = 0; + is_alloc = !!is_alloc; - if (*pos == '=') { - allow_skip = 0; - pos++; - } else if (*pos == '?') { - maybe = 1; - pos++; - } - next = os_strchr(pos, ';'); - if (next) - len = next - pos; - else - len = os_strlen(pos); - if (os_memcmp(pos, func[i], len) != 0) { - if (maybe && next) { - pos = next + 1; - continue; - } - if (allow_skip) { - i++; - continue; - } - return 0; - } - if (!next) { - match = 1; + for (idx = 0; idx < ARRAY_SIZE(wpa_trace_test_fail[is_alloc]); idx++) { + if (wpa_trace_test_fail[is_alloc][idx].pattern[0] == '\0') break; - } - pos = next + 1; - i++; - } - if (!match) - return 0; - wpa_trace_test_fail_after--; - if (wpa_trace_test_fail_after == 0) { - wpa_printf(MSG_INFO, "TESTING: fail at %s", - wpa_trace_test_fail_func); - for (i = 0; i < res; i++) - wpa_printf(MSG_INFO, "backtrace[%d] = %s", - (int) i, func[i]); - return 1; + ret = os_snprintf(pos, end - pos, "%s%u:%s", + pos == buf ? "" : " ", + wpa_trace_test_fail[is_alloc][idx].fail_after, + wpa_trace_test_fail[is_alloc][idx].pattern); + if (os_snprintf_error(end - pos, ret)) + break; + pos += ret; } - return 0; -} - -#else - -static inline int testing_fail_alloc(void) -{ - return 0; + return pos - buf; } #endif @@ -709,7 +691,7 @@ void * os_malloc(size_t size) { struct os_alloc_trace *a; - if (testing_fail_alloc()) + if (testing_test_fail(true)) return NULL; a = malloc(sizeof(*a) + size); diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index a68802e493..b716fa774e 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -10134,72 +10134,6 @@ done: } -static int wpas_ctrl_test_alloc_fail(struct wpa_supplicant *wpa_s, char *cmd) -{ -#ifdef WPA_TRACE_BFD - char *pos; - - wpa_trace_fail_after = atoi(cmd); - pos = os_strchr(cmd, ':'); - if (pos) { - pos++; - os_strlcpy(wpa_trace_fail_func, pos, - sizeof(wpa_trace_fail_func)); - } else { - wpa_trace_fail_after = 0; - } - return 0; -#else /* WPA_TRACE_BFD */ - return -1; -#endif /* WPA_TRACE_BFD */ -} - - -static int wpas_ctrl_get_alloc_fail(struct wpa_supplicant *wpa_s, - char *buf, size_t buflen) -{ -#ifdef WPA_TRACE_BFD - return os_snprintf(buf, buflen, "%u:%s", wpa_trace_fail_after, - wpa_trace_fail_func); -#else /* WPA_TRACE_BFD */ - return -1; -#endif /* WPA_TRACE_BFD */ -} - - -static int wpas_ctrl_test_fail(struct wpa_supplicant *wpa_s, char *cmd) -{ -#ifdef WPA_TRACE_BFD - char *pos; - - wpa_trace_test_fail_after = atoi(cmd); - pos = os_strchr(cmd, ':'); - if (pos) { - pos++; - os_strlcpy(wpa_trace_test_fail_func, pos, - sizeof(wpa_trace_test_fail_func)); - } else { - wpa_trace_test_fail_after = 0; - } - return 0; -#else /* WPA_TRACE_BFD */ - return -1; -#endif /* WPA_TRACE_BFD */ -} - - -static int wpas_ctrl_get_fail(struct wpa_supplicant *wpa_s, - char *buf, size_t buflen) -{ -#ifdef WPA_TRACE_BFD - return os_snprintf(buf, buflen, "%u:%s", wpa_trace_test_fail_after, - wpa_trace_test_fail_func); -#else /* WPA_TRACE_BFD */ - return -1; -#endif /* WPA_TRACE_BFD */ -} - - static void wpas_ctrl_event_test_cb(void *eloop_ctx, void *timeout_ctx) { struct wpa_supplicant *wpa_s = eloop_ctx; @@ -12886,15 +12820,15 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, if (wpas_ctrl_iface_data_test_frame(wpa_s, buf + 16) < 0) reply_len = -1; } else if (os_strncmp(buf, "TEST_ALLOC_FAIL ", 16) == 0) { - if (wpas_ctrl_test_alloc_fail(wpa_s, buf + 16) < 0) + if (testing_set_fail_pattern(true, buf + 16) < 0) reply_len = -1; } else if (os_strcmp(buf, "GET_ALLOC_FAIL") == 0) { - reply_len = wpas_ctrl_get_alloc_fail(wpa_s, reply, reply_size); + reply_len = testing_get_fail_pattern(true, reply, reply_size); } else if (os_strncmp(buf, "TEST_FAIL ", 10) == 0) { - if (wpas_ctrl_test_fail(wpa_s, buf + 10) < 0) + if (testing_set_fail_pattern(false, buf + 10) < 0) reply_len = -1; } else if (os_strcmp(buf, "GET_FAIL") == 0) { - reply_len = wpas_ctrl_get_fail(wpa_s, reply, reply_size); + reply_len = testing_get_fail_pattern(false, reply, reply_size); } else if (os_strncmp(buf, "EVENT_TEST ", 11) == 0) { if (wpas_ctrl_event_test(wpa_s, buf + 11) < 0) reply_len = -1; From patchwork Mon Nov 20 23:51:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866390 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=ycpDzW7a; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=BRRHK6Dn; 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 4SZ49n1RYCz1ySN for ; Tue, 21 Nov 2023 10:54:37 +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=L4McWqZbCp9GE1OnyrDabSXLra2IwUBrRWkFw/Q8aZo=; b=ycpDzW7aR8C18D CVR+16T0GLXkdt1ndCx9GpphmcHDnNPaTG8YI0eZmqiCu1xwFoTQIam0GRe38y5YIQQV7tglUO5G3 d8Kr0damBjj1FUlGo2HJ5UcLCoGRimdSEZQXOVGIu+D/S8CX60v2XX/mzWMqo0eIle3SUIV/Rxa55 Rvwl7zjF0TI2oBJIfrJfeotzgoxKK8HuOxKkmeoVhvcp2QW/pKluJ4HDLXOiEmlpRE0M9wCm+oyuu BOm2ZfFkP/xM0Tm572czSTvwkWEqOvQ3I15A384anBFSqjuHUBnDAhiieLFEaH2j5NGqTrT/wgOry BuvtaPTGEsUQXBsa/Jbg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E5X-00F70X-32; Mon, 20 Nov 2023 23:53:59 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4m-00F5iV-13 for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:53:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524392; x=1732060392; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=67KVQi1vXnFBwD99lTZXZfcOHHtHXZLdy3EEVVIYrgQ=; b=BRRHK6DnNut8m2mRY/GbliFTFBE/05ayLT5nArJugC768F1eWjAneoB8 OPAwiSpE/o0vBKAB7H7zS8TCiqIPskMDL3laXUoLWPTBgogltZNCJ9B/X 1i1EWiTZj7aluANvm3WiZ2HuU3jz7RVzx7bWdFuR8LEdKP4Ir9m2dzKGB Yl+rsgFga5RcJ8LU8UZ1MIOzAl7I6jMEEMpr7Qbk1YjiXFE+vxx+uumsQ vpvnKM5X6AnYN7nCC7Onuw7w4ztlGrJhxdJJQGpIC6wEl8vFwU1R/PoKP TgjNOsCdOEavQqVjz072jrSbW2q0iQfY66O/mLRa/nsxyapCZt+oHJziR Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769840" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769840" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871489" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871489" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:09 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Benjamin Berg Subject: [PATCH 35/42] tests: allow specifying multiple failure locations Date: Tue, 21 Nov 2023 01:51:49 +0200 Message-Id: <20231120235156.363852-36-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155312_429954_ACEDF168 X-CRM114-Status: GOOD ( 12.08 ) X-Spam-Score: -0.4 (/) 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: Benjamin Berg Having the ability to trigger multiple failures in one test can be useful. Add support to the test infrastructure to do this. Signed-off-by: Benjamin Berg --- tests/hwsim/utils.py | 45 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+), 20 deletions(-) Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Benjamin Berg Having the ability to trigger multiple failures in one test can be useful. Add support to the test infrastructure to do this. Signed-off-by: Benjamin Berg --- tests/hwsim/utils.py | 45 ++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/tests/hwsim/utils.py b/tests/hwsim/utils.py index 769f824c7b..d572bdc4c9 100644 --- a/tests/hwsim/utils.py +++ b/tests/hwsim/utils.py @@ -35,33 +35,38 @@ def long_duration_test(func): func.long_duration_test = True return func -class alloc_fail(object): - def __init__(self, dev, count, funcs): - self._dev = dev - self._count = count - self._funcs = funcs - def __enter__(self): - cmd = "TEST_ALLOC_FAIL %d:%s" % (self._count, self._funcs) - if "OK" not in self._dev.request(cmd): - raise HwsimSkip("TEST_ALLOC_FAIL not supported") - def __exit__(self, type, value, traceback): - if type is None: - if self._dev.request("GET_ALLOC_FAIL") != "0:%s" % self._funcs: - raise Exception("Allocation failure did not trigger") - class fail_test(object): - def __init__(self, dev, count, funcs): + _test_fail = 'TEST_FAIL' + _get_fail = 'GET_FAIL' + + def __init__(self, dev, count, funcs, *args): self._dev = dev - self._count = count - self._funcs = funcs + self._funcs = [(count, funcs)] + + args = list(args) + while args: + count = args.pop(0) + funcs = args.pop(0) + self._funcs.append((count, funcs)) def __enter__(self): - cmd = "TEST_FAIL %d:%s" % (self._count, self._funcs) + patterns = ' '.join(['%d:%s' % (c, f) for c, f in self._funcs]) + cmd = '%s %s' % (self._test_fail, patterns) if "OK" not in self._dev.request(cmd): raise HwsimSkip("TEST_FAIL not supported") def __exit__(self, type, value, traceback): + pending = self._dev.request(self._get_fail) if type is None: - if self._dev.request("GET_FAIL") != "0:%s" % self._funcs: - raise Exception("Test failure did not trigger") + expected = ' '.join(['0:%s' % f for c, f in self._funcs]) + if pending != expected: + # Ensure the failure cannot trigger in the future + self._dev.request('%s 0:' % self._test_fail) + raise Exception("Not all failures triggered (pending: %s)" % pending) + else: + logger.info("Pending failures at time of exception: %s" % pending) + +class alloc_fail(fail_test): + _test_fail = 'TEST_ALLOC_FAIL' + _get_fail = 'GET_ALLOC_FAIL' def wait_fail_trigger(dev, cmd, note="Failure not triggered", max_iter=40, timeout=0.05): From patchwork Mon Nov 20 23:51:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866392 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=Q3Xd0Ldw; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=fCSimCDh; 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 4SZ49y12C8z1ySN for ; Tue, 21 Nov 2023 10:54:46 +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=RGYm0ShMvi4NRUU2RsmyBw6JWH8nkMYvFZ1tG4n3j2M=; b=Q3Xd0LdwouIeti EtEtgbWG/dWRi72UzjwE18XDI8c9GFP1YCIQhG0Wycx42X0XKak6k7Yu5d9RObouL5T0ACOdjtH3U gvja1modRg6d7KBBgXQ7bqky2tBdniH/DVkmRnPY5Unqyo+ruH714sSISGsCmOkVird5tGCen7360 CECStoTMxV0UmglbW2jYrnTBoZMzfbN0t8Zy7SWenLkWcqFHzXeDo+aPkXHlRPYsQxkjvDlsM7PfA VNeXUvDxXiWeqIV/wGddcw3J7vt5C8IMFAlWKDeNhVFw9BMOL1vFY5MqDpkFI69o3zGT3SBumSV+W ZEsxRFFi2lLSs3ufEHaw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E5j-00F7H8-1y; Mon, 20 Nov 2023 23:54:11 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4o-00F5iV-1t for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:53:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524394; x=1732060394; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6c4xtZJlNSjZQEC4pwP+PbcTGDZEMonA6bYfWfLFmVk=; b=fCSimCDhFk0w7a7DUusfQr3rdL15AOg0XgZWJoPa2cX1rewGoOr2DxLi srG+II/swiY/GARSPYEE4h9pf8hBsXWOlV5JhXKG/oxo2vqEfu+QGeelZ Hx1aMKdRaip/o13CSkemjxLcC/XBvhJYw4RPEf8/Lc/YND8z6eP+F5tpo YMCcnWBvuL/W6g6HJXcaKQpAb8iezWtmwivsA37D81WpqMMMkUzsGJWbA 0z/ctSa5K445c+P/J34VFDiJUnhI4FHBsmezyu6fkTIYznNOWKGLT350G cM9jemx4b7xkdKKlNKgpHIXRAchX1sOeJkT9KCpUrS5NPRGrnx9DX3Ftg w==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769842" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769842" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871492" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871492" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:11 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Benjamin Berg Subject: [PATCH 36/42] os: Add TEST_FAIL_TAG macro to allow more narrow matching Date: Tue, 21 Nov 2023 01:51:50 +0200 Message-Id: <20231120235156.363852-37-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155314_694849_BD9283FC X-CRM114-Status: GOOD ( 16.56 ) X-Spam-Score: -0.4 (/) 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: Benjamin Berg The tag is inserted as the first item in the stack trace, making it trivial to match against it from the test. Signed-off-by: Benjamin Berg --- src/utils/os.h | 6 ++++-- src/utils/os_unix.c | 25 +++++++++++++++++++------ 2 files changed, 23 insertions(+), 8 deletions(-) Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Benjamin Berg The tag is inserted as the first item in the stack trace, making it trivial to match against it from the test. Signed-off-by: Benjamin Berg --- src/utils/os.h | 6 ++++-- src/utils/os_unix.c | 25 +++++++++++++++++++------ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/utils/os.h b/src/utils/os.h index 83d5ad99b2..07abf7a9a0 100644 --- a/src/utils/os.h +++ b/src/utils/os.h @@ -667,12 +667,14 @@ int os_exec(const char *program, const char *arg, int wait_completion); #if defined(WPA_TRACE_BFD) && defined(CONFIG_TESTING_OPTIONS) -#define TEST_FAIL() testing_test_fail(false) -int testing_test_fail(bool is_alloc); +#define TEST_FAIL() testing_test_fail(NULL, false) +#define TEST_FAIL_TAG(tag) testing_test_fail(tag, false) +int testing_test_fail(const char *tag, bool is_alloc); int testing_set_fail_pattern(bool is_alloc, char *patterns); int testing_get_fail_pattern(bool is_alloc, char *buf, size_t buflen); #else #define TEST_FAIL() 0 +#define TEST_FAIL_TAG(tag) 0 static inline int testing_set_fail_pattern(bool is_alloc, char *patterns) { return -1; diff --git a/src/utils/os_unix.c b/src/utils/os_unix.c index d9664b0f79..da52f44028 100644 --- a/src/utils/os_unix.c +++ b/src/utils/os_unix.c @@ -545,10 +545,10 @@ struct wpa_trace_test_fail { char pattern[256]; } wpa_trace_test_fail[5][2]; -int testing_test_fail(bool is_alloc) +int testing_test_fail(const char *tag, bool is_alloc) { const char *ignore_list[] = { - __func__, "os_malloc", "os_zalloc", "os_calloc", "os_realloc", + "os_malloc", "os_zalloc", "os_calloc", "os_realloc", "os_realloc_array", "os_strdup", "os_memdup" }; const char *func[WPA_TRACE_LEN]; @@ -568,9 +568,22 @@ int testing_test_fail(bool is_alloc) res = wpa_trace_calling_func(func, WPA_TRACE_LEN); i = 0; - /* Skip this function as well as allocation helpers */ - for (j = 0; j < ARRAY_SIZE(ignore_list) && i < res; j++) { - if (os_strcmp(func[i], ignore_list[j]) == 0) + if (is_alloc) { + /* Skip our own stack frame */ + i++; + + /* Skip allocation helpers */ + for (j = 0; j < ARRAY_SIZE(ignore_list) && i < res; j++) { + if (os_strcmp(func[i], ignore_list[j]) == 0) + i++; + } + } else { + /* Not allocation, we might have a tag, if so, replace our + * own stack frame with the tag, otherwise skip it. + */ + if (tag) + func[0] = tag; + else i++; } @@ -691,7 +704,7 @@ void * os_malloc(size_t size) { struct os_alloc_trace *a; - if (testing_test_fail(true)) + if (testing_test_fail(NULL, true)) return NULL; a = malloc(sizeof(*a) + size); From patchwork Mon Nov 20 23:51:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866393 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=nefbtgWa; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=jDKfIMg1; 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 4SZ49z6cXfz1ySN for ; Tue, 21 Nov 2023 10:54:47 +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=UAs8qZS2H4CVk1kiuFWkVy65CZc3nBVpDUqWwyH1z/A=; b=nefbtgWaP3xTCM 5ff7PdkLEUlq4tYJdc9P4v61JJvFWf19VxkjC4Uk8vK/QmtGJSCOFOUgcVlX/a0bQYCGOd0d8WCsF qdPxzNzs6IPe7jCDg60p3sBsENqrPdf4v62iVS8uRZ3DAj9yF1cfD+fWdm/nG0U2lCmwSrKdvwZQy tfQVEhmnpz0V/wvCj/LdCkRRTR3iEzRGY3F8AO5QXCsyJ1i8wwr1owZmeGrBjyizEVYIaJzdwg/nw t+gtTDUF+MCdq58kGo+Yp41WUfCVMA/Havu+qnIHDltAm/0BZRXAHSv9nVlodsiZlPE52b2w9mzEE z0H6Yv2dWNaMhkEZuOtQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E5h-00F7DK-01; Mon, 20 Nov 2023 23:54:09 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4o-00F5uJ-27 for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:53:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524394; x=1732060394; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ugUkvw1sOi79XIT+nr/HSq+FTqSmLZN/YChFpW/fYqc=; b=jDKfIMg1s/IcFhAhFrMRoeJTy927qYhGvhcRXlR8u++g8mNG3D0ojxrq A3hbKG7wZhGyJtLxkwnaeiFXW6b4yLV/m3O0DlXb/He5gcrbs0ndKl3Ci um9PZchTj8ggn0LTVx1FERIH4/XurLDAoAGzsHh8vwdD+dU8YtCRVWSWT t4RjWndeHo4QeeISO9lccKRl77NlCNx2qqVhi4fnOG26+ZlM8/StA45WS JLJ9WchXO6ttxuj9mIl5DfQfkdrvH7j6dobHxUHxW+orZFJ8MCTd8/At4 UAWrv/4vHsb2ehewySpvkkTsBlvWIe/jbLf3uScaXmMEgX/Vswp3eRc+h Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769846" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769846" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871496" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871496" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:12 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Ilan Peer , Andrei Otcheretianski Subject: [PATCH 37/42] tests: Add validation of number of valid and active links Date: Tue, 21 Nov 2023 01:51:51 +0200 Message-Id: <20231120235156.363852-38-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155314_762153_489AC1A4 X-CRM114-Status: GOOD ( 11.30 ) X-Spam-Score: -0.4 (/) 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: Ilan Peer Signed-off-by: Ilan Peer Signed-off-by: Andrei Otcheretianski --- tests/hwsim/test_eht.py | 52 +++++++++++++++++++++++++++++++++++------ 1 file [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Ilan Peer Signed-off-by: Ilan Peer Signed-off-by: Andrei Otcheretianski --- tests/hwsim/test_eht.py | 52 +++++++++++++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/tests/hwsim/test_eht.py b/tests/hwsim/test_eht.py index 530128c9c6..1f76d41ab7 100644 --- a/tests/hwsim/test_eht.py +++ b/tests/hwsim/test_eht.py @@ -20,8 +20,38 @@ def eht_verify_wifi_version(dev): if status['wifi_generation'] != "7": raise Exception("Unexpected wifi_generation value: " + status['wifi_generation']) +def _eht_get_links_bitmap(wpas, name): + vfile = "/sys/kernel/debug/ieee80211/%s/netdev:%s/%s" % \ + (wpas.get_driver_status_field("phyname"), wpas.ifname, name) + + if wpas.cmd_execute(["ls", vfile])[0] != 0: + logger_info("%s not supported in mac80211: %s" % (name, vfile)) + return 0 + + res, out = wpas.cmd_execute(["cat", vfile], shell=True) + if res != 0: + raise Exception("Failed to read %s" % fname) + + logger.info("%s=%s" % (name, out)) + return int(out, 16) + +def _eht_valid_links(wpas): + return _eht_get_links_bitmap(wpas, "valid_links") + +def _eht_active_links(wpas): + return _eht_get_links_bitmap(wpas, "active_links") + +def _eht_verify_links(wpas, valid_links=0, active_links=0): + vlinks = _eht_valid_links(wpas) + if vlinks != valid_links: + raise Exception("Unexpected valid links (0x%04x != 0x%04x)" % (vlinks, valid_links)) + + alinks = _eht_active_links(wpas) + if alinks != active_links: + raise Exception("Unexpected active links (0x%04x != 0x%04x)" % (alinks, active_links)) + def eht_verify_status(wpas, hapd, freq, bw, is_ht=False, is_vht=False, - mld=False): + mld=False, valid_links=0, active_links=0): status = hapd.get_status() logger.info("hostapd STATUS: " + str(status)) @@ -57,6 +87,11 @@ def eht_verify_status(wpas, hapd, freq, bw, is_ht=False, is_vht=False, if "WIDTH=%s MHz" % bw not in sig: raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig)) + # active links are updated in async work after the connection + # sleep a bit to allow it to run + time.sleep(0.1) + _eht_verify_links(wpas, valid_links, active_links) + def traffic_test(wpas, hapd): hwsim_utils.test_connectivity(wpas, hapd) @@ -292,7 +327,8 @@ def test_eht_mld_owe_two_links(dev, apdev): wpas.connect(ssid, scan_freq="2412 2437", key_mgmt="OWE", ieee80211w="2") - eht_verify_status(wpas, hapd0, 2412, 20, is_ht=True, mld=True) + eht_verify_status(wpas, hapd0, 2412, 20, is_ht=True, mld=True, + valid_links=3, active_links=3) eht_verify_wifi_version(wpas) traffic_test(wpas, hapd0) traffic_test(wpas, hapd1) @@ -315,7 +351,8 @@ def test_eht_mld_sae_single_link(dev, apdev): wpas.connect(ssid, sae_password=passphrase, scan_freq="2412", key_mgmt="SAE", ieee80211w="2") - eht_verify_status(wpas, hapd0, 2412, 20, is_ht=True, mld=True) + eht_verify_status(wpas, hapd0, 2412, 20, is_ht=True, mld=True, + valid_links=1, active_links=1) eht_verify_wifi_version(wpas) traffic_test(wpas, hapd0) @@ -342,7 +379,8 @@ def run_eht_mld_sae_two_links(dev, apdev, beacon_prot="1"): wpas.connect(ssid, sae_password=passphrase, scan_freq="2412 2437", key_mgmt="SAE", ieee80211w="2", beacon_prot="1") - eht_verify_status(wpas, hapd0, 2412, 20, is_ht=True, mld=True) + eht_verify_status(wpas, hapd0, 2412, 20, is_ht=True, mld=True, + valid_links=3, active_links=3) eht_verify_wifi_version(wpas) traffic_test(wpas, hapd0) traffic_test(wpas, hapd1) @@ -372,7 +410,7 @@ def test_eht_mld_sae_ext_one_link(dev, apdev): wpas.connect(ssid, sae_password=passphrase, scan_freq="2412", key_mgmt="SAE-EXT-KEY", ieee80211w="2") - eht_verify_status(wpas, hapd0, 2412, 20, is_ht=True, mld=True) + eht_verify_status(wpas, hapd0, 2412, 20, is_ht=True, mld=True, valid_links=1, active_links=1) eht_verify_wifi_version(wpas) traffic_test(wpas, hapd0) @@ -398,7 +436,7 @@ def test_eht_mld_sae_ext_two_links(dev, apdev): wpas.connect(ssid, sae_password=passphrase, scan_freq="2412 2437", key_mgmt="SAE-EXT-KEY", ieee80211w="2") - eht_verify_status(wpas, hapd0, 2412, 20, is_ht=True, mld=True) + eht_verify_status(wpas, hapd0, 2412, 20, is_ht=True, mld=True, valid_links=3, active_links=3) eht_verify_wifi_version(wpas) traffic_test(wpas, hapd0) traffic_test(wpas, hapd1) @@ -452,7 +490,7 @@ def test_eht_mld_sae_transition(dev, apdev): wpas.connect(ssid, sae_password=passphrase, scan_freq="2412 2437", key_mgmt="SAE-EXT-KEY", ieee80211w="2") - eht_verify_status(wpas, hapd0, 2412, 20, is_ht=True, mld=True) + eht_verify_status(wpas, hapd0, 2412, 20, is_ht=True, mld=True, valid_links=3, active_links=3) eht_verify_wifi_version(wpas) traffic_test(wpas, hapd0) traffic_test(wpas, hapd1) From patchwork Mon Nov 20 23:51:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866394 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=m9L1pCG/; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=J/NRy8J9; 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 4SZ4B43GsCz1ySN for ; Tue, 21 Nov 2023 10:54:52 +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=JjyfnEiUxxLzw0YeP6Ml5fRUv8ihKGv7hl9B2kCgbjA=; b=m9L1pCG/INuTCM R7kJ6Y6FGpM4E0VAVQbxKNB7qFzyFNCIoeX1StzqC37QhgAvlAl9BAduIMZ3Zojkn859rKMPEiMc3 wIWoWmSmyOM09KOcAtXg7hBLqC6knfLDyrVsFCrS4hpmPEW+lgu2yEYqDe+/cn+RnCmpfpEYLWfkz u59ocDmvsxavKqII7GW0Az4QO1UYp3XEiWgBrDoLJKJ5zvpohXfRGH4NBMChIwDb3B5cbGc48NGQK MuraSZXeHJxPSuCmLi2NnNaxWo/cIwpBqAHsmkEAAr+hFS4UL1KfiOt0cMATqyLVxl7Ujlo0Y79CR RCw5Ry5mgZED4F9aD0Uw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E5n-00F7LT-1e; Mon, 20 Nov 2023 23:54:15 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4q-00F5iV-1o for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:53:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524396; x=1732060396; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ALpGQLTJNT4xX4iEOPJur0z3sbTbTa7gfhIBTZl4Foc=; b=J/NRy8J9vmgEKsMekrWOaaNi0GH8RQHEqrdtkR8iFoaFu7UT2NIvfLtv 3EyFokN7wkYhtx9KOXyRfRxbOEWPU+x8T3BSCXIEVBC40qcZm07kRa1+r qzoDI27apArGb3nK3q7D2uPwoaXQdI6hXHX8su6wbBDn7mzLNpuVBOXd1 MFpAaYkiemGTEPoSnVWWDbpawhyka2H93/pd16ILX8Uo78Dlf5QtGem1K 2Y4kfCLl0q9M7Ox1G4ekRX9Gol/ZtTcpL9z5T7bC5+4DzHE0+0gqd97yb KdXQy3jSHTot3LaL5NcvyZeL3JYBJQ0NcXSgF+pF9Zq2vBpr1TDdudMF5 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769851" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769851" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871503" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871503" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:13 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Andrei Otcheretianski , Benjamin Berg Subject: [PATCH 38/42] tests: update ML discovery test to also check probe requests Date: Tue, 21 Nov 2023 01:51:52 +0200 Message-Id: <20231120235156.363852-39-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155316_696658_C8F5E1B4 X-CRM114-Status: GOOD ( 14.65 ) X-Spam-Score: -0.4 (/) 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: Also check that we can discover BSSs requests using ML probe requests. Note that this requires a new enough mac80211 which parses the ML probe request and reports the contained BSSs. Signed-off-by: Benjamin Berg Signed-off-by: Andrei Otcheretianski --- tests/hwsim/test_eht.py | 52 ++++++++++++++++++++++++++++++++++++++++- [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 Also check that we can discover BSSs requests using ML probe requests. Note that this requires a new enough mac80211 which parses the ML probe request and reports the contained BSSs. Signed-off-by: Benjamin Berg Signed-off-by: Andrei Otcheretianski --- tests/hwsim/test_eht.py | 52 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/tests/hwsim/test_eht.py b/tests/hwsim/test_eht.py index 1f76d41ab7..7fb737e75e 100644 --- a/tests/hwsim/test_eht.py +++ b/tests/hwsim/test_eht.py @@ -250,6 +250,30 @@ def eht_mld_ap_wpa2_params(ssid, passphrase=None, key_mgmt="WPA-PSK-SHA256", return params +def _eht_mld_probe_req(wpas, hapd, tsf0, link_id=-1): + if "OK" not in wpas.request("ML_PROBE_REQ bssid=%s mld_id=0 link_id=%d" % (hapd.own_addr(), link_id)): + raise Exception("Failed to request ML probe request") + + ev = wpas.wait_event(["CTRL-EVENT-SCAN-STARTED"]) + if ev is None: + raise Exception("Scan did not start") + + ev = wpas.wait_event(["CTRL-EVENT-SCAN-RESULTS"]) + if ev is None: + raise Exception("Scan did not complete") + + logger.info("ML Probe request scan done") + + bss = wpas.get_bss(hapd.own_addr()) + if not bss: + raise Exception("AP did not reply to ML probe request") + + tsf1 = int(bss['tsf']) + logger.info("tsf0=%s, tsf1=%s" % (tsf0, tsf1)) + + if tsf0 >= tsf1: + raise Exception("AP was not found in ML probe request scan") + def test_eht_mld_discovery(dev, apdev): """EHT MLD AP discovery""" with HWSimRadio(use_mlo=True) as (hapd_radio, hapd_iface), \ @@ -269,7 +293,8 @@ def test_eht_mld_discovery(dev, apdev): hapd0 = eht_mld_enable_ap(hapd_iface, link0_params) hapd1 = eht_mld_enable_ap(hapd_iface, link1_params) - res = wpas.request("SCAN freq=2412,2417") + # Only scan link 0 + res = wpas.request("SCAN freq=2412") if "FAIL" in res: raise Exception("Failed to start scan") @@ -296,6 +321,20 @@ def test_eht_mld_discovery(dev, apdev): if ml_pattern.search(bss) is None: raise Exception("ML element not found for first link") + # save the tsf0 for checking ML Probe request scan later + tsf0 = int(wpas.get_bss(hapd0.own_addr())['tsf']) + + if wpas.get_bss(hapd1.own_addr()) is not None: + raise Exception("BSS for link 1 found without ML probe request") + + # Now send an ML probe request (for all links) + _eht_mld_probe_req(wpas, hapd0, tsf0) + tsf0 = int(wpas.get_bss(hapd0.own_addr())['tsf']) + + # NOTE: hostap incorrectly reports a TSF offset of zero + # This only works because the source is always the ML probe response + tsf1 = int(wpas.get_bss(hapd1.own_addr())['tsf']) + bss = wpas.request("BSS " + hapd1.own_addr()) logger.info("BSS 1: " + str(bss)) @@ -305,6 +344,17 @@ def test_eht_mld_discovery(dev, apdev): if ml_pattern.search(bss) is None: raise Exception("ML element not found for second link") + _eht_mld_probe_req(wpas, hapd0, tsf0, link_id=1) + if int(wpas.get_bss(hapd1.own_addr())['tsf']) <= tsf1: + raise Exception("Probe for link ID did not update BSS") + tsf0 = int(wpas.get_bss(hapd0.own_addr())['tsf']) + tsf1 = int(wpas.get_bss(hapd1.own_addr())['tsf']) + + # Probing the wrong link ID should not update second link + _eht_mld_probe_req(wpas, hapd0, tsf0, link_id=4) + if int(wpas.get_bss(hapd1.own_addr())['tsf']) != tsf1: + raise Exception("Probe for other link ID not updated BSS") + def test_eht_mld_owe_two_links(dev, apdev): """EHT MLD AP with MLD client OWE connection using two links""" with HWSimRadio(use_mlo=True) as (hapd0_radio, hapd0_iface), \ From patchwork Mon Nov 20 23:51:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866395 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=Vr39iUKr; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=a5uzLaXk; 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 4SZ4B66QNyz1ySN for ; Tue, 21 Nov 2023 10:54:54 +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=0N+sS70rW/gwlX1VqOsE/YRx+d1AMqGy4hz7cAO2ZF4=; b=Vr39iUKrVlCc7c gYSukRTlupqP5/HYUufZ8WDoDM3vcQb11w/Ivt22EMqsE38dc2ch9pRErmEqxYJd8vOhpIEzlV8zO gnTiR6iF+bUiDFA03sT9igt4oaoFoRepIwAm633K/ZOknHfTAEGb9zPs0xdoc8TuJaP1n0vP5AiLy zUjLtVys/29UmCK5tyb+LffUB7I2qolNfCCNMPuBK1L+uiKaPfVbmj3uaJRByV3LeEuPDLR3jo0in msVPjSmchWfOBBlU7QZwiWLypNYLaRfDigoU3ZaaCdAGt01Colmrf65kYn96BLzoEJ5p89qGktVWy FKvdjKo/wLo1Lc6BxTxg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E5r-00F7RJ-25; Mon, 20 Nov 2023 23:54:19 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4q-00F5uJ-3D for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:53:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524397; x=1732060397; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7uA9PC3x+8fBcKpg/7iA2qDAc5k3Nk8PbWxfwzqV41k=; b=a5uzLaXkgy99jya4SeTN72n7qgBgDJSPL9xFBvERfi4ElbyDEms9Syi1 fPjr9ja0Eohhb+FP+Cz8AoDhs5+0vhD4x3P0GbF7sE3tPLBphQaru5uMH DN9GxIVCUC0F9xL41Ml1h8d7Wv6i1Sbq50nuH8uuESAMMqV0f6IW11GCX GGeAkjPvJS6IFl0MFvk/6mT8XEayY4nGqa/fuRSRLaEcKsOrhntQFz/kU zLHC2dppPkUiLu+l1yP4KDFFtnsbwTKRdZKXYFGyV/fD+hQHSAGbfC1fE eE6NoCZ7wYTfVUaF0/GoUHSd0T4UWXCwFXgSfQ0wI1x1Gvp5BQuq4OzuO Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769853" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769853" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871509" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871509" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:14 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Benjamin Berg Subject: [PATCH 39/42] tests: Add some MLD association tests Date: Tue, 21 Nov 2023 01:51:53 +0200 Message-Id: <20231120235156.363852-40-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155317_097507_F1EAB004 X-CRM114-Status: GOOD ( 12.42 ) X-Spam-Score: -0.4 (/) 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: Benjamin Berg Test ML association, automatic link discovery using ML probe requests and marking BSSs as failed after an ML assoication failure, if the corresponding link also rejected the association. Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Benjamin Berg Test ML association, automatic link discovery using ML probe requests and marking BSSs as failed after an ML assoication failure, if the corresponding link also rejected the association. Signed-off-by: Benjamin Berg --- tests/hwsim/test_eht.py | 112 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) diff --git a/tests/hwsim/test_eht.py b/tests/hwsim/test_eht.py index 7fb737e75e..75935a42cd 100644 --- a/tests/hwsim/test_eht.py +++ b/tests/hwsim/test_eht.py @@ -10,6 +10,7 @@ from hwsim import HWSimRadio import hwsim_utils from wpasupplicant import WpaSupplicant import re +from tshark import run_tshark def eht_verify_wifi_version(dev): status = dev.get_status() @@ -672,3 +673,114 @@ def test_eht_ml_probe_req(dev, apdev): "CTRL-EVENT-SCAN-FAILED"], timeout=10) if ev is None: raise Exception("ML_PROBE_REQ did not result in scan results") + +def test_eht_mld_connect_probes(dev, apdev, params): + """MLD client sends ML probe to connect to not discovered links""" + + with HWSimRadio(use_mlo=True) as (hapd_radio, hapd_iface), \ + HWSimRadio(use_mlo=True) as (wpas_radio, wpas_iface): + + wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5') + wpas.interface_add(wpas_iface) + + ssid = "mld_ap" + passphrase = 'qwertyuiop' + link_params = eht_mld_ap_wpa2_params(ssid, passphrase, mfp="2", key_mgmt="SAE", pwe='2') + link_params['channel'] = '1' + link_params['bssid'] = '00:11:22:33:44:01' + hapd0 = eht_mld_enable_ap(hapd_iface, link_params) + + link_params['channel'] = '6' + link_params['bssid'] = '00:11:22:33:44:02' + hapd1 = eht_mld_enable_ap(hapd_iface, link_params) + + wpas.set("sae_pwe", "1") + wpas.connect(ssid, sae_password= passphrase, ieee80211w="2", + key_mgmt="SAE", scan_freq="2412") + + out = run_tshark(os.path.join(params['logdir'], 'hwsim0.pcapng'), + 'wlan.fc.type_subtype == 0x0004 && wlan.ext_tag.number == 107 && wlan.ext_tag.data == 11:00:02:00:00:02:11:00', + display=['frame.number']) + if not out.splitlines(): + raise Exception('ML probe request not found') + + # probe response has the ML element, which will be fragmented + out = run_tshark(os.path.join(params['logdir'], "hwsim0.pcapng"), + "wlan.fc.type_subtype == 0x0005 && wlan.ext_tag.number == 107 && wlan.ext_tag.length == 254", + display=['frame.number']) + if not out.splitlines(): + raise Exception('ML probe response not found') + + eht_verify_status(wpas, hapd0, 2412, 20, is_ht=True, mld=True, valid_links=3, active_links=3) + traffic_test(wpas, hapd0) + traffic_test(wpas, hapd1) + + +def test_eht_tx_link_rejected_connect_other(dev, apdev, params): + """EHT MLD AP with MLD client being rejected on TX link, but then connecting on second link""" + + with HWSimRadio(use_mlo=True) as (hapd_radio, hapd_iface), \ + HWSimRadio(use_mlo=True) as (wpas_radio, wpas_iface): + + wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5') + wpas.interface_add(wpas_iface) + + ssid = "mld_ap" + passphrase = 'qwertyuiop' + link_params = eht_mld_ap_wpa2_params(ssid, passphrase, mfp="2", key_mgmt="SAE", pwe='2') + link_params['channel'] = '1' + link_params['bssid'] = '00:11:22:33:44:01' + hapd0 = eht_mld_enable_ap(hapd_iface, link_params) + + link_params['channel'] = '6' + link_params['bssid'] = '00:11:22:33:44:02' + hapd1 = eht_mld_enable_ap(hapd_iface, link_params) + + wpas.set("sae_pwe", "1") + with fail_test(hapd0, 1, "hostapd_get_aid"): + wpas.connect(ssid, sae_password=passphrase, ieee80211w="2", + key_mgmt="SAE", scan_freq="2412") + + eht_verify_status(wpas, hapd1, 2437, 20, is_ht=True, mld=True, valid_links=2, active_links=2) + traffic_test(wpas, hapd0) + traffic_test(wpas, hapd1) + + +def test_eht_all_links_rejected(dev, apdev, params): + """EHT MLD AP with MLD client ignores all rejected links""" + + with HWSimRadio(use_mlo=True) as (hapd_radio, hapd_iface), \ + HWSimRadio(use_mlo=True) as (wpas_radio, wpas_iface): + + wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5') + wpas.interface_add(wpas_iface) + + ssid = "mld_ap" + passphrase = 'qwertyuiop' + link_params = eht_mld_ap_wpa2_params(ssid, passphrase, mfp="2", key_mgmt="SAE", pwe='2') + link_params['channel'] = '1' + link_params['bssid'] = '00:11:22:33:44:01' + hapd0 = eht_mld_enable_ap(hapd_iface, link_params) + + link_params['channel'] = '6' + link_params['bssid'] = '00:11:22:33:44:02' + hapd1 = eht_mld_enable_ap(hapd_iface, link_params) + wpas.set("mld_connect_bssid_pref", "00:11:22:33:44:01") + wpas.set("sae_pwe", "1") + + with fail_test(hapd0, 1, "hostapd_get_aid", 1, "hostapd_process_assoc_ml_info"): + wpas.connect(ssid, sae_password=passphrase, ieee80211w="2", + key_mgmt="SAE", scan_freq="2412", wait_connect=False) + ev = wpas.wait_event(['CTRL-EVENT-ASSOC-REJECT']) + if not ev: + raise Exception('Rejection not found') + + ev1 = wpas.wait_event(['Added BSSID']) + ev2 = wpas.wait_event(['Added BSSID']) + if (not ev1 or not ev2) or \ + not ((hapd0.own_addr() in ev1 and hapd1.own_addr() in ev2) or + (hapd1.own_addr() in ev1 and hapd0.own_addr() in ev2)): + raise Exception('Not all BSSs were added to the ignore list') + + # After this message, a new scan clears the ignore and the STA connects + wpas.wait_connected(timeout=15) From patchwork Mon Nov 20 23:51:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866397 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=LUG8FoEQ; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=k4zrvrsA; 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 4SZ4BQ1Cqdz1yRV for ; Tue, 21 Nov 2023 10:55:10 +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=DTXDl0/4cTDNDEXsNXa8Eej8bi0H5d6FM34K80wutuI=; b=LUG8FoEQP9rl4P fOOjrT3FSYctiZqs9Vgn9wj+0ACBdHUMN4YEiDb0MdFc/MbkDg2WsEk+6Aa0YnfUhiLeUOCmjlMjl D2UfNSejxdnjgfpc5ZCbmSdm7enfFyhKZbdQeRL5YrEoD4zBouT/T+CBeTSRn98uXOdd5qSVy1AyH 2FM0fbASkoV/hfAWfxo4+r+6vqymppyRYqENYSwqyA0PjvA3AK8Dn7vxPUziuhhCanamnodubr3NG oem9IFUpoMeB9kxsQUhEoWPSWcwp8T4eh8aQZp3tJ44yPF+6kyW1o2PHhowACQc2T+V8sdmU+Rjke 43LT4pajkJeuXLJKWmfw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E5w-00F7Y8-0g; Mon, 20 Nov 2023 23:54:24 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4t-00F5iV-0K for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:53:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524399; x=1732060399; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KHysy9RpxwQpafnrVgIs1Kmc2mINT3pthTDTS54Ze5A=; b=k4zrvrsAByvn8hQXE1JxT563NXF5RFJr5Cw73AjPwqtUP0zpXv6cNASq Paq7VZgCSmG6LQLjpk5QSah/rLQUINT+3mOcZPfgEKXRxyC113S8Czhet Pj7aVUktr8+UmHJg3YwkhFoJWLmO0yACTF9X82xgrOeGzSQJtSdXVoTzO DzbIdNj6+KYjxh1Kopc4QIByr4Jufv94J2ANR7mJmGxAk9Av2FgN/7Mf5 9BcHWupWOEQ0hmBb6ezO1FmG4Wp7LhAdujFIwtBP/3XJiH//EyB0qJk0q cc4zQSRwIEGTrXziGD2oGknOYBbxj8arq6YHuMkrvHzrYVw1l4e+y3nOe A==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769854" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769854" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871518" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871518" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:16 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Benjamin Berg Subject: [PATCH 40/42] tests: test driver association ML link rejection flow Date: Tue, 21 Nov 2023 01:51:54 +0200 Message-Id: <20231120235156.363852-41-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155319_236681_54694CD4 X-CRM114-Status: GOOD ( 18.24 ) X-Spam-Score: -0.4 (/) 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: Benjamin Berg The underlying driver can reject only specific links in an association request. In that case we will only ignore the corresponding BSS. Add a test for this flow by simulating an association failure on [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Benjamin Berg The underlying driver can reject only specific links in an association request. In that case we will only ignore the corresponding BSS. Add a test for this flow by simulating an association failure on the second link specifically. Signed-off-by: Benjamin Berg --- src/drivers/driver_nl80211.c | 22 +++++++++++++++++--- tests/hwsim/test_eht.py | 39 ++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 3 deletions(-) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index ff40a80700..d939f48aa1 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -7316,9 +7316,25 @@ static int wpa_driver_nl80211_associate( goto fail; } - ret = send_and_recv_msgs_connect_handle(drv, msg, drv->first_bss, 1, - &err_info); - msg = NULL; + if (!TEST_FAIL_TAG("assoc")) { + ret = send_and_recv_msgs_connect_handle(drv, msg, + drv->first_bss, 1, + &err_info); + msg = NULL; + } else { + int i; + + /* Error and force TEST_FAIL checking for each link */ + ret = -EINVAL; + for (i = 0; i < MAX_NUM_MLD_LINKS; i++) { + if (!(params->mld_params.valid_links & BIT(i))) + continue; + + if (TEST_FAIL_TAG("link")) + err_info.link_id = i; + } + } + if (ret) { wpa_dbg(drv->ctx, MSG_DEBUG, "nl80211: MLME command failed (assoc): ret=%d (%s)", diff --git a/tests/hwsim/test_eht.py b/tests/hwsim/test_eht.py index 75935a42cd..44149543b3 100644 --- a/tests/hwsim/test_eht.py +++ b/tests/hwsim/test_eht.py @@ -784,3 +784,42 @@ def test_eht_all_links_rejected(dev, apdev, params): # After this message, a new scan clears the ignore and the STA connects wpas.wait_connected(timeout=15) + +def test_eht_connect_invalid_link(dev, apdev, params): + """EHT MLD AP where one link is incorrectly configured and rejected by mac80211""" + + with HWSimRadio(use_mlo=True) as (hapd_radio, hapd_iface), \ + HWSimRadio(use_mlo=True) as (wpas_radio, wpas_iface): + + wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5') + wpas.interface_add(wpas_iface) + + ssid = "mld_ap" + passphrase = 'qwertyuiop' + ssid = "mld_ap" + passphrase = 'qwertyuiop' + link_params = eht_mld_ap_wpa2_params(ssid, passphrase, mfp="2", key_mgmt="SAE", pwe='2') + link_params['channel'] = '1' + link_params['bssid'] = '00:11:22:33:44:01' + hapd0 = eht_mld_enable_ap(hapd_iface, link_params) + + link_params['channel'] = '6' + link_params['bssid'] = '00:11:22:33:44:02' + hapd1 = eht_mld_enable_ap(hapd_iface, link_params) + + # We scan for both APs, then try to connect to link 0 + # But only the second attempt will work if mac80211 rejects second link + wpas.set("mld_connect_bssid_pref", "00:11:22:33:44:01") + wpas.set("sae_pwe", "1") + with fail_test(wpas, 1, "assoc;wpa_driver_nl80211_associate", + 2, "link;wpa_driver_nl80211_associate"): + wpas.connect(ssid, sae_password=passphrase, ieee80211w="2", + key_mgmt="SAE", scan_freq="2412") + + eht_verify_status(wpas, hapd0, 2412, 20, is_ht=True, mld=True, valid_links=1, active_links=1) + + out = run_tshark(os.path.join(params['logdir'], 'hwsim0.pcapng'), + 'wlan.fc.type_subtype == 0x0000 && wlan.ext_tag.data == 00:01:09:%s:00:00' % wpas.own_addr(), + display=['frame.number']) + if not out.splitlines(): + raise Exception('Association request send by mac80211 had unexpected ML element content (probably it contained a second link)') From patchwork Mon Nov 20 23:51:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866398 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=O93e0REd; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=mujj8+WX; 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 4SZ4BW0szXz1yRV for ; Tue, 21 Nov 2023 10:55:15 +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=jd4nyi1x/0NApTco3KBPgtOpD8GIFPDV9CXAeNDcJh8=; b=O93e0REdQf43r2 TcyN0dkQk3u62AMfBm2zk53g2EVU3az1Ptp3U6TG1GHZfgbJ6i1i1ortjCvm9hRv+Tx3FbLyod90A 0IO77ZfHjss1+F2lhbId7rRzOdGITmgX8InRhYS1r33YK5CvrAjT3ZBAqGnU5sOKjQRYs1ofWE11p 9lwdlw93/7zrK06QgFHj3lavEOh7VI/VKXONOZkVWzVBL+TXaRqkwUn2MwAmvNiyp42DBIIxUk33h RB+ohvUhxe0VtNNMRKwlBuDyzJjlkwmBvSkmL2Y+xCwzWsaPJAwMIxxI3iALwqBnFYEKtX/B35wUu j3Wa4cDqULIXDZQspO6w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E65-00F7ih-2e; Mon, 20 Nov 2023 23:54:33 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4t-00F5uJ-2b for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:53:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524399; x=1732060399; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NRhD7iaUbf97DmGJZHXhZsxf2wf87tbLCXmY0Dj0Npw=; b=mujj8+WXlt+8E+jnsxFdoKwnZ5+BWZzkdh3BEOeEDnniPoBtp8XqWJYS dyJxmeCixh4C/F6ev+ZYR7tXaSIvIjB9XQD5HpAEMfA1aIY7P3ALctac8 WN1RhTnGw6KboXxht9qHq2ax6VSlyljGGqqrlwfHz5vdbMKv6h9JKDxxZ 3oLpgzKtysUt8+t2WtSnKDsuoHc4p1IkqsZjrTQ5wWi7LmJ6v2ByH0rkZ Mf3DbmbkyutjeQyYWF8zTqm5jGjT2DmMvFSX3GF8SF04kLq19en4zEOtD KsixARzBP7KL05ZgE32RtUBHXoXeIacxS5PtE6Kj9eCgG5/MsjVN0zA+D g==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769855" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769855" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871527" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871527" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:17 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Ilan Peer Subject: [PATCH 41/42] tests: Add test to verify link removal Date: Tue, 21 Nov 2023 01:51:55 +0200 Message-Id: <20231120235156.363852-42-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155321_101178_1AEEB881 X-CRM114-Status: GOOD ( 12.07 ) X-Spam-Score: -0.4 (/) 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: Ilan Peer Signed-off-by: Ilan Peer --- tests/hwsim/hostapd.py | 4 ++++ tests/hwsim/test_eht.py | 44 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 2 deletions [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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: Ilan Peer Signed-off-by: Ilan Peer --- tests/hwsim/hostapd.py | 4 ++++ tests/hwsim/test_eht.py | 44 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/tests/hwsim/hostapd.py b/tests/hwsim/hostapd.py index b93d5caed5..ed9378bdc5 100644 --- a/tests/hwsim/hostapd.py +++ b/tests/hwsim/hostapd.py @@ -266,6 +266,10 @@ class Hostapd: if "OK" not in self.request("DISABLE"): raise Exception("Failed to disable hostapd interface " + self.ifname) + def link_remove(self, count=10): + if "OK" not in self.request("LINK_REMOVE %u" % count): + raise Exception("Failed to remove hostapd link " + self.ifname) + def dump_monitor(self): while self.mon.pending(): ev = self.mon.recv() diff --git a/tests/hwsim/test_eht.py b/tests/hwsim/test_eht.py index 44149543b3..a92d9e5475 100644 --- a/tests/hwsim/test_eht.py +++ b/tests/hwsim/test_eht.py @@ -93,8 +93,8 @@ def eht_verify_status(wpas, hapd, freq, bw, is_ht=False, is_vht=False, time.sleep(0.1) _eht_verify_links(wpas, valid_links, active_links) -def traffic_test(wpas, hapd): - hwsim_utils.test_connectivity(wpas, hapd) +def traffic_test(wpas, hapd, success=True): + hwsim_utils.test_connectivity(wpas, hapd, success_expected=success) def test_eht_open(dev, apdev): """EHT AP with open mode configuration""" @@ -823,3 +823,43 @@ def test_eht_connect_invalid_link(dev, apdev, params): display=['frame.number']) if not out.splitlines(): raise Exception('Association request send by mac80211 had unexpected ML element content (probably it contained a second link)') + +def test_eht_mld_link_removal(dev, apdev): + """EHT MLD with two links. Links removed during association""" + + with HWSimRadio(use_mlo=True) as (hapd0_radio, hapd0_iface), \ + HWSimRadio(use_mlo=True) as (wpas_radio, wpas_iface): + + wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5') + wpas.interface_add(wpas_iface) + + ssid = "mld_ap_owe_two_link" + params = eht_mld_ap_wpa2_params(ssid, key_mgmt="OWE", mfp="2") + hapd0 = eht_mld_enable_ap(hapd0_iface, params) + + params['channel'] = '6' + hapd1 = eht_mld_enable_ap(hapd0_iface, params) + + wpas.connect(ssid, scan_freq="2412 2437", key_mgmt="OWE", ieee80211w="2") + eht_verify_status(wpas, hapd0, 2412, 20, is_ht=True, mld=True, valid_links=3, + active_links=3) + eht_verify_wifi_version(wpas) + traffic_test(wpas, hapd0) + + logger.info("Disable the 2nd link in 4 beacon intervals") + hapd1.link_remove(4) + time.sleep(0.6) + + logger.info("Test traffic after 2nd link disabled") + traffic_test(wpas, hapd0) + + logger.info("Disable the 1st link in 20 beacon intervals") + hapd0.link_remove(20) + time.sleep(1) + + logger.info("Verify that traffic is valid before the link is removed") + traffic_test(wpas, hapd0) + time.sleep(2) + + logger.info("Test traffic after 1st link disabled") + traffic_test(wpas, hapd0, success=False) From patchwork Mon Nov 20 23:51:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1866399 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=3hlZg6Gj; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=dFPu1FcU; 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 4SZ4Bf47Mgz1yRV for ; Tue, 21 Nov 2023 10:55:22 +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=nPlQl1uskzcMfRxkPQJZc2ZfDojYE5AaRxw1vH9qvuo=; b=3hlZg6Gjh6Ysx2 ops3ftPIYuY7lrV9AS1M3kGA5Z3N78DRfXGdW61YB/WzjOBKKEiySo6dcdrcLMOsh0vzGpZRvsxLy kZkso9jSf1mQ9mZPw+P1h6TsRzOf0K5Cylur+hBrUGIYmpRv9Lmbrt+CMSa0LMm1AUWBd24alAOJ2 jC78ze1QeSQqyTahTfFl0OKfsKXiPwL7hJdrfDZ0aGwrKDK/lak1xf8XzD2ocnLf2qE/xT9YHHsQ6 G3xOK26lTbqyVqyd59Qiec5JcV6ChGj1xwwSl1WhtfDjhdQPNxjoJwOiAjK3yQyirVTuKj6N0dwGh jwcrsInWpMkrSlSQI9vQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5E6C-00F7sv-0s; Mon, 20 Nov 2023 23:54:40 +0000 Received: from mgamail.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5E4v-00F5iV-26 for hostap@lists.infradead.org; Mon, 20 Nov 2023 23:53:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700524401; x=1732060401; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dLOPtJOceiKl7wgnEjMhxQutD6qnrwvQ0Ecrix4GY3k=; b=dFPu1FcUAVyHk1svC7v75Wn8iNgZLDeRJrfckmbi5R//oddKgW03pRR+ Psb8ao7vmGjeQn442tWNIox/cDz1ec+zzHA7SmOALr7/FN3QTBkT6uJLP YXH0bZkjb82MdZqNWZxJR0zhIHzJ9kNpAb8nlrKHX3/J/F/2QSmuHpHax xOnmhw+rLhDUvgdspQsKI28Ma5sd8xYnkxipsTpkUiozirkOHM5BsTFIx fxL/b+TmJyP+Ob/BxE9AxPW3MtS2sQWSTXPbobPwB0rOaVtEauedmUyue GwrTHeMLMRJ69mE2Y/8jboQEtiB9w6Bj1VSXQlVMFrFLTvd+d0/WnVYSV A==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="376769856" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="376769856" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="1097871537" X-IronPort-AV: E=Sophos;i="6.04,214,1695711600"; d="scan'208";a="1097871537" Received: from saarm-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.254.156.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2023 15:53:18 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Andrei Otcheretianski , Benjamin Berg Subject: [PATCH 42/42] tests: Add a unit test for RNR/basic ML element parsing Date: Tue, 21 Nov 2023 01:51:56 +0200 Message-Id: <20231120235156.363852-43-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231120235156.363852-1-andrei.otcheretianski@intel.com> References: <20231120235156.363852-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_155321_760345_6D9E1450 X-CRM114-Status: GOOD ( 17.11 ) X-Spam-Score: -0.4 (/) 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: Going through everything to test parsing of the basic ML element and the RNR element is not really feasible for MBSSID mode. As such, add a unit test to excercise parsing the available links from the [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 Going through everything to test parsing of the basic ML element and the RNR element is not really feasible for MBSSID mode. As such, add a unit test to excercise parsing the available links from the RNR, basic ML element and MBSSID-Index element if present. Signed-off-by: Benjamin Berg Signed-off-by: Andrei Otcheretianski --- tests/Makefile | 61 ++++++++++++++++++++++++++++++++- tests/test-bss.c | 88 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 tests/test-bss.c diff --git a/tests/Makefile b/tests/Makefile index 2d2343b640..8ec154bb3e 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -2,7 +2,8 @@ ALL=test-base64 test-md4 test-milenage \ test-rsa-sig-ver \ test-sha1 \ test-https test-https_server \ - test-sha256 test-aes test-x509v3 test-list test-rc4 + test-sha256 test-aes test-x509v3 test-list test-rc4 \ + test-bss include ../src/build.rules @@ -82,6 +83,63 @@ test-x509v3: $(call BUILDOBJ,test-x509v3.o) $(LIBS) $(LDO) $(LDFLAGS) -o $@ $< $(LLIBS) +# We could cut this down more by enabling fewer options (above) +ELIBS += $(SRC)/crypto/libcrypto.a +ELIBS += $(SRC)/tls/libtls.a + +WPAS_SRC=../wpa_supplicant +SRC=../src +WPA_LIBS = $(SRC)/common/libcommon.a + +CFLAGS += -I$(SRC) -I$(SRC)/utils -I$(WPAS_SRC) + +CFLAGS += -DCONFIG_DRIVER_NONE +CFLAGS += -DIEEE8021X_EAPOL + +WPA_OBJS = $(WPAS_SRC)/bssid_ignore.o +WPA_OBJS += $(WPAS_SRC)/bss.o +WPA_OBJS += $(WPAS_SRC)/config.o +WPA_OBJS += $(WPAS_SRC)/config_file.o +WPA_OBJS += $(WPAS_SRC)/eap_register.o +WPA_OBJS += $(WPAS_SRC)/events.o +WPA_OBJS += $(WPAS_SRC)/notify.o +WPA_OBJS += $(WPAS_SRC)/offchannel.o +WPA_OBJS += $(WPAS_SRC)/op_classes.o +WPA_OBJS += $(WPAS_SRC)/robust_av.o +WPA_OBJS += $(WPAS_SRC)/rrm.o +WPA_OBJS += $(WPAS_SRC)/scan.o +WPA_OBJS += $(WPAS_SRC)/wmm_ac.o +WPA_OBJS += $(WPAS_SRC)/wpa_supplicant.o +WPA_OBJS += $(WPAS_SRC)/wpas_glue.o +WPA_OBJS += $(SRC)/rsn_supp/wpa.o +WPA_OBJS += $(SRC)/rsn_supp/wpa_ft.o +WPA_OBJS += $(SRC)/rsn_supp/wpa_ie.o +WPA_OBJS += $(SRC)/rsn_supp/tdls.o +WPA_OBJS += $(SRC)/rsn_supp/preauth.o +WPA_OBJS += $(SRC)/rsn_supp/pmksa_cache.o +WPA_OBJS += $(SRC)/eapol_supp/eapol_supp_sm.o +WPA_OBJS += $(SRC)/eap_common/eap_common.o +WPA_OBJS += $(SRC)/eap_peer/eap.o +WPA_OBJS += $(SRC)/eap_peer/eap_methods.o +WPA_OBJS += $(SRC)/drivers/driver_common.o +WPA_OBJS += $(SRC)/drivers/driver_none.o +WPA_OBJS += $(SRC)/drivers/drivers.o +WPA_OBJS += $(SRC)/l2_packet/l2_packet_none.o + +_OBJS_VAR := WPA_OBJS +include ../src/objs.mk + +_OBJS_VAR := WPA_LIBS +include ../src/objs.mk + +_OBJS_VAR := ELIBS +include ../src/objs.mk + +LIBS=$(SLIBS) $(DLIBS) $(WPA_LIBS) $(ELIBS) + +test-bss: $(call BUILDOBJ,test-bss.o) $(WPA_OBJS) $(LIBS) + $(LDO) $(LDFLAGS) -o $@ $< $(LLIBS) $(WPA_CFLAGS) $(WPA_OBJS) $(LIBS) + run-tests: $(ALL) ./test-aes ./test-list @@ -90,6 +148,7 @@ run-tests: $(ALL) ./test-rsa-sig-ver ./test-sha1 ./test-sha256 + ./test-bss @echo @echo All tests completed successfully. diff --git a/tests/test-bss.c b/tests/test-bss.c new file mode 100644 index 0000000000..3afce8b5a3 --- /dev/null +++ b/tests/test-bss.c @@ -0,0 +1,88 @@ +#include + +#include "utils/includes.h" + +#include "utils/common.h" +#include "wpa_supplicant_i.h" +#include "bss.h" + +#define ASSERT_CMP_INT(a, cmp, b) { \ + ssize_t __a = (a); ssize_t __b = (b); \ + if (!(__a cmp __b)) { \ + wpa_printf(MSG_ERROR, "Assertion failed: %ld %s %ld", \ + __a, #cmp, __b); \ + abort(); \ + } \ + } + +void test_parse_basic_ml(struct wpa_supplicant *wpa_s, u8 mld_id) +{ + const u8 mld_ie[] = { + /* RNR */ + WLAN_EID_REDUCED_NEIGHBOR_REPORT, 40, + 0x00, 0x10, 0x51, 0x01, 0xff, 0x00, 0x11, 0x22, + 0x33, 0x44, 0x01, 0x68, 0x05, 0x2d, 0xa6, 0x42, + 0xfe, mld_id, 0x10, 0x00, 0x00, 0x10, 0x51, 0x06, + 0xff, 0x00, 0x11, 0x22, 0x33, 0x44, 0x02, 0x68, + 0x05, 0x2d, 0xa6, 0x42, 0xfe, mld_id, 0x11, 0x00, + /* basic ML */ + WLAN_EID_EXTENSION, 1 + 15, WLAN_EID_EXT_MULTI_LINK, + 0xb0, 0x01, 0x0d, 0x02, 0x00, 0x00, 0x00, 0x07, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + }; + const u8 mbssid_idx_ie[] = { + WLAN_EID_MULTIPLE_BSSID_INDEX, 1, mld_id, + }; + struct { + struct wpa_bss bss; + u8 ies[sizeof(mld_ie) + sizeof(mbssid_idx_ie)]; + } bss; + u8 ap_mld_addr[ETH_ALEN]; + u16 missing_links; + u8 ret; + u8 ap_mld_id; + + memcpy(bss.bss.ies, mld_ie, sizeof(mld_ie)); + bss.bss.ie_len = sizeof(mld_ie); + + if (mld_id > 0) { + memcpy(bss.bss.ies + sizeof(mld_ie), mbssid_idx_ie, + sizeof(mbssid_idx_ie)); + bss.bss.ie_len += sizeof(mbssid_idx_ie); + } + + ret = wpa_bss_parse_basic_ml_element(wpa_s, &bss.bss, ap_mld_addr, + &missing_links, NULL, &ap_mld_id); + + ASSERT_CMP_INT(ret, ==, 0); + ASSERT_CMP_INT(bss.bss.n_mld_links, ==, 1); + ASSERT_CMP_INT(missing_links, ==, 0x0002); + ASSERT_CMP_INT(ap_mld_id, ==, mld_id); +} + +#define RUN_TEST(func, ...) do { \ + func(wpa_s, __VA_ARGS__); \ + printf("\nok " #func " " #__VA_ARGS__ "\n\n"); \ + } while (false) + +int main(void) +{ + struct wpa_interface iface = { + .ifname = "dummy", + }; + struct wpa_global *global; + struct wpa_params params = { + .wpa_debug_level = MSG_DEBUG, + }; + struct wpa_supplicant *wpa_s; + + global = wpa_supplicant_init(¶ms); + + wpa_s = wpa_supplicant_add_iface(global, &iface, NULL); + assert(wpa_s); + + RUN_TEST(test_parse_basic_ml, 0); + RUN_TEST(test_parse_basic_ml, 1); + + return 0; +}