From patchwork Wed Mar 2 22:26:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aloka Dixit X-Patchwork-Id: 1600124 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=YsXOQs68; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=quicinc.com header.i=@quicinc.com header.a=rsa-sha256 header.s=qcdkim header.b=SWLSG02H; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4K89Yx5j3kz9s1l for ; Thu, 3 Mar 2022 10:39:17 +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:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QjJAtyk+NDgWNCP04NBrW0P0rQdE/EXpNMsvXF52YHk=; b=YsXOQs68p+PCai EIppi8/isIsp/RrfRUesMp9ODxNhgxlostutczZ17h5NnywPVxVVTwKnAipGzJaqoWRXwcnDXbiE2 4G6z+Iv5uOp1+vYuUatJcNgjPgxiONemXaKxQFZTLpQfViRcVXAFM9O12tY3xd5IkbXyN01/uNiPZ metl5j7csxHnWclbLxmPhczLtqUvLWKdeckoj+Q0Dy2cTGiH29hEOdCs94azasrGmRwGwY1L6IpxP T57cL4IcfeKtmk5sDqzcCa6ZgTLRZbeJm7fwdmWkcFNqWbV7Vj0tqNkhpwUZWxF9v2OLPYjseK8qY 8Q5hoWEMLig61Qy2XNNQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nPYXy-004j9U-T3; Wed, 02 Mar 2022 23:38:19 +0000 Received: from alexa-out.qualcomm.com ([129.46.98.28]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nPXRD-004Yl7-Df for hostap@lists.infradead.org; Wed, 02 Mar 2022 22:27:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1646260035; x=1677796035; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=TXWk8eGUza/0Gp/lk4tiQNKPb2yBPVhTwBsJ8qAcCAU=; b=SWLSG02HgrG0QWysGR6JHg61pgZBR7a96/wNdfFleK+LP3yTbniR/rBR RaK4j7lNaDwlVRQTb4BYVZBxm2l4gN74WSwQnMsFqcTZutcSPr4SHM6jM HjDKNDM9IeFE86iEas+BOo912yX+IAGr2RW4/0fNSzCPdv65kvtFhi4/h 0=; Received: from ironmsg08-lv.qualcomm.com ([10.47.202.152]) by alexa-out.qualcomm.com with ESMTP; 02 Mar 2022 14:27:06 -0800 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg08-lv.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Mar 2022 14:27:06 -0800 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.15; Wed, 2 Mar 2022 14:26:49 -0800 Received: from alokad-linux.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.15; Wed, 2 Mar 2022 14:26:48 -0800 From: Aloka Dixit To: , Subject: [PATCH 12/13] mbssid: process known BSSID element Date: Wed, 2 Mar 2022 14:26:33 -0800 Message-ID: <20220302222634.22185-13-quic_alokad@quicinc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220302222634.22185-1-quic_alokad@quicinc.com> References: <20220302222634.22185-1-quic_alokad@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220302_142715_581932_0AFBBB31 X-CRM114-Status: GOOD ( 15.78 ) X-Spam-Score: -2.5 (--) 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: Process the known BSSID elements if included by non-AP stations. The format is described in IEEE Std 802.11ax-2021 9.4.2.261. Non-AP stations may include this element in directed probe requests to indicate which of the multiple BSSIDs they have already discovered. AP should exclude these profiles from the probe response. Content analysis details: (-2.5 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [129.46.98.28 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_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 X-Mailman-Approved-At: Wed, 02 Mar 2022 15:34:45 -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 Process the known BSSID elements if included by non-AP stations. The format is described in IEEE Std 802.11ax-2021 9.4.2.261. Non-AP stations may include this element in directed probe requests to indicate which of the multiple BSSIDs they have already discovered. AP should exclude these profiles from the probe response. Signed-off-by: Aloka Dixit --- src/ap/beacon.c | 21 +++++++++++++-------- src/ap/ieee802_11.c | 31 +++++++++++++++++++++++++------ src/ap/ieee802_11.h | 6 ++++-- src/common/ieee802_11_common.c | 4 ++++ src/common/ieee802_11_common.h | 2 ++ src/common/ieee802_11_defs.h | 1 + 6 files changed, 49 insertions(+), 16 deletions(-) diff --git a/src/ap/beacon.c b/src/ap/beacon.c index 5f22dfc8cde2..76b93f5ef6ce 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -456,7 +456,8 @@ static u8 * hostapd_set_mbssid_beacon(struct hostapd_data *hapd, params->mbssid_index = hostapd_mbssid_get_bss_index(hapd); params->mbssid_count = iface->num_bss; - len = hostapd_eid_mbssid_len(tx_bss, WLAN_FC_STYPE_BEACON, &num_mbssid); + len = hostapd_eid_mbssid_len(tx_bss, WLAN_FC_STYPE_BEACON, &num_mbssid, + NULL, 0); if (hapd->iconf->ema) { if (!iface->ema_max_periodicity) { wpa_printf(MSG_DEBUG, @@ -497,7 +498,7 @@ static u8 * hostapd_set_mbssid_beacon(struct hostapd_data *hapd, params->mbssid_elem + len, WLAN_FC_STYPE_BEACON, params->mbssid_elem_count, - params->mbssid_elem_offset); + params->mbssid_elem_offset, NULL, 0); params->mbssid_elem_len = end - params->mbssid_elem; if (hapd->iconf->ema) { @@ -542,7 +543,8 @@ static u8 * hostapd_ext_capab_mbssid(struct hostapd_data *hapd, u8 *eid, static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd, const struct ieee80211_mgmt *req, - int is_p2p, size_t *resp_len) + int is_p2p, size_t *resp_len, + const u8 *known_bss, u8 known_bss_len) { struct ieee80211_mgmt *resp; u8 *pos, *epos, *csa_pos, *ext_cap_pos; @@ -586,7 +588,7 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd, #endif /* CONFIG_IEEE80211AX */ buflen += hostapd_eid_mbssid_len(hapd_probed, WLAN_FC_STYPE_PROBE_RESP, - NULL); + NULL, known_bss, known_bss_len); buflen += hostapd_eid_rnr_len(hapd, WLAN_FC_STYPE_PROBE_RESP); buflen += hostapd_mbo_ie_len(hapd); buflen += hostapd_eid_owe_trans_len(hapd); @@ -667,7 +669,8 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd, pos = hostapd_eid_ht_capabilities(hapd, pos); pos = hostapd_eid_ht_operation(hapd, pos); pos = hostapd_eid_mbssid(hapd_probed, pos, epos, - WLAN_FC_STYPE_PROBE_RESP, 0, NULL); + WLAN_FC_STYPE_PROBE_RESP, 0, NULL, + known_bss, known_bss_len); ext_cap_pos = pos; pos = hostapd_eid_ext_capab(hapd, pos); @@ -1214,7 +1217,8 @@ void handle_probe_req(struct hostapd_data *hapd, " signal=%d", MAC2STR(mgmt->sa), ssi_signal); resp = hostapd_gen_probe_resp(hapd, mgmt, elems.p2p != NULL, - &resp_len); + &resp_len, elems.mbssid_known_bss, + elems.mbssid_known_bss_len); if (resp == NULL) return; @@ -1284,7 +1288,7 @@ 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); + return hostapd_gen_probe_resp(hapd, NULL, 0, resp_len, NULL, 0); } #endif /* NEED_AP_MLME */ @@ -1301,7 +1305,8 @@ static u8 * hostapd_unsol_bcast_probe_resp(struct hostapd_data *hapd, hapd->conf->unsol_bcast_probe_resp_interval; return hostapd_gen_probe_resp(hapd, NULL, 0, - ¶ms->unsol_bcast_probe_resp_tmpl_len); + ¶ms->unsol_bcast_probe_resp_tmpl_len, + NULL, 0); } #endif /* CONFIG_IEEE80211AX */ diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index 36d6831b2376..9a189d733487 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -7472,7 +7472,9 @@ u8 * hostapd_eid_rnr(struct hostapd_data *hapd, u8 *eid, u32 type) static size_t hostapd_eid_mbssid_elem_len(struct hostapd_data *hapd, - u32 frame_type, size_t *bss_index) + u32 frame_type, size_t *bss_index, + const u8 *known_bss, + size_t known_bss_len) { struct hostapd_data *tx_bss = hostapd_mbssid_get_tx_bss(hapd); size_t len = 3, i; @@ -7483,6 +7485,12 @@ static size_t hostapd_eid_mbssid_elem_len(struct hostapd_data *hapd, size_t nontx_profile_len, auth_len; u8 ie_count = 0; + if (known_bss && (known_bss_len > (i / 8))) { + known_bss = &known_bss[i / 8]; + if (*known_bss & (u8)(BIT(i % 8))) + continue; + } + if (!bss || !bss->conf || !bss->started) continue; @@ -7534,7 +7542,8 @@ mbssid_too_big: size_t hostapd_eid_mbssid_len(struct hostapd_data *hapd, u32 frame_type, - u8 *elem_count) + u8 *elem_count, const u8 *known_bss, + size_t known_bss_len) { size_t len = 0, bss_index = 1; @@ -7554,7 +7563,8 @@ size_t hostapd_eid_mbssid_len(struct hostapd_data *hapd, u32 frame_type, while (bss_index < hapd->iface->num_bss) { len += hostapd_eid_mbssid_elem_len(hapd, frame_type, - &bss_index); + &bss_index, known_bss, + known_bss_len); if (frame_type == WLAN_FC_STYPE_BEACON) *elem_count += 1; @@ -7565,7 +7575,8 @@ size_t hostapd_eid_mbssid_len(struct hostapd_data *hapd, u32 frame_type, static u8 * hostapd_eid_mbssid_elem(struct hostapd_data *hapd, u8 *eid, u8 *end, u32 frame_type, u8 max_bssid_indicator, - size_t *bss_index, u8 elem_count) + size_t *bss_index, u8 elem_count, + const u8 *known_bss, size_t known_bss_len) { struct hostapd_data *tx_bss = hostapd_mbssid_get_tx_bss(hapd); size_t i; @@ -7584,6 +7595,12 @@ static u8 * hostapd_eid_mbssid_elem(struct hostapd_data *hapd, u8 *eid, u8 *end, size_t auth_len = 0; u16 capab_info; + if (known_bss && (known_bss_len > (i / 8))) { + known_bss = &known_bss[i / 8]; + if (*known_bss & (u8)(BIT(i % 8))) + continue; + } + if (!bss || !bss->conf || !bss->started) continue; conf = bss->conf; @@ -7675,7 +7692,8 @@ mbssid_too_big: u8 * hostapd_eid_mbssid(struct hostapd_data *hapd, u8 *eid, u8 *end, - u32 frame_type, u8 elem_count, u8 **elem_offset) + u32 frame_type, u8 elem_count, u8 **elem_offset, + const u8 *known_bss, size_t known_bss_len) { size_t bss_index = 1; u8 elem_index = 0; @@ -7703,7 +7721,8 @@ u8 * hostapd_eid_mbssid(struct hostapd_data *hapd, u8 *eid, u8 *end, } eid = hostapd_eid_mbssid_elem(hapd, eid, end, frame_type, hostapd_max_bssid_indicator(hapd), - &bss_index, elem_count); + &bss_index, elem_count, + known_bss, known_bss_len); } return eid; } diff --git a/src/ap/ieee802_11.h b/src/ap/ieee802_11.h index 37df3faa724c..e75ff4ee861f 100644 --- a/src/ap/ieee802_11.h +++ b/src/ap/ieee802_11.h @@ -121,9 +121,11 @@ void hostapd_client_poll_ok(struct hostapd_data *hapd, const u8 *addr); u8 * hostapd_eid_bss_max_idle_period(struct hostapd_data *hapd, u8 *eid); int auth_sae_init_committed(struct hostapd_data *hapd, struct sta_info *sta); size_t hostapd_eid_mbssid_len(struct hostapd_data *hapd, u32 frame_type, - u8 *elem_count); + u8 *elem_count, const u8 *known_bss, + size_t known_bss_len); u8 * hostapd_eid_mbssid(struct hostapd_data *hapd, u8 *eid, u8 *end, - u32 frame_type, u8 elem_count, u8 **elem_offset); + u32 frame_type, u8 elem_count, u8 **elem_offset, + const u8 *known_bss, size_t known_bss_len); #ifdef CONFIG_SAE void sae_clear_retransmit_timer(struct hostapd_data *hapd, struct sta_info *sta); diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c index 5b74ddcdf62b..3ff111ce3fa7 100644 --- a/src/common/ieee802_11_common.c +++ b/src/common/ieee802_11_common.c @@ -307,6 +307,10 @@ static int ieee802_11_parse_extension(const u8 *pos, size_t elen, elems->pasn_params = pos; elems->pasn_params_len = elen; break; + case WLAN_EID_EXT_KNOWN_BSSID: + elems->mbssid_known_bss = pos; + elems->mbssid_known_bss_len = elen; + break; default: if (show_errors) { wpa_printf(MSG_MSGDUMP, diff --git a/src/common/ieee802_11_common.h b/src/common/ieee802_11_common.h index e4e4c613e9c6..a62ea5901f82 100644 --- a/src/common/ieee802_11_common.h +++ b/src/common/ieee802_11_common.h @@ -117,6 +117,7 @@ struct ieee802_11_elems { const u8 *sae_pk; const u8 *s1g_capab; const u8 *pasn_params; + const u8 *mbssid_known_bss; u8 ssid_len; u8 supp_rates_len; @@ -171,6 +172,7 @@ struct ieee802_11_elems { u8 short_ssid_list_len; u8 sae_pk_len; u8 pasn_params_len; + u8 mbssid_known_bss_len; struct mb_ies_info mb_ies; struct frag_ies_info frag_ies; diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h index 4747714e3219..8657ce697d7c 100644 --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h @@ -482,6 +482,7 @@ #define WLAN_EID_EXT_OCV_OCI 54 #define WLAN_EID_EXT_MULTIPLE_BSSID_CONFIGURATION 55 #define WLAN_EID_EXT_NON_INHERITANCE 56 +#define WLAN_EID_EXT_KNOWN_BSSID 57 #define WLAN_EID_EXT_SHORT_SSID_LIST 58 #define WLAN_EID_EXT_HE_6GHZ_BAND_CAP 59 #define WLAN_EID_EXT_EDMG_CAPABILITIES 61