From patchwork Mon Sep 21 11:50:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 1368288 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=phrozen.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=bMYBInQ1; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (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 ozlabs.org (Postfix) with ESMTPS id 4Bw2pt5VkYz9sVB for ; Mon, 21 Sep 2020 21:51:48 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject: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=ew5cDWjUvN/nLlLy5rVCi206p72QuOUQMSBrgxqCLDY=; b=bMYBInQ1AabwlAUkoz51z9KpdF nstmuykpj9uS2W0xDs0s8I3iX5lv+6lfqHmQC303buolK3N+GJ8AP3uGfAPuTlXx+UPrtRaxUZRtI yvmJnIQKxn8Gbknb9Dv6/tp2Uzg9ooXhlEcHWZEC+rJSDnd3kXbbl+pbv9uMx5UQXlJpuG92heaC8 PzepsSWMkt9NU/M423Vc/rqS/n0eBdXud/lk066SJ9u0H0pKKSlLAgNW3lzhHih83oDIfsIchGY6R dJEMGUyEL4kP4qtRcvOxsMfr9QYbcihDVQyaMckKGfxHvFT2ZvHvAeiyFojmhutFU5YD1CgsV77gP aa0FDzUg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKKLf-0000t0-Ac; Mon, 21 Sep 2020 11:51:11 +0000 Received: from nbd.name ([2a01:4f8:221:3d45::2]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKKLa-0000pe-Lr for hostap@lists.infradead.org; Mon, 21 Sep 2020 11:51:08 +0000 Received: from [149.224.189.218] (helo=localhost.localdomain) by ds12 with esmtpa (Exim 4.89) (envelope-from ) id 1kKKLZ-0001h2-27; Mon, 21 Sep 2020 13:51:05 +0200 From: John Crispin To: Jouni Malinen Subject: [PATCH V3 1/7] co-located: add a config option to indicate co locate Date: Mon, 21 Sep 2020 13:50:56 +0200 Message-Id: <20200921115102.5643-1-john@phrozen.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200921_075107_434139_8237BCCE X-CRM114-Status: GOOD ( 14.97 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hostap@lists.infradead.org, John Crispin Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org A 6GHz BSS can be co-located with a 2/5GHz BSS. This option allows us to indicate if this should be done. Signed-off-by: John Crispin --- hostapd/config_file.c | 2 ++ hostapd/hostapd.conf | 3 +++ src/ap/ap_config.h | 1 + 3 files changed, 6 insertions(+) diff --git a/hostapd/config_file.c b/hostapd/config_file.c index 6c1f629cf..fe0d941e4 100644 --- a/hostapd/config_file.c +++ b/hostapd/config_file.c @@ -3552,6 +3552,8 @@ static int hostapd_config_fill(struct hostapd_config *conf, conf->he_oper_centr_freq_seg0_idx = atoi(pos); } else if (os_strcmp(buf, "he_oper_centr_freq_seg1_idx") == 0) { conf->he_oper_centr_freq_seg1_idx = atoi(pos); + } else if (os_strcmp(buf, "he_co_locate") == 0) { + conf->he_co_locate = atoi(pos); #endif /* CONFIG_IEEE80211AX */ } else if (os_strcmp(buf, "max_listen_interval") == 0) { bss->max_listen_interval = atoi(pos); diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf index 5fc4d5f86..280316c0c 100644 --- a/hostapd/hostapd.conf +++ b/hostapd/hostapd.conf @@ -571,6 +571,9 @@ wmm_ac_vo_acm=0 # Default: 1 (enabled) #broadcast_deauth=1 +# Enable co-locate for a 6GHz radio +#co_locate=0 + ##### IEEE 802.11n related configuration ###################################### # ieee80211n: Whether IEEE 802.11n (HT) is enabled diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h index 3a363bc4e..e54e1bcd2 100644 --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h @@ -1030,6 +1030,7 @@ struct hostapd_config { u8 he_oper_chwidth; u8 he_oper_centr_freq_seg0_idx; u8 he_oper_centr_freq_seg1_idx; + bool he_co_locate; #endif /* CONFIG_IEEE80211AX */ /* VHT enable/disable config from CHAN_SWITCH */ From patchwork Mon Sep 21 11:50:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 1368287 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=phrozen.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (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 ozlabs.org (Postfix) with ESMTPS id 4Bw2ps5yMwz9sV6 for ; Mon, 21 Sep 2020 21:51:48 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc: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:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=rAho9KkEcdKEmWqYNzlE6ILxI5EETkDqyAlFEkpcAyg=; b=R/HyXfN1OZIDrGtdk/6JosDhw TwUTDP8buRyIqWvEoLUbNNZFhG/ch82lWJs6CFjyXDNCpZKPW5wqrCbeFwAD97M9uZ1XOQ+X5eS55 djuiXjvQ9tgnPMJ/gdZW97pVP5MsKhgMoVZJkaEbG3oSeHfNBx/NC9/J55ozoV8WyHgCAKmixL274 SUuwwI02QbNOulgtOZNLfUUWNrkAW+EVWIizScfPSP+Kz/8ay3AD/SSahLRlpAA9A7epBZtlTp7ly /MQ8LbcBMyhBnCBvh7ZbXysm0AfhmIHlGgwvp0CrHLWFnCk7jZFh3zlzhD2odbkDnvXcBBdtjA2MI ozSNz+Ptw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKKLh-0000u9-AA; Mon, 21 Sep 2020 11:51:13 +0000 Received: from nbd.name ([2a01:4f8:221:3d45::2]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKKLa-0000q0-QQ for hostap@lists.infradead.org; Mon, 21 Sep 2020 11:51:08 +0000 Received: from [149.224.189.218] (helo=localhost.localdomain) by ds12 with esmtpa (Exim 4.89) (envelope-from ) id 1kKKLZ-0001h2-7r; Mon, 21 Sep 2020 13:51:05 +0200 From: John Crispin To: Jouni Malinen Subject: [PATCH V3 2/7] neighbor_db: set the co-locate bit Date: Mon, 21 Sep 2020 13:50:57 +0200 Message-Id: <20200921115102.5643-2-john@phrozen.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200921115102.5643-1-john@phrozen.org> References: <20200921115102.5643-1-john@phrozen.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200921_075107_492001_4560BEE1 X-CRM114-Status: GOOD ( 13.20 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hostap@lists.infradead.org, John Crispin Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org If the BSS is co-located, the corresponding bit needs to be set inside bssid_info. Signed-off-by: John Crispin --- src/ap/neighbor_db.c | 3 +++ src/common/ieee802_11_defs.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/ap/neighbor_db.c b/src/ap/neighbor_db.c index 01bf88623..3a4cdc004 100644 --- a/src/ap/neighbor_db.c +++ b/src/ap/neighbor_db.c @@ -260,6 +260,9 @@ void hostapd_neighbor_set_own_report(struct hostapd_data *hapd) bssid_info |= NEI_REP_BSSID_INFO_HE; } + if (hapd->iconf->he_co_locate) + bssid_info |= NEI_REP_BSSID_INFO_HE_CO_LOCATED; + /* TODO: Set NEI_REP_BSSID_INFO_MOBILITY_DOMAIN if MDE is set */ if (ieee80211_freq_to_channel_ext(hapd->iface->freq, diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h index ec3a0613f..6c0eef885 100644 --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h @@ -2130,6 +2130,8 @@ enum phy_type { #define NEI_REP_BSSID_INFO_VHT BIT(12) #define NEI_REP_BSSID_INFO_FTM BIT(13) #define NEI_REP_BSSID_INFO_HE BIT(14) +#define NEI_REP_BSSID_INFO_HE_ER_BSS BIT(15) +#define NEI_REP_BSSID_INFO_HE_CO_LOCATED BIT(16) /* * IEEE P802.11-REVmc/D5.0 Table 9-152 - HT/VHT Operation Information From patchwork Mon Sep 21 11:50:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 1368290 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=phrozen.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=re4ToZCb; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (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 ozlabs.org (Postfix) with ESMTPS id 4Bw2q03b4Bz9sV0 for ; Mon, 21 Sep 2020 21:51:56 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc: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:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=bqOvcUziZ9LGwFGngfQ5yvpvbRblywOyhT/Fl7V+CX4=; b=re4ToZCbHdQLXX8il64BSY8bs 3WxR1jmVw7V6PUsKyiVEFUfMaxTjLcJj9iKxfYrUMsQ0TOHqp73ZAAOosXMNHpjob9Nv9SqQuUUm5 YHw3/3BA7h1OyWeHvCkvG2sATdy+hxs8AMWdPHjgye0UhK+BzV0IBk8roWtcT2jRVS5z/SwKlw9lF mqdL9UelU754lo3/YyqFjiwm2pg+uEbmGq0anAAjs1V0pGQIukdRILSeZ4gf35SM6/1ho9hiZ2mbC eQ28IOh+288aEHebrwbUT+HGtDcFCf1U6f/m2egYT4uFBuziFe8qrqS9+FNbhoWwNK8lkT7ewKDFX S7vE043RQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKKLo-0000xV-UO; Mon, 21 Sep 2020 11:51:20 +0000 Received: from nbd.name ([2a01:4f8:221:3d45::2]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKKLb-0000qI-CR for hostap@lists.infradead.org; Mon, 21 Sep 2020 11:51:10 +0000 Received: from [149.224.189.218] (helo=localhost.localdomain) by ds12 with esmtpa (Exim 4.89) (envelope-from ) id 1kKKLZ-0001h2-Je; Mon, 21 Sep 2020 13:51:05 +0200 From: John Crispin To: Jouni Malinen Subject: [PATCH V3 3/7] rrm: add handling for co-located BSS Date: Mon, 21 Sep 2020 13:50:58 +0200 Message-Id: <20200921115102.5643-3-john@phrozen.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200921115102.5643-1-john@phrozen.org> References: <20200921115102.5643-1-john@phrozen.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200921_075107_576536_4CA06545 X-CRM114-Status: GOOD ( 19.43 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hostap@lists.infradead.org, John Crispin Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org A BSS shall include the neighbor entry of a co-located BSS upon an incoming request. Signed-off-by: John Crispin --- src/ap/rrm.c | 117 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 74 insertions(+), 43 deletions(-) diff --git a/src/ap/rrm.c b/src/ap/rrm.c index f2d5cd16e..c9d51dfa7 100644 --- a/src/ap/rrm.c +++ b/src/ap/rrm.c @@ -196,6 +196,63 @@ static size_t hostapd_neighbor_report_len(struct wpabuf *buf, } +static int hostapd_add_nei_report_entry(struct wpabuf *buf, struct hostapd_neighbor_entry *nr, + struct wpa_ssid_value *ssid, u8 lci, + u8 civic, u16 lci_max_age) +{ + u8 *msmt_token; + int send_lci; + size_t len; + + if (ssid->ssid_len != nr->ssid.ssid_len || + os_memcmp(ssid->ssid, nr->ssid.ssid, ssid->ssid_len) != 0) + return 0; + + send_lci = (lci != 0) && hostapd_check_lci_age(nr, lci_max_age); + len = hostapd_neighbor_report_len(buf, nr, send_lci, civic); + + if (len - 2 > 0xff) { + wpa_printf(MSG_DEBUG, + "NR entry for " MACSTR " exceeds 0xFF bytes", + MAC2STR(nr->bssid)); + return 0; + } + + if (len > wpabuf_tailroom(buf)) + return -1; + + wpabuf_put_u8(buf, WLAN_EID_NEIGHBOR_REPORT); + wpabuf_put_u8(buf, len - 2); + wpabuf_put_buf(buf, nr->nr); + + if (send_lci && nr->lci) { + wpabuf_put_u8(buf, WLAN_EID_MEASURE_REPORT); + wpabuf_put_u8(buf, wpabuf_len(nr->lci)); + /* + * Override measurement token - the first byte of the + * Measurement Report element. + */ + msmt_token = wpabuf_put(buf, 0); + wpabuf_put_buf(buf, nr->lci); + *msmt_token = lci; + } + + if (civic && nr->civic) { + wpabuf_put_u8(buf, WLAN_EID_MEASURE_REPORT); + wpabuf_put_u8(buf, wpabuf_len(nr->civic)); + /* + * Override measurement token - the first byte of the + * Measurement Report element. + */ + msmt_token = wpabuf_put(buf, 0); + wpabuf_put_buf(buf, nr->civic); + *msmt_token = civic; + } + + return 0; +} + + static void hostapd_send_nei_report_resp(struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, struct wpa_ssid_value *ssid, u8 lci, @@ -203,7 +260,6 @@ static void hostapd_send_nei_report_resp(struct hostapd_data *hapd, { struct hostapd_neighbor_entry *nr; struct wpabuf *buf; - u8 *msmt_token; /* * The number and length of the Neighbor Report elements in a Neighbor @@ -220,52 +276,27 @@ static void hostapd_send_nei_report_resp(struct hostapd_data *hapd, dl_list_for_each(nr, &hapd->nr_db, struct hostapd_neighbor_entry, list) { - int send_lci; - size_t len; - - if (ssid->ssid_len != nr->ssid.ssid_len || - os_memcmp(ssid->ssid, nr->ssid.ssid, ssid->ssid_len) != 0) - continue; - - send_lci = (lci != 0) && hostapd_check_lci_age(nr, lci_max_age); - len = hostapd_neighbor_report_len(buf, nr, send_lci, civic); - - if (len - 2 > 0xff) { - wpa_printf(MSG_DEBUG, - "NR entry for " MACSTR " exceeds 0xFF bytes", - MAC2STR(nr->bssid)); - continue; - } - - if (len > wpabuf_tailroom(buf)) + if (hostapd_add_nei_report_entry(buf, nr, ssid, lci, civic, lci_max_age)) break; + } - wpabuf_put_u8(buf, WLAN_EID_NEIGHBOR_REPORT); - wpabuf_put_u8(buf, len - 2); - wpabuf_put_buf(buf, nr->nr); + if (!hapd->iconf->he_co_locate) { + int i; - if (send_lci && nr->lci) { - wpabuf_put_u8(buf, WLAN_EID_MEASURE_REPORT); - wpabuf_put_u8(buf, wpabuf_len(nr->lci)); - /* - * Override measurement token - the first byte of the - * Measurement Report element. - */ - msmt_token = wpabuf_put(buf, 0); - wpabuf_put_buf(buf, nr->lci); - *msmt_token = lci; - } + for (i = 0; i < hapd->iface->interfaces->count; i++) { + struct hostapd_iface *iface = hapd->iface->interfaces->iface[i]; + int j; + + if (iface == hapd->iface || !iface->conf->he_co_locate) + continue; - if (civic && nr->civic) { - wpabuf_put_u8(buf, WLAN_EID_MEASURE_REPORT); - wpabuf_put_u8(buf, wpabuf_len(nr->civic)); - /* - * Override measurement token - the first byte of the - * Measurement Report element. - */ - msmt_token = wpabuf_put(buf, 0); - wpabuf_put_buf(buf, nr->civic); - *msmt_token = civic; + for (j = 0; j < iface->num_bss; j++) { + nr = hostapd_neighbor_get(iface->bss[j], iface->bss[j]->own_addr, NULL); + if (!nr) + continue; + if (hostapd_add_nei_report_entry(buf, nr, ssid, lci, civic, lci_max_age)) + break; + } } } From patchwork Mon Sep 21 11:50:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 1368291 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=phrozen.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=g63wxReH; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (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 ozlabs.org (Postfix) with ESMTPS id 4Bw2q05dJQz9sVB for ; Mon, 21 Sep 2020 21:51:56 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc: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:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=s8VUmBhOyjcPPfgdcAtHMy9R+vpJF4359zej6Jqks10=; b=g63wxReHpcZHU/+jCBHno+odZ txARLDZgJPRZ6MMWjJfWEqs9zauJxDGY5SoktUI+s+bkfRyuS96ZWlPvimFx7XmXEL8wVJOMOPWB+ 8Wh4flvbq4DxJdUXnNdj117dtfJiNoyru5PrEmRtaWMAQPyBP8AWs5pLf55iUgzgK+i1nUcM+WhA/ e43N6FnIsne9gM6RDViRyAjiPNoVuf0YjkdanvqIBwJfVKKKsPaCdIDLZEV3G45hxtEWsRSk67x6k L/lKc1bAnftj5605RMR3+ljwx+QiR5tGev8Z3pLXQ+H8HupqOhHYjyWKSk0A5fxp9lLmuxTqMBBsS 3qFYM4IEg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKKLq-0000yU-V4; Mon, 21 Sep 2020 11:51:23 +0000 Received: from nbd.name ([2a01:4f8:221:3d45::2]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKKLb-0000qM-M5 for hostap@lists.infradead.org; Mon, 21 Sep 2020 11:51:10 +0000 Received: from [149.224.189.218] (helo=localhost.localdomain) by ds12 with esmtpa (Exim 4.89) (envelope-from ) id 1kKKLZ-0001h2-TZ; Mon, 21 Sep 2020 13:51:05 +0200 From: John Crispin To: Jouni Malinen Subject: [PATCH V3 4/7] rnr: move crc32 generation to config load time Date: Mon, 21 Sep 2020 13:50:59 +0200 Message-Id: <20200921115102.5643-4-john@phrozen.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200921115102.5643-1-john@phrozen.org> References: <20200921115102.5643-1-john@phrozen.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200921_075107_847247_23FFED4E X-CRM114-Status: GOOD ( 14.58 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hostap@lists.infradead.org, John Crispin Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org During config reload the short_ssid was getting flushed. Move the generation into the config loading code. Signed-off-by: John Crispin --- hostapd/config_file.c | 7 +++++++ src/ap/hostapd.c | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hostapd/config_file.c b/hostapd/config_file.c index fe0d941e4..eb7d9ff78 100644 --- a/hostapd/config_file.c +++ b/hostapd/config_file.c @@ -13,6 +13,7 @@ #include "utils/common.h" #include "utils/uuid.h" +#include "utils/crc32.h" #include "common/ieee802_11_defs.h" #include "common/sae.h" #include "crypto/sha256.h" @@ -2355,6 +2356,12 @@ static int hostapd_config_fill(struct hostapd_config *conf, } os_memcpy(bss->ssid.ssid, pos, bss->ssid.ssid_len); bss->ssid.ssid_set = 1; + + /* + * Short SSID calculation is identical to FCS and it is defined in + * IEEE P802.11-REVmd/D3.0, 9.4.2.170.3 (Calculating the Short-SSID). + */ + bss->ssid.short_ssid = crc32(bss->ssid.ssid, bss->ssid.ssid_len); } else if (os_strcmp(buf, "ssid2") == 0) { size_t slen; char *str = wpa_config_parse_string(pos, &slen); diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index 0d44852f0..ccb2fbc86 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -13,7 +13,6 @@ #include "utils/common.h" #include "utils/eloop.h" -#include "utils/crc32.h" #include "common/ieee802_11_defs.h" #include "common/wpa_ctrl.h" #include "common/hw_features_common.h" @@ -1251,12 +1250,6 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first) os_memcpy(conf->ssid.ssid, ssid, conf->ssid.ssid_len); } - /* - * Short SSID calculation is identical to FCS and it is defined in - * IEEE P802.11-REVmd/D3.0, 9.4.2.170.3 (Calculating the Short-SSID). - */ - conf->ssid.short_ssid = crc32(conf->ssid.ssid, conf->ssid.ssid_len); - if (!hostapd_drv_none(hapd)) { wpa_printf(MSG_DEBUG, "Using interface %s with hwaddr " MACSTR " and ssid \"%s\"", From patchwork Mon Sep 21 11:51:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 1368293 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=phrozen.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=HiM3Azr5; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (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 ozlabs.org (Postfix) with ESMTPS id 4Bw2q25xp5z9sV0 for ; Mon, 21 Sep 2020 21:51:58 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc: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:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=V7sBZUF6LGWjcOibB/sGo7zWsdDgihf+iZem7RJVW1s=; b=HiM3Azr5ZACsKS8PwDh+xWy5S u9/5vU3xG91jPqYi6uLxPuB1Yru/qcHHCFDHjIcKi/7S/OwxTkrpJQ4M6S6gl2pqE33aBonssJlur fwmB5cXpWeQhnB/aDzxhaouNCfB6scROTle3Pq8RCdkVxV5iHqQ+FxImnoAZgID2a6OyasGSn+Bfk 0BC6mwLVUJUTX0QOscg23Q+cto/7VxNc+uhk9lpgGDNC4BYG22NxWyeiv2+840RoxW735WpK2XD1m RSR59k2Kmb5hZGNXX540hDLASTymbbwzbfO+PQ6Nhy8yWPfx6oRZWPAEWT0JNQxLudJ+QoAOT7Xbs C5Av3e+aQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKKLt-0000zi-Ev; Mon, 21 Sep 2020 11:51:25 +0000 Received: from nbd.name ([2a01:4f8:221:3d45::2]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKKLb-0000qO-VW for hostap@lists.infradead.org; Mon, 21 Sep 2020 11:51:10 +0000 Received: from [149.224.189.218] (helo=localhost.localdomain) by ds12 with esmtpa (Exim 4.89) (envelope-from ) id 1kKKLa-0001h2-37; Mon, 21 Sep 2020 13:51:06 +0200 From: John Crispin To: Jouni Malinen Subject: [PATCH V3 5/7] rnr: add bss_parameters to the neighbor_db Date: Mon, 21 Sep 2020 13:51:00 +0200 Message-Id: <20200921115102.5643-5-john@phrozen.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200921115102.5643-1-john@phrozen.org> References: <20200921115102.5643-1-john@phrozen.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200921_075108_124461_B0B2F1EC X-CRM114-Status: GOOD ( 18.02 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hostap@lists.infradead.org, John Crispin Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org P802.11ax/D4.0 9.4.2.170 (Reduced Neighbor Report element) described this field used inside reduced neighbor reports. It holds info about multiple bssid and 6G co-location which was not present in the existing neighbor reports. Signed-off-by: John Crispin --- hostapd/ctrl_iface.c | 16 +++++++++++++++- src/ap/hostapd.h | 1 + src/ap/neighbor_db.c | 6 ++++-- src/ap/neighbor_db.h | 3 ++- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c index b470c5643..9ef394273 100644 --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c @@ -3003,6 +3003,7 @@ static int hostapd_ctrl_iface_set_neighbor(struct hostapd_data *hapd, char *buf) u8 bssid[ETH_ALEN]; struct wpabuf *nr, *lci = NULL, *civic = NULL; int stationary = 0; + int bss_parameters = 0; char *tmp; int ret; @@ -3087,9 +3088,22 @@ static int hostapd_ctrl_iface_set_neighbor(struct hostapd_data *hapd, char *buf) if (os_strstr(buf, "stat")) stationary = 1; + tmp = os_strstr(buf, "bss_parameter="); + if (tmp) { + bss_parameters = atoi(tmp + 14); + if (bss_parameters > 0xff) { + wpa_printf(MSG_ERROR, + "CTRL: SET_NEIGHBOR: Bad bss_parameters subelement"); + wpabuf_free(nr); + wpabuf_free(lci); + wpabuf_free(civic); + return -1; + } + } + set: ret = hostapd_neighbor_set(hapd, bssid, &ssid, nr, lci, civic, - stationary); + stationary, bss_parameters); wpabuf_free(nr); wpabuf_free(lci); diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h index 19dcd1b51..a9050ebac 100644 --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h @@ -138,6 +138,7 @@ struct hostapd_neighbor_entry { /* LCI update time */ struct os_time lci_date; int stationary; + u8 bss_parameters; }; struct hostapd_sae_commit_queue { diff --git a/src/ap/neighbor_db.c b/src/ap/neighbor_db.c index 3a4cdc004..eaf0650f1 100644 --- a/src/ap/neighbor_db.c +++ b/src/ap/neighbor_db.c @@ -120,7 +120,8 @@ hostapd_neighbor_add(struct hostapd_data *hapd) int hostapd_neighbor_set(struct hostapd_data *hapd, const u8 *bssid, const struct wpa_ssid_value *ssid, const struct wpabuf *nr, const struct wpabuf *lci, - const struct wpabuf *civic, int stationary) + const struct wpabuf *civic, int stationary, + u8 bss_parameters) { struct hostapd_neighbor_entry *entry; @@ -152,6 +153,7 @@ int hostapd_neighbor_set(struct hostapd_data *hapd, const u8 *bssid, } entry->stationary = stationary; + entry->bss_parameters = bss_parameters; return 0; @@ -314,7 +316,7 @@ void hostapd_neighbor_set_own_report(struct hostapd_data *hapd) wpabuf_put_u8(nr, center_freq2_idx); hostapd_neighbor_set(hapd, hapd->own_addr, &ssid, nr, hapd->iconf->lci, - hapd->iconf->civic, hapd->iconf->stationary_ap); + hapd->iconf->civic, hapd->iconf->stationary_ap, 0); wpabuf_free(nr); #endif /* NEED_AP_MLME */ diff --git a/src/ap/neighbor_db.h b/src/ap/neighbor_db.h index bed0a2f5f..992671b62 100644 --- a/src/ap/neighbor_db.h +++ b/src/ap/neighbor_db.h @@ -17,7 +17,8 @@ int hostapd_neighbor_show(struct hostapd_data *hapd, char *buf, size_t buflen); int hostapd_neighbor_set(struct hostapd_data *hapd, const u8 *bssid, const struct wpa_ssid_value *ssid, const struct wpabuf *nr, const struct wpabuf *lci, - const struct wpabuf *civic, int stationary); + const struct wpabuf *civic, int stationary, + u8 bss_parameters); void hostapd_neighbor_set_own_report(struct hostapd_data *hapd); int hostapd_neighbor_remove(struct hostapd_data *hapd, const u8 *bssid, const struct wpa_ssid_value *ssid); From patchwork Mon Sep 21 11:51:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 1368289 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=phrozen.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=Vxg24YEZ; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (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 ozlabs.org (Postfix) with ESMTPS id 4Bw2pt6Rssz9sVK for ; Mon, 21 Sep 2020 21:51:50 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc: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:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=TQhG/ui8waZv/HSADO5IYNKxt/KVDvW/6H9o7EkUtv4=; b=Vxg24YEZ3m+B80wY6PMbkfgzg y7LQD/qPanurWgML686eu41SCfnU6FjctKoIPzexrxtQO6lxkgzPZ4igSSRcd6M0em34sGhgLwOr0 clC/6aqAuWTnXEjQaP/IaIfmxDCOOPSjSiWei8eJZbsESJLogg2lLdk4qjdgyN1NwOy1puwxJ/B7h jd5GSlNti3VMt964pMvvdCMjja+/L1dXYpibKe1XaeXudPpDhcal9LNcelG+Znv4HTxtYOkinKZaI hqQqDoB8YbyYnjAtm0zv8CmdB87RRNIpSi3zzV3XjpBfRrdmoJjq1LgXpv2aK8o8YSjPz6si5foi1 xmuC6ZHGw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKKLj-0000ul-Ot; Mon, 21 Sep 2020 11:51:15 +0000 Received: from nbd.name ([2a01:4f8:221:3d45::2]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKKLc-0000qP-22 for hostap@lists.infradead.org; Mon, 21 Sep 2020 11:51:10 +0000 Received: from [149.224.189.218] (helo=localhost.localdomain) by ds12 with esmtpa (Exim 4.89) (envelope-from ) id 1kKKLa-0001h2-BJ; Mon, 21 Sep 2020 13:51:06 +0200 From: John Crispin To: Jouni Malinen Subject: [PATCH V3 6/7] rnr: add short_ssid to neighbor_db entries Date: Mon, 21 Sep 2020 13:51:01 +0200 Message-Id: <20200921115102.5643-6-john@phrozen.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200921115102.5643-1-john@phrozen.org> References: <20200921115102.5643-1-john@phrozen.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200921_075108_210216_11BEDADF X-CRM114-Status: GOOD ( 13.32 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hostap@lists.infradead.org, John Crispin Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The rnr IE requires this field. Signed-off-by: John Crispin --- src/ap/hostapd.h | 1 + src/ap/neighbor_db.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h index a9050ebac..72cb8bd4f 100644 --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h @@ -139,6 +139,7 @@ struct hostapd_neighbor_entry { struct os_time lci_date; int stationary; u8 bss_parameters; + u32 short_ssid; }; struct hostapd_sae_commit_queue { diff --git a/src/ap/neighbor_db.c b/src/ap/neighbor_db.c index eaf0650f1..b042b1daf 100644 --- a/src/ap/neighbor_db.c +++ b/src/ap/neighbor_db.c @@ -10,6 +10,7 @@ #include "utils/includes.h" #include "utils/common.h" +#include "utils/crc32.h" #include "hostapd.h" #include "ieee802_11.h" #include "neighbor_db.h" @@ -135,6 +136,7 @@ int hostapd_neighbor_set(struct hostapd_data *hapd, const u8 *bssid, os_memcpy(entry->bssid, bssid, ETH_ALEN); os_memcpy(&entry->ssid, ssid, sizeof(entry->ssid)); + entry->short_ssid = crc32(ssid->ssid, ssid->ssid_len); entry->nr = wpabuf_dup(nr); if (!entry->nr) From patchwork Mon Sep 21 11:51:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 1368292 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=phrozen.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=egdSdazX; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (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 ozlabs.org (Postfix) with ESMTPS id 4Bw2q10CRWz9sVK for ; Mon, 21 Sep 2020 21:51:57 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc: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:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cFpx12eLGXqQ2rzRi0J/O1jYo5HCcYBN03+FnQB4iLE=; b=egdSdazX2CfUwoBF99jumKGLB aA3C0zbrJmEZ6bOENa02ohiQOP3GGtotTJ3S3qmKgfXH3q+tgQDC/nVqHo5A/vp1DSN6pa/q7KPTe NexBm7E3IJy9571M8Ubgt/4f0xE9igLSMevndb76numePq6f//tWBWvr+5PSKGtJORo8YUtCrF101 mSdxARbassSosaqiQrXLuhudSeKZqbAJDkM+yujCWyBYDVidh0I9jeYplrIikWyBeuICCHsGMuU67 rTAIYWJddp746jaGsX4is7/15xkqR/H9aYQOPf+NwQMn44NJOJAYN2vlgxwaJIP1MNekuWcPe3Fce gJrvluRYw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKKLv-00011S-Ns; Mon, 21 Sep 2020 11:51:27 +0000 Received: from nbd.name ([2a01:4f8:221:3d45::2]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKKLc-0000rF-Gt for hostap@lists.infradead.org; Mon, 21 Sep 2020 11:51:11 +0000 Received: from [149.224.189.218] (helo=localhost.localdomain) by ds12 with esmtpa (Exim 4.89) (envelope-from ) id 1kKKLa-0001h2-QZ; Mon, 21 Sep 2020 13:51:06 +0200 From: John Crispin To: Jouni Malinen Subject: [PATCH V3 7/7] rnr: add reduced neighbor reporting Date: Mon, 21 Sep 2020 13:51:02 +0200 Message-Id: <20200921115102.5643-7-john@phrozen.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200921115102.5643-1-john@phrozen.org> References: <20200921115102.5643-1-john@phrozen.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200921_075108_697154_F630A694 X-CRM114-Status: GOOD ( 21.14 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hostap@lists.infradead.org, John Crispin Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The Reduced Neighbor Report (rnr) element contains channel and other information related to neighbor APs. It is part of the OCE requirement. Signed-off-by: John Crispin --- hostapd/config_file.c | 2 + hostapd/hostapd.conf | 3 + src/ap/ap_config.h | 1 + src/ap/beacon.c | 8 +++ src/ap/ieee802_11.c | 136 +++++++++++++++++++++++++++++++++++ src/ap/ieee802_11.h | 2 + src/common/ieee802_11_defs.h | 14 ++++ 7 files changed, 166 insertions(+) diff --git a/hostapd/config_file.c b/hostapd/config_file.c index eb7d9ff78..b55487a27 100644 --- a/hostapd/config_file.c +++ b/hostapd/config_file.c @@ -4577,6 +4577,8 @@ static int hostapd_config_fill(struct hostapd_config *conf, #endif /* CONFIG_MACSEC */ } else if (os_strcmp(buf, "multiple_bssid") == 0) { conf->multiple_bssid = atoi(pos); + } else if (os_strcmp(buf, "rnr_beacon") == 0) { + bss->rnr_beacon = atoi(pos); } else { wpa_printf(MSG_ERROR, "Line %d: unknown configuration item '%s'", diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf index 280316c0c..a5012cc9a 100644 --- a/hostapd/hostapd.conf +++ b/hostapd/hostapd.conf @@ -2775,6 +2775,9 @@ own_ip_addr=127.0.0.1 # that allows sending of such data. Default: 0. #stationary_ap=0 +# Enable reduced neighbour reporting (RNR) +#rnr_beacon=0 + ##### Airtime policy configuration ########################################### # Set the airtime policy operating mode: diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h index e54e1bcd2..70d7d43e0 100644 --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h @@ -860,6 +860,7 @@ struct hostapd_bss_config { */ u8 mka_psk_set; #endif /* CONFIG_MACSEC */ + u8 rnr_beacon; }; /** diff --git a/src/ap/beacon.c b/src/ap/beacon.c index b59e34623..20939e0ea 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -477,6 +477,8 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd, buflen += hostapd_eid_dpp_cc_len(hapd); if (hapd->iconf->multiple_bssid) buflen += hostapd_eid_multiple_bssid_len(hapd); + if (hapd->conf->rnr_beacon) + buflen += hostapd_eid_reduced_neighbor_report_len(hapd, 1); resp = os_zalloc(buflen); if (resp == NULL) @@ -635,6 +637,8 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd, 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); + if (hapd->conf->rnr_beacon) + pos = hostapd_eid_reduced_neighbor_report(hapd, pos, 1); if (hapd->conf->vendor_elements) { os_memcpy(pos, wpabuf_head(hapd->conf->vendor_elements), @@ -1195,6 +1199,8 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd, tail_len += hostapd_mbo_ie_len(hapd); tail_len += hostapd_eid_owe_trans_len(hapd); tail_len += hostapd_eid_dpp_cc_len(hapd); + if (hapd->conf->rnr_beacon) + tail_len += hostapd_eid_reduced_neighbor_report_len(hapd, 0); tailpos = tail = os_malloc(tail_len); if (head == NULL || tail == NULL) { @@ -1370,6 +1376,8 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd, tailpos = hostapd_eid_owe_trans(hapd, tailpos, tail + tail_len - tailpos); tailpos = hostapd_eid_dpp_cc(hapd, tailpos, tail + tail_len - tailpos); + if (hapd->conf->rnr_beacon) + tailpos = hostapd_eid_reduced_neighbor_report(hapd, tailpos, 1); if (hapd->conf->vendor_elements) { os_memcpy(tailpos, wpabuf_head(hapd->conf->vendor_elements), diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index 4d925b412..cb76d8e82 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -5745,4 +5745,140 @@ u8 * hostapd_eid_multiple_bssid(struct hostapd_data *hapd, u8 *eid, u8 *end, return eid; } + +size_t hostapd_eid_reduced_neighbor_report_len(struct hostapd_data *hapd, bool probe_resp) +{ + size_t len = 0; + int i; + + if (hapd->iface->num_bss > 1) + len += TBTT_HEADER_LENGTH + ((hapd->iface->num_bss - 1) * TBTT_INFO_LENGTH); + for (i = 0; i < hapd->iface->interfaces->count; i++) { + struct hostapd_iface *iface = hapd->iface->interfaces->iface[i]; + + if (iface == hapd->iface || !iface->conf->he_co_locate) + continue; + + len += TBTT_HEADER_LENGTH + (iface->num_bss * TBTT_INFO_LENGTH); + } + + if (!probe_resp && !dl_list_empty(&hapd->nr_db)) + len += dl_list_len(&hapd->nr_db) * (TBTT_HEADER_LENGTH + TBTT_INFO_LENGTH); + + return len; +} + + +static u8 *hostapd_eid_reduced_neighbor_report_iface(struct hostapd_data *hapd, u8 *eid, int *count) +{ + int tbtt_count = hapd->iface->num_bss; + u8 op_class, channel; + int i; + + if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_AP_CSA) || + !hapd->iface->freq) + return eid; + + if (ieee80211_freq_to_channel_ext(hapd->iface->freq, + hapd->iconf->secondary_channel, + hostapd_get_oper_chwidth(hapd->iconf), + &op_class, &channel) == + NUM_HOSTAPD_MODES) + return eid; + + if (hapd->iface->conf->he_co_locate) + tbtt_count -= 1; + else + tbtt_count -= 2; + + *eid++ = TBTT_INFO_COUNT(tbtt_count); + *eid++ = TBTT_INFO_LENGTH; + *eid++ = op_class; + *eid++ = hapd->iconf->channel; + for (i = 0; i < hapd->iface->num_bss; i++) { + u8 bss_param = 0; + + if (hapd->iface->bss[i] == hapd && !hapd->iface->conf->he_co_locate) + continue; + *eid++ = TBTT_AP_OFFSET_UNKNOWN; + os_memcpy(eid, hapd->iface->bss[i]->own_addr, ETH_ALEN); + eid += 6; + os_memcpy(eid, &hapd->iface->bss[i]->conf->ssid.short_ssid, 4); + eid += 4; + if (hapd->iface->bss[i]->conf->ssid.short_ssid == + hapd->conf->ssid.short_ssid) + bss_param |= TBTT_BSS_PARAM_SAME_SSID; + if (hapd->iconf->multiple_bssid) + bss_param |= TBTT_BSS_PARAM_MULTIPLE_BSSID; + if (!i && hapd->iconf->multiple_bssid && hapd->iface->conf->he_co_locate) + bss_param |= TBTT_BSS_PARAM_TRANSMITTED_BSSID; + if (hapd->iface->conf->he_co_locate) + bss_param |= TBTT_BSS_PARAM_CO_LOCATED; + + *eid++ = bss_param; + *count += 1; + } + + return eid; +} + + +static u8 *hostapd_eid_reduced_neighbor_report_nr_db(struct hostapd_data *hapd, u8 *eid, int *count) +{ + struct hostapd_neighbor_entry *nr; + + dl_list_for_each(nr, &hapd->nr_db, struct hostapd_neighbor_entry, + list) { + if (!nr->nr || wpabuf_len(nr->nr) < 12) + continue; + if (nr->short_ssid == hapd->conf->ssid.short_ssid) + continue; + *eid++ = 0; + *eid++ = TBTT_INFO_LENGTH; + *eid++ = wpabuf_head_u8(nr->nr)[10]; + *eid++ = wpabuf_head_u8(nr->nr)[11]; + *eid++ = TBTT_AP_OFFSET_UNKNOWN; + os_memcpy(eid, nr->bssid, ETH_ALEN); + eid += 6; + os_memcpy(eid, &nr->short_ssid, 4); + eid += 4; + *eid++ = nr->bss_parameters; + *count += 1; + } + + return eid; +} + +u8 * hostapd_eid_reduced_neighbor_report(struct hostapd_data *hapd, u8 *eid, bool probe_resp) +{ + size_t len = hostapd_eid_reduced_neighbor_report_len(hapd, probe_resp); + int i, count = 0; + + if (!len) + return eid; + + *eid++ = WLAN_EID_REDUCED_NEIGHBOR_REPORT; + *eid++ = len; + + if (hapd->iface->num_bss > 1) + eid = hostapd_eid_reduced_neighbor_report_iface(hapd, eid, &count); + + for (i = 0; i < hapd->iface->interfaces->count; i++) { + struct hostapd_iface *iface = hapd->iface->interfaces->iface[i]; + + if (iface == hapd->iface || !iface->conf->he_co_locate) + continue; + + eid = hostapd_eid_reduced_neighbor_report_iface(iface->bss[0], eid, &count); + } + + if (!probe_resp) + hostapd_eid_reduced_neighbor_report_nr_db(hapd, eid, &count); + + if (!count) + eid -= 2; + + return eid; +} + #endif /* CONFIG_NATIVE_WINDOWS */ diff --git a/src/ap/ieee802_11.h b/src/ap/ieee802_11.h index 17b4cfe39..66e90d8b4 100644 --- a/src/ap/ieee802_11.h +++ b/src/ap/ieee802_11.h @@ -124,6 +124,8 @@ u8 * hostapd_eid_multiple_bssid(struct hostapd_data *hapd, u8 *eid, u8 *end, u8 is_beacon, u8 **eid_offsets, int *eid_count, int eid_max); int hostapd_eid_multiple_bssid_len(struct hostapd_data *hapd); +u8 * hostapd_eid_reduced_neighbor_report(struct hostapd_data *hapd, u8 *eid, bool probe_resp); +size_t hostapd_eid_reduced_neighbor_report_len(struct hostapd_data *hapd, bool probe_resp); int auth_sae_init_committed(struct hostapd_data *hapd, struct sta_info *sta); #ifdef CONFIG_SAE diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h index 6c0eef885..e00186142 100644 --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h @@ -2352,4 +2352,18 @@ enum edmg_bw_config { */ #define DOT11BSS_COLOR_COLLISION_AP_PERIOD 50 +/* TBTT Information field defines */ +#define TBTT_HEADER_LENGTH 4 +#define TBTT_INFO_LENGTH 12 +#define TBTT_INFO_FILTERED_NEIGH_AP BIT(2) +#define TBTT_INFO_COUNT(x) (((x) & 0xf) << 4) +#define TBTT_AP_OFFSET_UNKNOWN 255 +#define TBTT_BSS_PARAM_OCT_RECOMMENDED BIT(0) +#define TBTT_BSS_PARAM_SAME_SSID BIT(1) +#define TBTT_BSS_PARAM_MULTIPLE_BSSID BIT(2) +#define TBTT_BSS_PARAM_TRANSMITTED_BSSID BIT(3) +#define TBTT_BSS_PARAM_MEMBER_CO_LOCATED_ESS BIT(4) +#define TBTT_BSS_PARAM_20_TU_PROBE_RESP_ACTIVE BIT(5) +#define TBTT_BSS_PARAM_CO_LOCATED BIT(6) + #endif /* IEEE802_11_DEFS_H */