From patchwork Wed Mar 3 09:53:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Micha=C5=82_Kazior?= X-Patchwork-Id: 1446788 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:1:d65d:64ff:fe57:4e05; helo=desiato.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) 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=desiato.20200630 header.b=iHhbAau3; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=casper.20170209 header.b=kLeeBD6H; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=b23Kqwkt; dkim-atps=neutral Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) (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 4DrN0B17kWz9sS8 for ; Thu, 4 Mar 2021 05:32:42 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; 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:Cc: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=Gcj2jlH2h94eiaIOJZF6gBpbd1yEnIVfBCMLAB72XlM=; b=iHhbAau3dts5Vsh6rxhsTQFRgF zCZsOXCzM+qqIimz8F24NxqtOokmw9glvL5XUdGD7HV/1ysQqG8Yd9c4a1wLFjjZlUBuRXX8PCFpF LMmdMruLKSpX3jgqsMoKxLrgTzAnlYIVN2p+eoJUFoCnpJghc2ZZfHcEVM7UNVxAPf73Rd3a8a8RV yOinEqlE2vIJIzcEOc2R0r24Wa30keNFyKyY0JLfKNEsddnU2hegxIsbIJV6pC2umJFr47UyvNQtV swRSG6roXrygtJN9kDSmEkYl4vqP5fXGXPSLbag7mbOxVz6SJwWdPTX57NXlMJHT3KCv0lB9gR1M6 WTbZyx7Q==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lHWHV-0061lB-Oo; Wed, 03 Mar 2021 18:31:34 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lHT0k-005H5x-Ve for hostap@desiato.infradead.org; Wed, 03 Mar 2021 15:02:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=EAaflXvS/Khfi2QxNqX1NfGPKJipZke8obRZ9mwGkHQ=; b=kLeeBD6HamYqicllQWhtl7NO1d ZVxIscIGMJU4fCQweO3o+aEXbtOe679VZOb1mEoW75u3u0TISIkPREyq+cdKPG7IGhqV9oWvyPJeu 8YPf6N411gcdGBcB+PA4HAc1WsWa/cdbfvKBEOkdSzIX6T2moX81YSGlkJwzJSa7gNLNM/bPeEyyQ NfIC+DycGMqe+2ffn87YINcDpaJx7Y/X2jj7D5DNMEJtQX8DaN0bKudd4SaBYYM2w9+h1sFdennJr yUKjE/OPicTr2sJKahUPGwbRtDqp5/1gX9xbIcyc4VckKiT4gtJh90sW8+hfwi0ag2QNndyrbzdOE NmFVSOmw==; Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by casper.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lHODO-0025Sh-0x for hostap@lists.infradead.org; Wed, 03 Mar 2021 09:54:49 +0000 Received: by mail-lf1-x135.google.com with SMTP id n16so19184672lfb.4 for ; Wed, 03 Mar 2021 01:54:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EAaflXvS/Khfi2QxNqX1NfGPKJipZke8obRZ9mwGkHQ=; b=b23KqwktT0GZi9qWyWoody2LZU9eO6KEr9KLF3eDf/GvgZMCqyozivPolHLlXYirlS xUculd7Tv4sn994S36Sh2ftP9UYqVdC9+36BTPbLjEmwcmdgW37yOr9PtmtQpGxEzX0k BwclMYqbftV+MbrlHp3/8Je1tPXm76x56i8DlirBIAQCuzwI2iu4/sGwZYYFn47ukUNl QpTefVoFo4YfHfSj2LTQR4WZKsfXZXZZGZyiiDrJT3L1Xd3CS1ay2HOEM2arV3XgC/7d engAA9hXQWYixbKMGBvPXRWVv1Oxy8UpNdbpTiwHcggQgzTCbZAkhuZqm+fn9gXvvmip zPqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EAaflXvS/Khfi2QxNqX1NfGPKJipZke8obRZ9mwGkHQ=; b=Bo+HC6pIRbxdDHB5+t9vOVXPokiVHzukCZbDKP7M8LeRi2yMMOrEnf8EHvsEZO7s9U U+b0P7aXWsLeQ3IOrpE64cR3sVoQ9nm5zK9WHwBHqaz5ElxL/7ISjJydni91yHH0g9bi coSKjM06o+EWycq+vUUXIDXUifDkOfEYBbDl7Uu34DlmzNL4ioY46HgEbIYdMQ1OZcXX edu6zZ7x/VzrClhamkSzsizZWpylICKiUbyfOLZZRtlq0tMnbqQBumTeAQXLZSgyhB6b Yo7l25f7AO1PB+l6x9Qf1MAukIEuhptwp2OZlGZQURXIiLRyni5VpM5Q2rXCbGrGuBt/ Fujw== X-Gm-Message-State: AOAM533uUvAC2bPFQ/soMBKFoAGfP+DSeWwT6fkxmbzn5uZqg6Nb5giR 2xIqGOBYAg+esBmAbygp22yfuydiYvM= X-Google-Smtp-Source: ABdhPJwSQg8oo1h29aNGbxg4xLYovT2E0bVyxF7yqlWt01XQinPvAE3XSxUKcCx/8wDDngO0iNkLPA== X-Received: by 2002:ac2:47e5:: with SMTP id b5mr14782293lfp.476.1614765222599; Wed, 03 Mar 2021 01:53:42 -0800 (PST) Received: from drun:home-michalkazior-docker-linux-alpine.pl.plumewifi.com ([2a03:4b00:0:4:692:26ff:fed9:4198]) by smtp.gmail.com with ESMTPSA id s29sm2248944ljo.136.2021.03.03.01.53.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 01:53:41 -0800 (PST) From: Michal Kazior To: hostap@lists.infradead.org Cc: Michal Kazior Subject: [PATCH] DPP: respond to GAS on the same channel it was received on Date: Wed, 3 Mar 2021 09:53:33 +0000 Message-Id: <20210303095333.8420-1-kazikcz@gmail.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210303_095449_532179_EF85F5BB X-CRM114-Status: GOOD ( 19.54 ) X-Spam-Note: SpamAssassin invocation failed 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 From: Michal Kazior When I was testing dpp_auth_init on an AP with Enrollee on a different channel from the AP I was getting failures. This happened on hwsim in UML with time-travel for me. I don't recall seeing this with real devices, presumably because of lax offchan implementation. The DPP authentication would succeed. However the station would then try to get configuration through a GAS request and fail. The AP reported the following logs (grepped): > 1614762426.860212: RX_ACTION category 4 action 10 sa 02:00:00:00:01:00 da 02:00:00:00:00:00 len 227 freq 2412 > 1614762426.860212: wlan0: GAS: GAS Initial Request from 02:00:00:00:01:00 (dialog token 239) > 1614762426.860233: DPP: Wait for Configuration Result > 1614762426.860234: nl80211: Send Action frame (ifindex=5, freq=2462 MHz wait=0 ms no_cck=0 offchanok=0) > 1614762428.861186: DPP: Timeout while waiting for Configuration Result > 1614762428.861186: wlan0: DPP-CONF-FAILED While the STA reported the following logs (grepped): > 1614762426.860193: wlan1: DPP-AUTH-SUCCESS init=0 > 1614762426.860195: DPP: Stop listen on 2412 MHz > 1614762426.860202: wlan1: GAS-QUERY-START addr=02:00:00:00:00:00 dialog_token=239 freq=2412 > 1614762428.861185: GAS: No response received for query to 02:00:00:00:00:00 dialog token 239 > 1614762428.861189: DPP: GAS query did not succeed > 1614762428.861189: wlan1: DPP-CONF-FAILED AP would still receive the GAS request on ch1 but would then try to respond on ch11 while STA was waiting on ch1. Signed-off-by: Michal Kazior --- I'm not sure if this is the right thing to do. And there seems to be more cases where APs freq is used instead of the GAS req freq that could potentially be updated. There's at least the GAS comeback case I don't handle here. This as-is does help with my hwsim test though. On one hand it seems perhaps the Enrollee should try to do GAS on the APs channel. But is it well equiped/informed to do so? I'm not familiar with the spec that much. On another hand backward compat could be a problem without this fix. Happy to dig more into this if needed. src/ap/dpp_hostapd.c | 2 +- src/ap/gas_serv.c | 11 ++++++----- src/ap/gas_serv.h | 3 ++- src/ap/ieee802_11.c | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/ap/dpp_hostapd.c b/src/ap/dpp_hostapd.c index e1e5a3ac4..c417b9172 100644 --- a/src/ap/dpp_hostapd.c +++ b/src/ap/dpp_hostapd.c @@ -2198,7 +2198,7 @@ static void hostapd_dpp_relay_gas_resp_tx(void *ctx, const u8 *addr, { struct hostapd_data *hapd = ctx; - gas_serv_req_dpp_processing(hapd, addr, dialog_token, prot, buf); + gas_serv_req_dpp_processing(hapd, addr, dialog_token, prot, buf, 0); } #endif /* CONFIG_DPP2 */ diff --git a/src/ap/gas_serv.c b/src/ap/gas_serv.c index 90f15778b..24183685b 100644 --- a/src/ap/gas_serv.c +++ b/src/ap/gas_serv.c @@ -1524,7 +1524,8 @@ static void gas_serv_req_local_processing(struct hostapd_data *hapd, #ifdef CONFIG_DPP void gas_serv_req_dpp_processing(struct hostapd_data *hapd, const u8 *sa, u8 dialog_token, - int prot, struct wpabuf *buf) + int prot, struct wpabuf *buf, + int freq) { struct wpabuf *tx_buf; @@ -1582,7 +1583,7 @@ void gas_serv_req_dpp_processing(struct hostapd_data *hapd, return; if (prot) convert_to_protected_dual(tx_buf); - hostapd_drv_send_action(hapd, hapd->iface->freq, 0, sa, + hostapd_drv_send_action(hapd, freq ?: hapd->iface->freq, 0, sa, wpabuf_head(tx_buf), wpabuf_len(tx_buf)); wpabuf_free(tx_buf); @@ -1593,7 +1594,7 @@ void gas_serv_req_dpp_processing(struct hostapd_data *hapd, static void gas_serv_rx_gas_initial_req(struct hostapd_data *hapd, const u8 *sa, const u8 *data, size_t len, int prot, - int std_addr3) + int std_addr3, int freq) { const u8 *pos = data; const u8 *end = data + len; @@ -1688,7 +1689,7 @@ static void gas_serv_rx_gas_initial_req(struct hostapd_data *hapd, data, len); if (!msg) return; - gas_serv_req_dpp_processing(hapd, sa, dialog_token, prot, msg); + gas_serv_req_dpp_processing(hapd, sa, dialog_token, prot, msg, freq); return; } #endif /* CONFIG_DPP */ @@ -1871,7 +1872,7 @@ static void gas_serv_rx_public_action(void *ctx, const u8 *buf, size_t len, switch (data[0]) { case WLAN_PA_GAS_INITIAL_REQ: gas_serv_rx_gas_initial_req(hapd, sa, data + 1, len - 1, prot, - std_addr3); + std_addr3, freq); break; case WLAN_PA_GAS_COMEBACK_REQ: gas_serv_rx_gas_comeback_req(hapd, sa, data + 1, len - 1, prot, diff --git a/src/ap/gas_serv.h b/src/ap/gas_serv.h index 1528af4af..523fe8e94 100644 --- a/src/ap/gas_serv.h +++ b/src/ap/gas_serv.h @@ -90,6 +90,7 @@ void gas_serv_deinit(struct hostapd_data *hapd); void gas_serv_req_dpp_processing(struct hostapd_data *hapd, const u8 *sa, u8 dialog_token, - int prot, struct wpabuf *buf); + int prot, struct wpabuf *buf, + int freq); #endif /* GAS_SERV_H */ diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index 1c01241bc..71245aad7 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -5973,7 +5973,7 @@ static int handle_action(struct hostapd_data *hapd, if (hapd->public_action_cb2) { hapd->public_action_cb2(hapd->public_action_cb2_ctx, (u8 *) mgmt, len, - hapd->iface->freq); + freq); } if (hapd->public_action_cb || hapd->public_action_cb2) return 1;