From patchwork Tue Dec 10 20:14:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baligh Gasmi X-Patchwork-Id: 2020856 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=0NYpQbyd; 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=lP26gB1b; 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 4Y794G1Lcmz1yRC for ; Wed, 11 Dec 2024 07:16: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: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:In-Reply-To:References: List-Owner; bh=+r6z7ptgfn8B8pRdi9tMAtclLuqZLWy/mrH8xpvNpGs=; b=0NYpQbydKdTHM1 n39Ya32QVyBMmSzK5w8wpQQqVZpsjA0khYfoQaQC8ejeXUmHX4Nxx9gHVxhGGsRECGExkFfXx6pKZ y6IpQxGUoIlWuPa06td32Iw0x3m7Hm//su0fQpZuS77WjBQFEJ8N5Kfp7Q1FsPFImvUNCKIWs5viP 0RibpC2RWIWTxG4+z9rPqZEIhHP2Ia+CRo7aHbffHKaxQux/NKITiFhkr45xLb8RQLf+PXz5Icczp NHxE5W9u0RwqbUZj8dm3zVLCq3Awlkfgi4vTd/0cJ+Kp/dDjbRKws+wVN4/RQvmC8p5It54dWtcHW MGRn9iq5JepQxR4u9dpA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tL6eL-0000000CeB5-25DQ; Tue, 10 Dec 2024 20:16:05 +0000 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tL6df-0000000Cdtu-3JIg for hostap@lists.infradead.org; Tue, 10 Dec 2024 20:15:24 +0000 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-38637614567so1695682f8f.3 for ; Tue, 10 Dec 2024 12:15:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733861721; x=1734466521; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=3OLNbn0MRlBoqlXudWu48Xue9dBvzMDqJy7vvxGhXMQ=; b=lP26gB1bbX5u1qb5cOLDWDUUm0ybev5GMLS2YJDsAkXdcZvhyS8qfH24h/jy7azt7W h5wqT0hi/43Yb9EK+O0eMhT/01qIY0V5JbAP463rEdwD5tlTUgSDJTWDO8lnOEDdpiSt s2M1MROoko6esKjlVXL2tYgp1/88Q5Wsh/Ro1hlBV/NOLHpbPcoOmxQoQLwcs5Iot47A +FgvoiMqW7vQGOPhzkiyrV1Jjm6HWTvDh5oUV5gACGlEY2q8LfYgYfhFAMO3wGGunx3q h60iSWm4vwm8ZkxpOdqnm3Gil3jCGR+BQ4EL0xKtvo61ysxEs+c2a9F7+vrKhuQzGe52 zWKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733861721; x=1734466521; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3OLNbn0MRlBoqlXudWu48Xue9dBvzMDqJy7vvxGhXMQ=; b=hBfeyc23vPYoicsdQ+5Qkj72GbaV9cclJ43vnvbKJQotbYZhZlwrhywSMLFTlwgux5 feSSfVzxt1kvgVQxn/UKMokz++9XsOdBw20Y5Mj16c+lKFxldznlI77NehtwYQ1Y688I uKQhKUz0hKUSoQDC/TIbptbHeLzz2+a8y6vZXITXS2C088zEUB0X+LGF/cMlTFvNZ9f+ y5mB40pT7EwI00uuC5VrVG5IvgGWbMZtNgrznHuEwc+MMyd7S1M8JwjyE/oIiO+pNkw+ XO7wywrukulTlgE84cznRKo9jTdLYxGzd1xiX0O7RZk9s2TS/+JbrdpfGTk+2SlTF3rg eSyw== X-Gm-Message-State: AOJu0YyDbbiJY2/WI5LCBPWHtjysCvEEH0xg86fxwUOMzGMSYnvMey48 1RLRLl0e4SkyNmPoiBcA9WIslSAqCSkbC0xGvNbT4y1fXABvJ/xE5f6vQ+EL X-Gm-Gg: ASbGncsqWavh/iUAKFpo9Hj2ieL+CSVSvSDTcFI6L8bOZp04CU2friGOWMj2OYX/pwl wzxyjCqGvlcdK6Z99GQgipaGeDw4+mK62jw4i0zohE/b9DjzpYqCHrZ3FMgvn+42L9fp/fWWSQO v85ff8Wkv9QEfyRa8r1cM3ae0OnNI14o1nostah2Z07ZWB0O++TdFXhVOgmYe2E0zChMVshmDIx gBhKgAKL3QlZBfOWIxTAqHDZPhpFpg2Kp2JXaGmqYhFtosFewNHMLIXusNcaFLqRW4fr9qnmEaS rr0otTCug5xO49itBu0MMEzIaWc1mmQqOA2gnK3navR9Xg== X-Google-Smtp-Source: AGHT+IFaMSMT4cvE9fbBM2rzVSNoyI4E3PRwZCV4UQnrARC+ort9A8tb3TcNnKfJjfGzAon09/BPDA== X-Received: by 2002:a05:6000:2807:b0:385:e879:45cc with SMTP id ffacd0b85a97d-3864ce9858cmr229512f8f.19.1733861720904; Tue, 10 Dec 2024 12:15:20 -0800 (PST) Received: from sah1lpt685.home (2a01cb00011064006d3921a6aaf2e0fb.ipv6.abo.wanadoo.fr. [2a01:cb00:110:6400:6d39:21a6:aaf2:e0fb]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434e8ec8072sm130681725e9.18.2024.12.10.12.15.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 12:15:20 -0800 (PST) From: "Baligh Gasmi gasmibal@gmail.com" To: hostap@lists.infradead.org Cc: Baligh Gasmi Subject: [PATCH v0] mbssid: add bss index and max bss Date: Tue, 10 Dec 2024 21:14:47 +0100 Message-ID: <20241210201447.34474-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-20241210_121523_832624_5C46DC30 X-CRM114-Status: GOOD ( 15.02 ) X-Spam-Score: -2.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: From: Baligh Gasmi 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: (-2.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:42a 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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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] 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: Baligh Gasmi 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 --- src/ap/ap_config.h | 2 ++ src/ap/ieee802_11.c | 14 +++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) 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);