From patchwork Wed Jun 19 12:49:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1118526 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="jxD9V8Tg"; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 45THQ05QtGz9s6w for ; Wed, 19 Jun 2019 17:58:32 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.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=k7OY9LAx6I8McwAx97Wv8gXRB8YyQs65GbEVpxP14U4=; b=jxD9V8Tgz/oBBV u/ybSv+LO5EmcPITpgGTQd+2HDNeBuQGgD2+wTX8RUEr1NDjRSi8jpNyqw71ACTxo8bB4783mWdQ7 6JYvi8ZjjJQeuZ6QQ6OmdcshVDyd9+V8dCKwnVeeLljBpwqpz8Pog7QYs3ye+p+jkbnLqvZAn+jmV e77FESweywuKexhswj22NKPLkSI8fa/dvpefla6doSDVRzmmkHI9c35HSe/hPY7YUvhgOH6XGpw7a PL96uQUVKaQ1OIL6HuonN9bOezsz0m4wo/SQvWeP7qZBPDZvaQ2Z5sAJ5JxZGvJj8EI1URLKZ5gkr GhWs5FtyEPgY2lcJBrkA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdVUC-00088V-VO; Wed, 19 Jun 2019 07:58:29 +0000 Received: from mga17.intel.com ([192.55.52.151]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdVSq-0006ZZ-3D for hostap@lists.infradead.org; Wed, 19 Jun 2019 07:57:05 +0000 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jun 2019 00:57:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,392,1557212400"; d="scan'208";a="358537363" Received: from andrei-xps-12-9q33.jer.intel.com ([10.12.190.53]) by fmsmga006.fm.intel.com with ESMTP; 19 Jun 2019 00:57:02 -0700 From: Andrei Otcheretianski To: hostap@lists.infradead.org Subject: [PATCH 6/6] AP: Support Short SSID List element Date: Wed, 19 Jun 2019 15:49:16 +0300 Message-Id: <20190619124916.14150-7-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_005704_200818_E7E064C4 X-CRM114-Status: GOOD ( 13.08 ) X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [192.55.52.151 listed in list.dnswl.org] 2.4 DATE_IN_FUTURE_03_06 Date: is 3 to 6 hours after Received: date 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches 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: Andrei Otcheretianski Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org According to the Draft IEEE802.11ax/D4.1 (clause 11.1.4.3.4), AP should answer to probe requests if either SSID or Short SSID match and in addition it should also consider co-located BSSs. Signed-off-by: Andrei Otcheretianski --- src/ap/beacon.c | 58 +++++++++++++++++++++++++--------- src/common/ieee802_11_common.c | 4 +++ src/common/ieee802_11_common.h | 2 ++ src/common/ieee802_11_defs.h | 1 + 4 files changed, 50 insertions(+), 15 deletions(-) diff --git a/src/ap/beacon.c b/src/ap/beacon.c index 724e1d8ca5..01e93c4bf3 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -654,7 +654,9 @@ enum ssid_match_result { static enum ssid_match_result ssid_match(struct hostapd_data *hapd, const u8 *ssid, size_t ssid_len, const u8 *ssid_list, - size_t ssid_list_len) + size_t ssid_list_len, + const u8 *short_ssid_list, + size_t short_ssid_list_len) { const u8 *pos, *end; int wildcard = 0; @@ -665,20 +667,30 @@ static enum ssid_match_result ssid_match(struct hostapd_data *hapd, os_memcmp(ssid, hapd->conf->ssid.ssid, ssid_len) == 0) return EXACT_SSID_MATCH; - if (ssid_list == NULL) - return wildcard ? WILDCARD_SSID_MATCH : NO_SSID_MATCH; + if (ssid_list) { + pos = ssid_list; + end = ssid_list + ssid_list_len; + while (end - pos >= 2) { + if (2 + pos[1] > end - pos) + break; + if (pos[1] == 0) + wildcard = 1; + if (pos[1] == hapd->conf->ssid.ssid_len && + os_memcmp(pos + 2, hapd->conf->ssid.ssid, + pos[1]) == 0) + return EXACT_SSID_MATCH; + pos += 2 + pos[1]; + } + } - pos = ssid_list; - end = ssid_list + ssid_list_len; - while (end - pos >= 2) { - if (2 + pos[1] > end - pos) - break; - if (pos[1] == 0) - wildcard = 1; - if (pos[1] == hapd->conf->ssid.ssid_len && - os_memcmp(pos + 2, hapd->conf->ssid.ssid, pos[1]) == 0) - return EXACT_SSID_MATCH; - pos += 2 + pos[1]; + if (short_ssid_list) { + pos = short_ssid_list; + end = short_ssid_list + short_ssid_list_len; + while (end - pos >= 4) { + if (hapd->conf->ssid.short_ssid == WPA_GET_LE32(pos)) + return EXACT_SSID_MATCH; + pos += 4; + } } return wildcard ? WILDCARD_SSID_MATCH : NO_SSID_MATCH; @@ -943,7 +955,23 @@ void handle_probe_req(struct hostapd_data *hapd, #endif /* CONFIG_TAXONOMY */ res = ssid_match(hapd, elems.ssid, elems.ssid_len, - elems.ssid_list, elems.ssid_list_len); + elems.ssid_list, elems.ssid_list_len, + elems.short_ssid_list, elems.short_ssid_list_len); + for (i = 0; res == NO_SSID_MATCH && i < hapd->conf->n_coloc_ifaces; + i++) { + struct hostapd_data *h = + hostapd_get_iface(hapd->iface->interfaces, + hapd->conf->coloc_ifaces[i]); + + if (!h || !h->started || h == hapd) + continue; + + res = ssid_match(h, elems.ssid, elems.ssid_len, + elems.ssid_list, elems.ssid_list_len, + elems.short_ssid_list, + elems.short_ssid_list_len); + } + if (res == NO_SSID_MATCH) { if (!(mgmt->da[0] & 0x01)) { wpa_printf(MSG_MSGDUMP, "Probe Request from " MACSTR diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c index 8096e17409..a7fff371ae 100644 --- a/src/common/ieee802_11_common.c +++ b/src/common/ieee802_11_common.c @@ -283,6 +283,10 @@ static int ieee802_11_parse_extension(const u8 *pos, size_t elen, elems->oci = pos; elems->oci_len = elen; break; + case WLAN_EID_EXT_SHORT_SSID_LIST: + elems->short_ssid_list = pos; + elems->short_ssid_list_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 9b045b41a3..5b44e8cddf 100644 --- a/src/common/ieee802_11_common.h +++ b/src/common/ieee802_11_common.h @@ -95,6 +95,7 @@ struct ieee802_11_elems { const u8 *multi_ap; const u8 *he_capabilities; const u8 *he_operation; + const u8 *short_ssid_list; u8 ssid_len; u8 supp_rates_len; @@ -145,6 +146,7 @@ struct ieee802_11_elems { u8 multi_ap_len; u8 he_capabilities_len; u8 he_operation_len; + u8 short_ssid_list_len; struct mb_ies_info mb_ies; }; diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h index 30d81dade4..b9136d3d7a 100644 --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h @@ -470,6 +470,7 @@ #define WLAN_EID_EXT_HE_MU_EDCA_PARAMS 38 #define WLAN_EID_EXT_SPATIAL_REUSE 39 #define WLAN_EID_EXT_OCV_OCI 54 +#define WLAN_EID_EXT_SHORT_SSID_LIST 58 /* Extended Capabilities field */ #define WLAN_EXT_CAPAB_20_40_COEX 0