From patchwork Wed Oct 6 00:21:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Bauer X-Patchwork-Id: 1536965 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=vbsxjqCG; 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 4HPFXZ6kbJz9s82 for ; Wed, 6 Oct 2021 11:22:54 +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: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:In-Reply-To:References: List-Owner; bh=o4sqkJULWl83XiTmLkeSijrhH/2Ps+keIl/i9OZ7hg4=; b=vbsxjqCGqu5vyc 1j0EoI3Q95NDDtRzQ0pYuCnDT4NlFK529zFV+SouRTDNHlqCuUlCu6MipnehtvjtjoxRyw/1fwqE4 466NocjtyLqDySqghuoY8EotqUSnzhqU7oIBeiF9WoONR6YFjHWct9AM87kPl6oXQCNwE3o6S9rTN VvSi6+vp9sB8DnmGyv+8z3sBYjzFULuKjbg1bMPqhOBbVsgSVoiSbacfnDLV2u9eMjNzRngXf4yTu HUk+FOvjFx0m1ZP3pvk501W8YLyCN+BasPUZiihqYXuDQEQuiWTjM2lqXTYOqv8wwTymyjfPENPT9 pC+2Vok5ivuSunAQDiNQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXuh8-00COXF-Tj; Wed, 06 Oct 2021 00:22:02 +0000 Received: from perseus.uberspace.de ([95.143.172.134]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXuh5-00COWj-SH for hostap@lists.infradead.org; Wed, 06 Oct 2021 00:22:01 +0000 Received: (qmail 22452 invoked from network); 6 Oct 2021 00:21:57 -0000 Received: from localhost (HELO localhost) (127.0.0.1) by perseus.uberspace.de with SMTP; 6 Oct 2021 00:21:57 -0000 From: David Bauer To: hostap@lists.infradead.org Subject: [PATCH] WNM: allow specifying dialog-token Date: Wed, 6 Oct 2021 02:21:46 +0200 Message-Id: <20211006002146.19804-1-mail@david-bauer.net> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211005_172200_230035_1D47802E X-CRM114-Status: GOOD ( 12.02 ) X-Spam-Score: -0.7 (/) 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: This commit adds the ability to specify the dialog token of a WNM BSS Transition request frame via the hostapd control socket. For this, the new 'dialog_token' option can be used. It accepts values as a 8 bit unsigned integer. If not specified, the dialog token is set to 1 like before. Content analysis details: (-0.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [95.143.172.134 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 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 This commit adds the ability to specify the dialog token of a WNM BSS Transition request frame via the hostapd control socket. For this, the new 'dialog_token' option can be used. It accepts values as a 8 bit unsigned integer. If not specified, the dialog token is set to 1 like before. Signed-off-by: David Bauer --- hostapd/ctrl_iface.c | 10 ++++++++-- src/ap/wnm_ap.c | 11 ++++++----- src/ap/wnm_ap.h | 4 ++-- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c index 4a2d60627..134f58cc1 100644 --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c @@ -840,7 +840,7 @@ static int hostapd_ctrl_iface_bss_tm_req(struct hostapd_data *hapd, const char *pos, *end; int disassoc_timer = 0; struct sta_info *sta; - u8 req_mode = 0, valid_int = 0x01; + u8 req_mode = 0, valid_int = 0x01, dialog_token = 0x01; u8 bss_term_dur[12]; char *url = NULL; int ret; @@ -878,6 +878,12 @@ static int hostapd_ctrl_iface_bss_tm_req(struct hostapd_data *hapd, valid_int = atoi(pos); } + pos = os_strstr(cmd, " dialog_token="); + if (pos) { + pos += 14; + dialog_token = atoi(pos); + } + pos = os_strstr(cmd, " bss_term="); if (pos) { pos += 10; @@ -984,7 +990,7 @@ static int hostapd_ctrl_iface_bss_tm_req(struct hostapd_data *hapd, #endif /* CONFIG_MBO */ ret = wnm_send_bss_tm_req(hapd, sta, req_mode, disassoc_timer, - valid_int, bss_term_dur, url, + valid_int, bss_term_dur, dialog_token, url, nei_len ? nei_rep : NULL, nei_len, mbo_len ? mbo : NULL, mbo_len); #ifdef CONFIG_MBO diff --git a/src/ap/wnm_ap.c b/src/ap/wnm_ap.c index d32967e6c..e17fe16d0 100644 --- a/src/ap/wnm_ap.c +++ b/src/ap/wnm_ap.c @@ -788,8 +788,8 @@ int wnm_send_ess_disassoc_imminent(struct hostapd_data *hapd, int wnm_send_bss_tm_req(struct hostapd_data *hapd, struct sta_info *sta, u8 req_mode, int disassoc_timer, u8 valid_int, - const u8 *bss_term_dur, const char *url, - const u8 *nei_rep, size_t nei_rep_len, + const u8 *bss_term_dur, u8 dialog_token, + const char *url, const u8 *nei_rep, size_t nei_rep_len, const u8 *mbo_attrs, size_t mbo_len) { u8 *buf, *pos; @@ -797,8 +797,9 @@ int wnm_send_bss_tm_req(struct hostapd_data *hapd, struct sta_info *sta, size_t url_len; wpa_printf(MSG_DEBUG, "WNM: Send BSS Transition Management Request to " - MACSTR " req_mode=0x%x disassoc_timer=%d valid_int=0x%x", - MAC2STR(sta->addr), req_mode, disassoc_timer, valid_int); + MACSTR " req_mode=0x%x disassoc_timer=%d valid_int=0x%x " + "dialog_token=%x", + MAC2STR(sta->addr), req_mode, disassoc_timer, valid_int, dialog_token); buf = os_zalloc(1000 + nei_rep_len + mbo_len); if (buf == NULL) return -1; @@ -810,7 +811,7 @@ int wnm_send_bss_tm_req(struct hostapd_data *hapd, struct sta_info *sta, os_memcpy(mgmt->bssid, hapd->own_addr, ETH_ALEN); 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 = 1; + mgmt->u.action.u.bss_tm_req.dialog_token = dialog_token; mgmt->u.action.u.bss_tm_req.req_mode = req_mode; mgmt->u.action.u.bss_tm_req.disassoc_timer = host_to_le16(disassoc_timer); diff --git a/src/ap/wnm_ap.h b/src/ap/wnm_ap.h index 1806ba0e0..f86c6b2af 100644 --- a/src/ap/wnm_ap.h +++ b/src/ap/wnm_ap.h @@ -20,8 +20,8 @@ int wnm_send_ess_disassoc_imminent(struct hostapd_data *hapd, int disassoc_timer); int wnm_send_bss_tm_req(struct hostapd_data *hapd, struct sta_info *sta, u8 req_mode, int disassoc_timer, u8 valid_int, - const u8 *bss_term_dur, const char *url, - const u8 *nei_rep, size_t nei_rep_len, + const u8 *bss_term_dur, u8 dialog_token, + const char *url, const u8 *nei_rep, size_t nei_rep_len, const u8 *mbo_attrs, size_t mbo_len); void ap_sta_reset_steer_flag_timer(void *eloop_ctx, void *timeout_ctx); int wnm_send_coloc_intf_req(struct hostapd_data *hapd, struct sta_info *sta,