From patchwork Thu Mar 21 14:33:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 1060197 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=candelatech.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="fn6Maeie"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=candelatech.com header.i=@candelatech.com header.b="AkdDEfaL"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44Q8Rb2Qlwz9sQy for ; Fri, 22 Mar 2019 01:33:47 +1100 (AEDT) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=4ajwfXxgPHqUoLvM9FbKJs99HKs+BFqoc4V6oVVyCUI=; b=fn6 MaeieraSTHw+sGhZyO7mF0T4Iz2aqE2AHFfxVUJhq98EB5m86rPpn7DbQZ19UWnwzrVgRtF2+BblE B5BTDO1DfuwKKeBa2yf5DVQnPOf5HKKaoBHOnjznzGmgGLZZfXBqLndDAL2KdGP64o2qqMns7JwoW ytKRx9Fi9KoISF4hSqS4CtthyW5jmSlYYOSBOXIebEE0h3eYHU5X9z0CWQYS8meQmViZVrQ8h4Wao x5Wl6T+DsCLtkqdzrY7Zzv0zFcrTx/Fe2lD4BhucHY8oKo6pObt90FEOVw6jpAz0LUd3MMrwBIg+P CEuMZDrmggJ/rk8cYFo+b1roLb/O3KA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h6ylA-0000sE-Ec; Thu, 21 Mar 2019 14:33:32 +0000 Received: from [208.74.158.174] (helo=mail3.candelatech.com) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h6yl7-0000ra-8N for hostap@lists.infradead.org; Thu, 21 Mar 2019 14:33:30 +0000 Received: from v-f24-64.candelatech.com (50-251-239-81-static.hfc.comcastbusiness.net [50.251.239.81]) by mail3.candelatech.com (Postfix) with ESMTP id 658C6114B57; Thu, 21 Mar 2019 07:33:28 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 mail3.candelatech.com 658C6114B57 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=candelatech.com; s=default; t=1553178808; bh=HR2weARutV2J4XS/JJz7lOt9Rad5OQYadAQJ00lOZns=; h=From:To:Cc:Subject:Date:From; b=AkdDEfaLWQEL9y+7tk9COVt5Hjq/sKb745q74+pCxqfk2ZwTsZCs0aXY9+cyT/o+Q 8CM+2W3tMIS7R+XZokDBymDMX0Nj3v3j+xtX2kC0XnFvBh7PDwvPfY2LJglj9cinNc ZcREFBgIUN4tmAiDCxm6074ItmtHhMtTrrZD3lQI= From: greearb@candelatech.com To: hostap@lists.infradead.org Subject: [PATCH 1/2] rrm: Use helper method to create neigh report ies Date: Thu, 21 Mar 2019 07:33:25 -0700 Message-Id: <1553178806-28307-1-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 2.7.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190321_073329_342704_A2E95ECB X-CRM114-Status: UNSURE ( 9.59 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 1.1 (+) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (1.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches 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.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ben Greear MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Ben Greear This way we can call it from elsewhere as needed. Should be no functional change. Signed-off-by: Ben Greear --- src/ap/rrm.c | 50 +++++++++++++++++++++++++++++--------------------- src/ap/rrm.h | 3 +++ 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/src/ap/rrm.c b/src/ap/rrm.c index f2d5cd1..117f631 100644 --- a/src/ap/rrm.c +++ b/src/ap/rrm.c @@ -195,36 +195,21 @@ static size_t hostapd_neighbor_report_len(struct wpabuf *buf, return len; } - -static void hostapd_send_nei_report_resp(struct hostapd_data *hapd, - const u8 *addr, u8 dialog_token, - struct wpa_ssid_value *ssid, u8 lci, - u8 civic, u16 lci_max_age) +void hostapd_rrm_add_neigh_report_ies(struct hostapd_data *hapd, + struct wpabuf *buf, struct wpa_ssid_value *ssid, + u8 lci, u8 civic, u16 lci_max_age) { struct hostapd_neighbor_entry *nr; - struct wpabuf *buf; u8 *msmt_token; - /* - * The number and length of the Neighbor Report elements in a Neighbor - * Report frame is limited by the maximum allowed MMPDU size; + 3 bytes - * of RRM header. - */ - buf = wpabuf_alloc(3 + IEEE80211_MAX_MMPDU_SIZE); - if (!buf) - return; - - wpabuf_put_u8(buf, WLAN_ACTION_RADIO_MEASUREMENT); - wpabuf_put_u8(buf, WLAN_RRM_NEIGHBOR_REPORT_RESPONSE); - wpabuf_put_u8(buf, dialog_token); - 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) + if (ssid && + (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); @@ -268,6 +253,29 @@ static void hostapd_send_nei_report_resp(struct hostapd_data *hapd, *msmt_token = civic; } } +} + +static void hostapd_send_nei_report_resp(struct hostapd_data *hapd, + const u8 *addr, u8 dialog_token, + struct wpa_ssid_value *ssid, u8 lci, + u8 civic, u16 lci_max_age) +{ + struct wpabuf *buf; + + /* + * The number and length of the Neighbor Report elements in a Neighbor + * Report frame is limited by the maximum allowed MMPDU size; + 3 bytes + * of RRM header. + */ + buf = wpabuf_alloc(3 + IEEE80211_MAX_MMPDU_SIZE); + if (!buf) + return; + + wpabuf_put_u8(buf, WLAN_ACTION_RADIO_MEASUREMENT); + wpabuf_put_u8(buf, WLAN_RRM_NEIGHBOR_REPORT_RESPONSE); + wpabuf_put_u8(buf, dialog_token); + + hostapd_rrm_add_neigh_report_ies(hapd, buf, ssid, lci, civic, lci_max_age); hostapd_drv_send_action(hapd, hapd->iface->freq, 0, addr, wpabuf_head(buf), wpabuf_len(buf)); diff --git a/src/ap/rrm.h b/src/ap/rrm.h index 02cd522..b507a8d 100644 --- a/src/ap/rrm.h +++ b/src/ap/rrm.h @@ -29,5 +29,8 @@ int hostapd_send_beacon_req(struct hostapd_data *hapd, const u8 *addr, void hostapd_rrm_beacon_req_tx_status(struct hostapd_data *hapd, const struct ieee80211_mgmt *mgmt, size_t len, int ok); +void hostapd_rrm_add_neigh_report_ies(struct hostapd_data *hapd, + struct wpabuf *buf, struct wpa_ssid_value *ssid, + u8 lci, u8 civic, u16 lci_max_age); #endif /* RRM_H */