From patchwork Thu Mar 21 14:33:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 1060198 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="XG2Aw28l"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=candelatech.com header.i=@candelatech.com header.b="HKUcz8eO"; 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 44Q8Rb3G5mz9sRG 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: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=iEXeHu5q97MPh4OoH9IZqRhWnGQibvpm/TJ740rNcSU=; b=XG2Aw28l+qr+phzqmtDdncPFdx 2IMq0wepALASobuulNnTrjEN+ikWrSc0LzCxCK5nNJpOGvmB2C5NQVdhi3F9DQNIO32wxfkn9cHcW ak0OCSMWd+wfHF/1MaPR9GXHCUPLqhMDjS1hYIs3R9igL5dlVSn0wT0ODpbYGY53TBdksFNCazTs7 RhqQXDYJ5UCLytpWyDf34NxQ8ovcPH30GIu66ZzdglK4MoqgDt76G1GtGKjFgvdSwvf20n7MdDx59 mpb1u9xmjBtxclcJ8xjGqq2+9uZntmvcGK5tjRkxUL0SFpLJFRQrdR62+fvnEf22BucTgjxDhhQj5 AjWoSH8Q==; 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 1h6ylD-0000uZ-Cv; Thu, 21 Mar 2019 14:33:35 +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-0000rk-PR for hostap@lists.infradead.org; Thu, 21 Mar 2019 14:33:31 +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 72257114B5A; Thu, 21 Mar 2019 07:33:29 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 mail3.candelatech.com 72257114B5A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=candelatech.com; s=default; t=1553178809; bh=O89z/3s3C7nNDYPCjE/R+NV/xaMWMPWzLwzQfm+erkE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HKUcz8eOZp/aUx4/hMt8l4BohHcZwJ/0wHLLRAuF1dBULImQfUSL15k89UdCfVJ3x luiD/yamRnE+7+AeFGHho9Kj4unU5RiF2EVSq17v+qN36dvXS6cTfimt5tDo0C00De 3yMJbjkXLqPTyPB71Chsh2haWG+Z4RXnoa7fDAhI= From: greearb@candelatech.com To: hostap@lists.infradead.org Subject: [PATCH 2/2] wnm: Add neigh ies to bss transition mgt request Date: Thu, 21 Mar 2019 07:33:26 -0700 Message-Id: <1553178806-28307-2-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 2.7.5 In-Reply-To: <1553178806-28307-1-git-send-email-greearb@candelatech.com> References: <1553178806-28307-1-git-send-email-greearb@candelatech.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190321_073329_845796_0ED045A7 X-CRM114-Status: GOOD ( 10.91 ) 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 If a station requests a bss transition, then send add any configured neighbors to the response. Signed-off-by: Ben Greear --- src/ap/wnm_ap.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/ap/wnm_ap.c b/src/ap/wnm_ap.c index 27c69d3..cef44ce 100644 --- a/src/ap/wnm_ap.c +++ b/src/ap/wnm_ap.c @@ -345,8 +345,9 @@ static int ieee802_11_send_bss_trans_mgmt_request(struct hostapd_data *hapd, size_t len; u8 *pos; int res; + struct wpabuf *buf; - mgmt = os_zalloc(sizeof(*mgmt)); + mgmt = os_zalloc(IEEE80211_MAX_MMPDU_SIZE); if (mgmt == NULL) return -1; os_memcpy(mgmt->da, addr, ETH_ALEN); @@ -357,11 +358,33 @@ static int ieee802_11_send_bss_trans_mgmt_request(struct hostapd_data *hapd, mgmt->u.action.category = WLAN_ACTION_WNM; mgmt->u.action.u.bss_tm_req.action = WNM_BSS_TRANS_MGMT_REQ; mgmt->u.action.u.bss_tm_req.dialog_token = dialog_token; + /* set 0x1 flag for prefered candidate list included. + * see: 9.6.14.9 BSS Transition Management Request frame format + */ mgmt->u.action.u.bss_tm_req.req_mode = 0; mgmt->u.action.u.bss_tm_req.disassoc_timer = host_to_le16(0); mgmt->u.action.u.bss_tm_req.validity_interval = 1; pos = mgmt->u.action.u.bss_tm_req.variable; + buf = wpabuf_alloc(IEEE80211_MAX_MMPDU_SIZE - sizeof(*mgmt)); + if (buf) { + /* Grab neighbor list */ + /* TODO: Maybe round-robin and only send one? + * Or take load into consideration? + * Maybe we should skip our own entry? + */ + int lci = 1; /* add lci sub-element */ + int civic = 1; /* add civic sub-element */ + int lci_age = 0xffff; /* maximum age, send all */ + hostapd_rrm_add_neigh_report_ies(hapd, buf, NULL, lci, civic, lci_age); + if (wpabuf_len(buf)) { + mgmt->u.action.u.bss_tm_req.req_mode = 0x1; + os_memcpy(pos, wpabuf_head(buf), wpabuf_len(buf)); + pos += wpabuf_len(buf); + } + wpabuf_free(buf); + } + wpa_printf(MSG_DEBUG, "WNM: Send BSS Transition Management Request to " MACSTR " dialog_token=%u req_mode=0x%x disassoc_timer=%u " "validity_interval=%u",