From patchwork Sat Jul 4 08:12:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Bauer X-Patchwork-Id: 1322726 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:1231::1; helo=merlin.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=david-bauer.net 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=merlin.20170209 header.b=E3UZ0EOv; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (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 49zPkC4dfbz9sRN for ; Sat, 4 Jul 2020 18:14:09 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; 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=MVO132p0f5WbSe3qtVp/D6d9zbDEg3So1pllHqe3lz8=; b=E3UZ0EOveIl9jbF41whUA9OR3v NOMNEzj5BTQsRkTHRT0VuwVhXgpPsILRRuI0GKVBYOqI902H7WTj+YwYMtCDoyJuSzUJOjXWbCKxW 86wkafX4yT2w3CIMgUhwFm0n80PYJTRmdddU3Gvdq3hJVKquusliE49N+Sx3yJ+pvwJbKKr+lNPQ9 rCDyzAZsRtiQTUJ2EMT28OnnUhBLBN2tOJ1gk3wXMC/3GtQ8yeasNAn1qxDDLpn4sincn8YlHlLxP CUFwjSWcgCxl1g+k/X0ezHZj0LqLGKaYTf7nkweSj9fP7Y5w6iI6EWkHaBN4iWw1bDRtW7OoyB5Hl ahcfVXkA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jrdHp-0003Wc-JO; Sat, 04 Jul 2020 08:12:37 +0000 Received: from mars.blocktrron.ovh ([2001:41d0:401:3000::cbd] helo=mail.blocktrron.ovh) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jrdHm-0003WG-7a for hostap@lists.infradead.org; Sat, 04 Jul 2020 08:12:35 +0000 Received: from dbauer-t470.home.david-bauer.net (p200300e53f2bcf006892e1a16bea427c.dip0.t-ipconnect.de [IPv6:2003:e5:3f2b:cf00:6892:e1a1:6bea:427c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.blocktrron.ovh (Postfix) with ESMTPSA id 57E41229BA for ; Sat, 4 Jul 2020 10:12:31 +0200 (CEST) From: David Bauer To: hostap@lists.infradead.org Subject: [PATCH] DFS: enter DFS state if no available channel is found Date: Sat, 4 Jul 2020 10:12:21 +0200 Message-Id: <20200704081221.85554-1-mail@david-bauer.net> 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-20200704_041234_416367_96B24241 X-CRM114-Status: GOOD ( 14.27 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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.29 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 Previously hostapd would not stop transmitting when a DFS event was detected and no available channel to switch to was available. Disable and re-enable the interface to enter DFS state. This way, TX does not happen until the kernel notifies hostapd about the NOP expiring. Signed-off-by: David Bauer --- src/ap/dfs.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ap/dfs.c b/src/ap/dfs.c index 3c078b9cb..9dddca338 100644 --- a/src/ap/dfs.c +++ b/src/ap/dfs.c @@ -1066,8 +1066,16 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface) &oper_centr_freq_seg0_idx, &oper_centr_freq_seg1_idx, &skip_radar); - if (!channel) - return err; + if (!channel) { + /* + * Toggle interface state to enter DFS state + * until NOP is finished. + */ + hostapd_disable_iface(iface); + hostapd_enable_iface(iface); + return 0; + } + if (!skip_radar) { iface->freq = channel->freq; iface->conf->channel = channel->chan;