From patchwork Sat Oct 3 12:00:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Dziedzic X-Patchwork-Id: 1376254 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=fail (p=none dis=none) header.from=gmail.com 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=eMkNuZ2x; 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=YAS4SyjR; 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 4C3QSH2XMtz9ryj for ; Sat, 3 Oct 2020 22:01:19 +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: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=tQUvaO+W6dQClzhPqeP3N+8jpYK3SKWpNien87mg4VU=; b=eMkNuZ2xCv4iHQ27lZCYutYL0y OvzyPu10r3nbIIVItqcUf0CcdMneH7o6OzSrq7x2cbuk8rEAuwwPFdW5SP04cSAFyrVBtLuOWSWgT BlvL/ZHIVyur9G2sggrzjQJ8XL+yqeCngNvx/VR7ZykSB+clfCjTZguqwAiAMUN0P23I7oGU1I0nd Q9RxWjCN8vtku81cMu16i7jFuvHjup99S7WRdiFd08SFJ4wlJDtPyOM6bJKu18Gd1utlAO41NcFTb 449PQPgNOU7jQ8ww1Wn/6pudAsyqhrAv1MxRwn7Y0Eq1UBUG8VRe0V69iH8BPslSO1Q6MG7B+YrEN XrxFXkhw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kOgDC-00022Y-KE; Sat, 03 Oct 2020 12:00:26 +0000 Received: from mail-lf1-x142.google.com ([2a00:1450:4864:20::142]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kOgD9-0001zr-DF for hostap@lists.infradead.org; Sat, 03 Oct 2020 12:00:24 +0000 Received: by mail-lf1-x142.google.com with SMTP id r127so611181lff.12 for ; Sat, 03 Oct 2020 05:00:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=gOqz5khC6jjbZu7nFu511+ldl04lTql61NxhLey2DdY=; b=YAS4SyjRrZ7tVZwY5gA6TVol0yJ86fruhkvbc3JNXQg7jFOjp6RvP6pDKXspGKLino G3z/OxgQJ5aQy72pb0PIvOt2F2RirjPePmc5X0io6VmTN+7Ld6r3p8eeufj1C6aorHBB YDAC47L8/kFIb40LogtVrM3R2rdIlseO+jIpM6v8Scx+qvUu1FVm6St14MD1JtV81uUc /C5FeWxKVH8mqVkAgd3Ou3PBGBGuTSq0DlRLs1rMpQkzzMnRht90dfYBw298sqGmeJer ZMRfBETMqZUjglEHUySoevRhm08HoSV4B0zKGg6zgiL4DKuaY6BoYPxn4zZC3TvvQdn6 scBA== 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; bh=gOqz5khC6jjbZu7nFu511+ldl04lTql61NxhLey2DdY=; b=fhBQ3mbwaUOEC17MHUvkE/tpo4C3uvR5sUZsXisNeo4G2OG13cTIbV8NXj3VcCb4aV 03IeeLWFKygdlW/P4L4EC2E1gwo8RCqRwL9KzlQWsbkl3LVBhwtIdVO5oTgSe8/7qh+c j8RDt2By7uTHj4Z+HU1X8XT3r7cY2qcoXbkhqrjMMCJqpt+x3f0kdcZldmCWBZFGgbCq QPaZO0/hJsB53rpZ06cL/mhkDEVqL/KKQ+YmMKUND228Udh7fsdDIi+nYbJ9OwejzJcI lmRBnugomQtacMV/UvZ1AnJUrBl0DVheRyN+smixdcTJhlNOZ/x5avR9WyZpMkNm4ftl 1LIA== X-Gm-Message-State: AOAM531QGq0Jr3DkPQtXphFHtS1khdtZnwlg/Ktr5zTaGdBXCZQshYfG la+2/L99Mplc/rbUvBpOAN4XbWrLORo= X-Google-Smtp-Source: ABdhPJxADemXFPGmcs+pouF7Lgdx91lWFHL+xG2YwrxMo9UrLYK5fNuUcgf/dVa4qnakL/OZmO2u6Q== X-Received: by 2002:a05:6512:3222:: with SMTP id f2mr591844lfe.268.1601726420703; Sat, 03 Oct 2020 05:00:20 -0700 (PDT) Received: from localhost.localdomain ([62.141.212.102]) by smtp.gmail.com with ESMTPSA id s20sm1479951lfs.135.2020.10.03.05.00.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 05:00:20 -0700 (PDT) From: Janusz Dziedzic To: hostap@lists.infradead.org Subject: [PATCH 1/2] hostapd: dfs: allow switch to available channel Date: Sat, 3 Oct 2020 14:00:12 +0200 Message-Id: <20201003120013.19160-1-janusz.dziedzic@gmail.com> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201003_080023_534478_1DB008A0 X-CRM114-Status: GOOD ( 10.91 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:142 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [janusz.dziedzic[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 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: , Cc: j@w1.fi, Janusz Dziedzic MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org For EU, where preCAC is allowed, we should allow switch to DFS available channels, instead of restart BSS. Signed-off-by: Janusz Dziedzic --- src/ap/dfs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ap/dfs.c b/src/ap/dfs.c index 3c078b9cb..a19b8f164 100644 --- a/src/ap/dfs.c +++ b/src/ap/dfs.c @@ -1332,12 +1332,15 @@ int hostapd_is_dfs_overlap(struct hostapd_iface *iface, enum chan_width width, if (!(chan->flag & HOSTAPD_CHAN_RADAR)) continue; + if ((chan->flag & HOSTAPD_CHAN_DFS_MASK) == HOSTAPD_CHAN_DFS_AVAILABLE) + continue; + if (center_freq - chan->freq < half_width && chan->freq - center_freq < half_width) res++; } - wpa_printf(MSG_DEBUG, "DFS: (%d, %d): in range: %s", + wpa_printf(MSG_DEBUG, "DFS CAC required: (%d, %d): in range: %s", center_freq - half_width, center_freq + half_width, res ? "yes" : "no"); From patchwork Sat Oct 3 12:00:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Dziedzic X-Patchwork-Id: 1376253 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=fail (p=none dis=none) header.from=gmail.com 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=RA1ChpRJ; 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=TYoMlQUy; 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 4C3QSD16XSz9ryj for ; Sat, 3 Oct 2020 22:01:16 +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: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=jz6Nx7m2M6hUjnk5iiJt3BXQqslxP6QEJNIeyyC2d2M=; b=RA1ChpRJHkHV/4yIQobZsR/P/B wP+ryoSdItrwDeeL+wsg7XbJVnjqgnWYD7SEt+rewVIZmvl4OnsrJewsTXM1y6t+w+uzwFwji6sRY xCuHyk6lI8RxRBcc6ryL6pg6+3VK725rRwRwhy7K/LbKHM+YoH/JlLPPC59jmUi01JHOdaL+dNk29 mCM8+povahhwjRslNsjq6c5O/alHAOF5gayNHcEIjXBHv2NOJZ3fcBggOPvZ3r9kC0e1RIyvuEtVH PnWoa3ZYsOpeCe504KhYldZ6bspreUOHiVgoUlwmwBWhks8LvVc0Ar5oumBSk29/VM7/XMlXBfOPg dZF0ZC3g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kOgDE-00022k-Aa; Sat, 03 Oct 2020 12:00:28 +0000 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kOgDA-00020Y-O1 for hostap@lists.infradead.org; Sat, 03 Oct 2020 12:00:25 +0000 Received: by mail-lj1-x234.google.com with SMTP id m16so1024993ljo.6 for ; Sat, 03 Oct 2020 05:00:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hGGEdz9Kd5owS/xwWJLXdRvJJ8legq+1zDhZGMUQJ48=; b=TYoMlQUy/ZGXjSSd1P5mWADWRiUBsEGNmlVS3GCHhqKksu7BCZGPgw01MQrFwQxSBL cWMBY8oUBnjMOjBEQmiDe6/304T60fyQc9yFd+aW55laPCCmLBO07OLYDHqx03lygrHj BD3kX4oujAxtXTavgTp2qKPPEj89jQBRQgs9mTM7nQOTWLgEOzjW1QwZY0KW0eOPWEAA mLLDGgvJ+iiCk5Dv0BMRTWEfiRYtuPnS4sEnUjS6sHtHOxwC7MlJgDTSce52/t7Uc1rf aqrmZt5y627N1MGo2fK2A0/I7sIlS2pypGuQmwmw/c50aA95RzKmt3vW12faIlod0Hkq Duhw== 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:in-reply-to :references; bh=hGGEdz9Kd5owS/xwWJLXdRvJJ8legq+1zDhZGMUQJ48=; b=VmrC8z2+BivVdmPCylY8DEpJ5iIGbn+5LjJexnqLqU+DxzpURCi+vpANUq+WCzKSE9 k4qmAs14qxzk1UPRKiIJYP/aHEZxrCcEVOu6/ouxo79WfsEmgx2m6SGfO62+Q+8guG/s qMfwQQQ5tDMSqOFdfMKEviGJ7TyopQf2rPZlpRu9JiEqNZZFZ8ea5KGNgkAeMjMqNwgP 7o9KD23OTs6+k2yi0/XgLpsv2bxfQB1LHD+7fINKMebQR9P62/1/HQzjqwxu9EskQmu/ UN/msJh5otqeS/rmehZu1XFejVx7orEr9ONITD0gpdtyOMuW/Z12qs1kbDk13K0a11Oo lOWQ== X-Gm-Message-State: AOAM531cOFUwT/WnwLr21ITE2Tg9mhndhIAFtV8E9k6WDm+ctBKj+0Au BeBbarxOgW9j+cGsRjR1T6pDUdaYXCs= X-Google-Smtp-Source: ABdhPJzpQl+sYBKWsE7MDgLAwfA0eN9i0vkRiSO51N55KCKToS3AR6K04nVBNj5fWizAS7hZ2WmC+w== X-Received: by 2002:a2e:964b:: with SMTP id z11mr2038515ljh.364.1601726421880; Sat, 03 Oct 2020 05:00:21 -0700 (PDT) Received: from localhost.localdomain ([62.141.212.102]) by smtp.gmail.com with ESMTPSA id s20sm1479951lfs.135.2020.10.03.05.00.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 05:00:21 -0700 (PDT) From: Janusz Dziedzic To: hostap@lists.infradead.org Subject: [PATCH 2/2] tests: hwsim: add dfs_chan_switch_precac Date: Sat, 3 Oct 2020 14:00:13 +0200 Message-Id: <20201003120013.19160-2-janusz.dziedzic@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201003120013.19160-1-janusz.dziedzic@gmail.com> References: <20201003120013.19160-1-janusz.dziedzic@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201003_080024_806168_2F5E916A X-CRM114-Status: GOOD ( 12.11 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:234 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [janusz.dziedzic[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 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: , Cc: j@w1.fi, Janusz Dziedzic MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Add test case that will check preCAC, which is available for EU regulatory domain. Signed-off-by: Janusz Dziedzic --- tests/hwsim/test_dfs.py | 49 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/tests/hwsim/test_dfs.py b/tests/hwsim/test_dfs.py index 3efe6bb2d..8708125d1 100644 --- a/tests/hwsim/test_dfs.py +++ b/tests/hwsim/test_dfs.py @@ -652,3 +652,52 @@ def test_dfs_chan_switch(dev, apdev): hwsim_utils.test_connectivity(dev[0], hapd) finally: clear_regdom(hapd, dev) + +@long_duration_test +def test_dfs_chan_switch_precac(dev, apdev): + """DFS channel switch pre CAC""" + try: + hapd = None + + # Toggle regulatory - clean all preCAC + hostapd.cmd_execute(apdev[0], ['iw', 'reg', 'set', "US"]) + + hapd = start_dfs_ap(apdev[0], country="PL") + + ev = wait_dfs_event(hapd, "DFS-CAC-COMPLETED", 70) + if "success=1" not in ev: + raise Exception("CAC failed") + if "freq=5260" not in ev: + raise Exception("Unexpected DFS freq result") + ev = hapd.wait_event(["AP-ENABLED"], timeout=5) + if not ev: + raise Exception("AP setup timed out") + freq = hapd.get_status_field("freq") + if freq != "5260": + raise Exception("Unexpected frequency") + + # TODO add/connect station here + # Today skip this step while dev[0].connect() + # for some reason toggle regulatory to US + # and clean preCAC + + # Back to non DFS channel + if "OK" not in hapd.request("CHAN_SWITCH 5 5180 ht"): + raise Exception("CHAN_SWITCH 5180 failed") + + ev = hapd.wait_event(["AP-CSA-FINISHED"], timeout=5) + if not ev: + raise Exception("No CSA finished event - 5180") + freq = hapd.get_status_field("freq") + if freq != "5180": + raise Exception("Unexpected frequency") + + # Back again to DFS channel (CAC passed) + if "OK" not in hapd.request("CHAN_SWITCH 5 5260 ht"): + raise Exception("CHAN_SWITCH 5260 failed") + + ev = wait_dfs_event(hapd, "AP-CSA-FINISHED", 5) + if not ev: + raise Exception("No CSA finished event - 5260") + finally: + clear_regdom(hapd, dev)