From patchwork Wed Dec 11 20:37:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baligh Gasmi X-Patchwork-Id: 2021661 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=LNHOPmkP; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=HpiDET2m; 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 4Y7nWB2bPcz1yRH for ; Thu, 12 Dec 2024 07:38:44 +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:Reply-To:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date: Subject:Cc:To:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=C42uM7ZOiATEhESBg3o0MfnlsEj11dHyZwN62AA6kEw=; b=LNHOPmkP8rPywV R5Y1tHPvbO8Rec2RyCXjRQrOFdmRI5J30sO0C7rcD92aYMRAnyX0TZqA208O2e/fiWTtMwwmvS3mq d2dDAwn0p2ajEnzJKLnUQC9/jB+7yqqjpi9nrWJLTTbxvoHe2XMbcrh6uZW20r1bfVm+z4AgMjJNk GbKNrtyaKFNuWDamgbHFPs6sQc3erKKCJmSKBuCb4wt6uAovgpxhfLh3PlO6te3TOC1hmFEAFTAce d6afCOjKaBEe7k/AIhYJRGkrX6KZcUJhdFBgqJZIh/osSOqBtEXr8Xw4ZEgFuboN7jHRjBHvoNpI4 5ig63P4qWXxXy9Dm8O8w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tLTSy-0000000G2UC-3fkT; Wed, 11 Dec 2024 20:37:52 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tLTSu-0000000G2TL-43YP for hostap@lists.infradead.org; Wed, 11 Dec 2024 20:37:50 +0000 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-385e87b25f0so698455f8f.0 for ; Wed, 11 Dec 2024 12:37:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733949466; x=1734554266; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:reply-to:message-id:date :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=H13uSZlqCLR0Havu6C31sSE+Cl8uOwctPHj4jcFJwQc=; b=HpiDET2mX6uSjH0melEhGCDCyF0pIwPWganyM9zeEruk2LF2XVbTf3+o8v1zbuhQmh FesAxCVskvroF3AZ8nhs3fosrdepS2TpqMBLC82BdQmVp5NRa3zjc4wMEdpZIiwgrnu0 QAEo7ePsZ8k+U/KgYvdDnCmDs8xxVBL0dxsn5vaPg4HQ+mV314t1nHAA+66LGYGPIfTX +NzKuLtgY0RlhD3XY1QhDGWZCvu0yvegJR0raJRfiOGXmmIS6GmddJ/NQRlQCD6nMHin mlFCHv2YvCtwXGjrzrNGOvyCxN7RwVYGoLsrKwDoXhxI5Cu+qNlJ3gXCnnkp7lE6QXuF MOhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733949466; x=1734554266; h=content-transfer-encoding:mime-version:reply-to:message-id:date :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=H13uSZlqCLR0Havu6C31sSE+Cl8uOwctPHj4jcFJwQc=; b=X9bMWoPApnc4D4UT7ueHXQBnkBmdsC513FhjKfGylq089ZASSe73kfCgXpUgohxydU YvxjiPMJyrQ9VoKmPbM78BwFKhIeiDH6BQmzjS/KHzN+VpCZS29a7+LrHJfR5ZWxHEf5 YY0u51BJQLybjqXiVROom/NWNlbPYZ2gKCNEmXeiM2TxVZssPPTUKWQNhX2Q9vKfcsRN 33w895t01fpCoBLNBXV1+g+gzQagC+MHAACBExJHG0n4WD1F+HQrss3JN0P/m4glsSDi ryOwU8MxDJhpjOEAENVCv+cfwd51OMMyBKh/rhFjYnnHQdxhhyA0AdUICn4hBJ0SbO3r 7BsQ== X-Gm-Message-State: AOJu0Yzxfs/6yBdA+3DKfIvadFWNbAe7s68/KzMFuArdB8w9EXZUPYni R6kc564oiFl00Kyo1EEzogqpXEGf3w527/ba3QfCXobLVGs/h0nY/4HpIg== X-Gm-Gg: ASbGncskhSJkt7N6ExzO6aOQLroJtGjJ2XYH1CxyDvGnBh63XgKiCSDYnjyIkhOGZyF sHXEeO6HQjqOnaPhP1f/k3NisPAz8mdtCLgxP9ApNjle76RzyqLHvlsnAAvJBvvEnUei9KMuqja eefZinklk5O5Qr0d5bkP5u2ItZzAyPopC7/FchZZyXQqjyWKHhC2CYm1ZCKhNLwZGsxXoaF5TrC vWdtMmoVmHO5L0XWbmJEfQE0cGHWInxkInWGymYAs0Kj1j+oavS8rzKil/WnVzUYZY4qforWzJz fE7h21iyrME+3MHTJq0p+6QSjjjsfJffmFG/z/gu/HzFQA== X-Google-Smtp-Source: AGHT+IGWytgo6pDpt4NBYfiZkjXcRmwePkP1c1WM+K+H/QrUFaiUEOWbtSZaWd/AcmmViAyhV+QNbQ== X-Received: by 2002:a05:6000:1a8a:b0:385:f349:ffe5 with SMTP id ffacd0b85a97d-3878886cc68mr388107f8f.29.1733949465923; Wed, 11 Dec 2024 12:37:45 -0800 (PST) Received: from sah1lpt685.home (2a01cb0001106400d8545539af239a64.ipv6.abo.wanadoo.fr. [2a01:cb00:110:6400:d854:5539:af23:9a64]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-387824a4e98sm2050540f8f.34.2024.12.11.12.37.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 12:37:45 -0800 (PST) From: Baligh Gasmi To: hostap@lists.infradead.org Cc: Baligh Gasmi Subject: [PATCH v1] mbssid: add bss index and max bss Date: Wed, 11 Dec 2024 21:37:38 +0100 Message-ID: <20241211203738.336006-1-gasmibal@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241211_123749_005061_D6AECD3B X-CRM114-Status: GOOD ( 16.01 ) X-Spam-Score: -1.1 (-) 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: Configuring hostapd's BSSes with a custom BSSID via the `bssid` parameter in the config file, can lead to a miss-configured Multiple BSSID Element consequently leading to that stations fail to calcula [...] Content analysis details: (-1.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:42f listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -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_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [gasmibal(at)gmail.com] 1.0 FREEMAIL_REPLYTO Reply-To/From or Reply-To/body contain different freemails 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: , Reply-To: 20241210201447.34474-1-gasmibal@gmail.com Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Configuring hostapd's BSSes with a custom BSSID via the `bssid` parameter in the config file, can lead to a miss-configured Multiple BSSID Element consequently leading to that stations fail to calculate the correct BSSID for non-transmitting BSSs, as specified in IEEE Std 802.11-2020 section 9.4.2.45. To ensure consistency, the configuration need to include criticals parameters: `MaxBSSID Indicator` and `Multiple BSSID Index`. To customise the MBSSID IE following the custom bssids as well. This commit introduces: - A new global parameter, `mbssid_max`, to set the `MaxBSSID Indicator`. - A per-BSS parameter, `mbssid_index`, to explicitly set the `Multiple BSSID Index`. Signed-off-by: Baligh Gasmi --- hostapd/config_file.c | 4 ++++ src/ap/ap_config.h | 2 ++ src/ap/ieee802_11.c | 14 +++++++++++--- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/hostapd/config_file.c b/hostapd/config_file.c index e59e98d7c..0139d5bde 100644 --- a/hostapd/config_file.c +++ b/hostapd/config_file.c @@ -3964,6 +3964,10 @@ static int hostapd_config_fill(struct hostapd_config *conf, return 1; } conf->mbssid = mbssid; + } else if (os_strcmp(buf, "mbssid_index") == 0) { + bss->mbssid_index = atoi(pos); + } else if (os_strcmp(buf, "mbssid_max") == 0) { + conf->mbssid_max = atoi(pos); #endif /* CONFIG_IEEE80211AX */ } else if (os_strcmp(buf, "max_listen_interval") == 0) { bss->max_listen_interval = atoi(pos); diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h index b0ae71e1e..deb195162 100644 --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h @@ -995,6 +995,7 @@ struct hostapd_bss_config { bool mld_indicate_disabled; #endif /* CONFIG_TESTING_OPTIONS */ #endif /* CONFIG_IEEE80211BE */ + int mbssid_index; }; /** @@ -1252,6 +1253,7 @@ struct hostapd_config { bool channel_usage; bool peer_to_peer_twt; + int mbssid_max; }; diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index c0da03f4c..3a908b082 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -3414,7 +3414,9 @@ static u8 hostapd_max_bssid_indicator(struct hostapd_data *hapd) if (!hapd->iconf->mbssid || hapd->iface->num_bss <= 1) return 0; - num_bss_nontx = hapd->iface->num_bss - 1; + num_bss_nontx = (hapd->iface->conf->mbssid_max > 0) ? + hapd->iface->conf->mbssid_max - 1 : + hapd->iface->conf->num_bss - 1; while (num_bss_nontx > 0) { max_bssid_ind++; num_bss_nontx >>= 1; @@ -8322,6 +8324,7 @@ static u8 * hostapd_eid_mbssid_elem(struct hostapd_data *hapd, u8 *eid, u8 *end, const u8 *known_bss, size_t known_bss_len) { struct hostapd_data *tx_bss = hostapd_mbssid_get_tx_bss(hapd); + struct hostapd_bss_config *tx_conf = tx_bss->conf; size_t i; u8 *eid_len_offset, *max_bssid_indicator_offset; @@ -8337,6 +8340,7 @@ static u8 * hostapd_eid_mbssid_elem(struct hostapd_data *hapd, u8 *eid, u8 *end, u8 ie_count = 0, non_inherit_ie[3]; size_t auth_len = 0; u16 capab_info; + u8 mbssindex = i; if (!bss || !bss->conf || !bss->started || mbssid_known_bss(i, known_bss, known_bss_len)) @@ -8356,11 +8360,15 @@ static u8 * hostapd_eid_mbssid_elem(struct hostapd_data *hapd, u8 *eid, u8 *end, *eid++ = conf->ssid.ssid_len; os_memcpy(eid, conf->ssid.ssid, conf->ssid.ssid_len); eid += conf->ssid.ssid_len; + + if(conf->mbssid_index && + ((conf->mbssid_index - tx_conf->mbssid_index) > 0)) + mbssindex = (conf->mbssid_index - tx_conf->mbssid_index); *eid++ = WLAN_EID_MULTIPLE_BSSID_INDEX; if (frame_type == WLAN_FC_STYPE_BEACON) { *eid++ = 3; - *eid++ = i; /* BSSID Index */ + *eid++ = mbssindex; /* BSSID Index */ if (hapd->iconf->mbssid == ENHANCED_MBSSID_ENABLED && (conf->dtim_period % elem_count)) conf->dtim_period = elem_count; @@ -8376,7 +8384,7 @@ static u8 * hostapd_eid_mbssid_elem(struct hostapd_data *hapd, u8 *eid, u8 *end, /* Probe Request frame does not include DTIM Period and * DTIM Count fields. */ *eid++ = 1; - *eid++ = i; /* BSSID Index */ + *eid++ = mbssindex; /* BSSID Index */ } auth = wpa_auth_get_wpa_ie(bss->wpa_auth, &auth_len);