From patchwork Thu Mar 28 13:06:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 1917339 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=E6OJqnGm; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=sipsolutions.net header.i=@sipsolutions.net header.a=rsa-sha256 header.s=mail header.b=rcaHju1F; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V53jk4v1Jz23sY for ; Fri, 29 Mar 2024 00:07:38 +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:References:In-Reply-To: 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: List-Owner; bh=+MwJHWVqde/KBAOMeQ5LBmW3oDwK8AAiH9vBIt6UuF4=; b=E6OJqnGmSgH8O2 Z7KOdrpJVVEyC3pvj6NnJhMikzGZ+wfws/iQhb4FJhTzCix4Fais0Lq9QQwmSZmyO0AoYmjy6MLqd 3lrXLPx5fhTi1TMrgutWFoKx6BKffbrbWuZE7OTKy5xSQwtFLtcD/yFKrDtYUtghr3JbIeeqnIWOc naDWEVaqnZVeIUK1eFFMBvEEH6mCExIdE333rKJbRPEmk9F7lGm9wYxLXagqZfpgv6cVdm6TX1KQ0 5JBNiD4xuvo3kZLCzQbNdun82MJEtLlCEGtzLkJjv1qNB/eRErZ8uNVNtvl5GQ/Xc39oVoQEgVl+E vehnc6Cipxzf6QtMY8Hg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rppTJ-0000000E2bJ-0Skg; Thu, 28 Mar 2024 13:07:09 +0000 Received: from s3.sipsolutions.net ([2a01:4f8:242:246e::2] helo=sipsolutions.net) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rppTF-0000000E2Y2-1HvD for hostap@lists.infradead.org; Thu, 28 Mar 2024 13:07:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=05q5FKxGIAAYaqHhMm88cFExMaQFuvYFzmi8CV17m8E=; t=1711631223; x=1712840823; b=rcaHju1FVrDDMq/1IE/7+5WdH0yqel9y71jGMujCP9AaDhJ alqh1YD8HmS1YIZJpayLXG3LISfYQIcTT6ywx7/JICbbaRfJoYKNg8ZG8XeajWKdFXjcGTam8DrKx /Do6LwV5tGh7VVFnLGmBynFfL88RxzStu/7NxwCz1mkPkLEQnGiKTXQK8j5F5KwZ6B+mA6pRhHeQ7 u9luyHbZ9hhgxfTlmxLqpFyBF3wX9jBFh/hueeWwwT7e5SWEmitNgE/q3siVCU3RPD+BSJFB4xyOf IsIP5Sd0MpwBsHaaflCYcoyeAS9y7DOnTID06g3G4sJeSbro4ICyYWQpD7odKtig==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1rppTB-00000000zBF-08aG; Thu, 28 Mar 2024 14:07:01 +0100 From: Johannes Berg To: hostap@lists.infradead.org Cc: Johannes Berg Subject: [PATCH 2/3] tests: add connecting-while-CSA tests Date: Thu, 28 Mar 2024 14:06:59 +0100 Message-ID: <20240328140657.16968637737e.I343be2981d629fb765485433459f24c7944da408@changeid> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240328140657.c09d8b9b6542.I8fda4243e4210c203472f3d40953575428fbdd04@changeid> References: <20240328140657.c09d8b9b6542.I8fda4243e4210c203472f3d40953575428fbdd04@changeid> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240328_060705_418721_D28D15E4 X-CRM114-Status: GOOD ( 11.68 ) X-Spam-Score: -0.2 (/) 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: From: Johannes Berg Add a few tests to validate what happens with connections while an AP is doing CSA: - quiet to diff channel (shouldn't connect) - quiet to same channel (shouldn't connect) - non-quiet to diff channel [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -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.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: Johannes Berg Add a few tests to validate what happens with connections while an AP is doing CSA: - quiet to diff channel (shouldn't connect) - quiet to same channel (shouldn't connect) - non-quiet to diff channel (shouldn't connect) - non-quiet to same channel (should connect) Signed-off-by: Johannes Berg --- tests/hwsim/test_ap_csa.py | 63 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/tests/hwsim/test_ap_csa.py b/tests/hwsim/test_ap_csa.py index c9ac73291a21..f05eaf1d7ecd 100644 --- a/tests/hwsim/test_ap_csa.py +++ b/tests/hwsim/test_ap_csa.py @@ -193,3 +193,66 @@ def test_ap_csa_disable(dev, apdev): ap.enable() dev[0].wait_disconnected() dev[0].wait_connected() + +def _assoc_while_csa(dev, apdev, freq_to, blocktx): + params = { + "ssid": "ap-csa", + "hw_mode": "a", + "country_code": "FI", + "channel": "36", + "ieee80211n": "0", + } + ap = hostapd.add_ap(apdev[0], params) + count = 100 if blocktx else 20 + delay = 1 + count / 10 + cmd = f"CHAN_SWITCH {count} {freq_to}" + if blocktx: + cmd += " blocktx" + ap.request(cmd) + + ev = ap.wait_event(["CTRL-EVENT-STARTED-CHANNEL-SWITCH"], timeout=10) + if ev is None: + raise Exception("Channel switch start event not seen") + if f"freq={freq_to}" not in ev: + raise Exception("Unexpected channel in CS started event") + try: + dev[0].connect("ap-csa", key_mgmt="NONE", scan_freq="5180", + wait_connect=False) + if blocktx or freq_to != 5180: + ev = dev[0].wait_event(["CTRL-EVENT-SSID-TEMP-DISABLED", + "CTRL-EVENT-CONNECTED"], timeout=9) + if not ev: # this is fine, at least we didn't connect + return + if not "CTRL-EVENT-SSID-TEMP-DISABLED" in ev: + raise Exception("Erroneously connected!") + if not 'auth_failures=1' in ev: + raise Exception(f'Should have auth failures in "{ev}"') + # wait for CSA to finish and connect then + time.sleep(delay) + dev[0].connect("ap-csa", key_mgmt="NONE", scan_freq=str(freq_to)) + else: + dev[0].wait_connected() + if freq_to != 5180: + wait_channel_switch(dev[0], freq_to) + finally: + dev[0].request("DISCONNECT") + clear_regdom(ap, dev) + +@long_duration_test +def test_assoc_while_csa_same_blocktx(dev, apdev): + "Check we don't associate while AP is doing quiet CSA (same channel)" + _assoc_while_csa(dev, apdev, 5180, True) + +def test_assoc_while_csa_same(dev, apdev): + "Check we _do_ associate while AP is doing CSA (same channel)" + _assoc_while_csa(dev, apdev, 5180, False) + +@long_duration_test +def test_assoc_while_csa_diff_blocktx(dev, apdev): + "Check we don't associate while AP is doing quiet CSA (different channel)" + _assoc_while_csa(dev, apdev, 5200, True) + +@long_duration_test +def test_assoc_while_csa_diff(dev, apdev): + "Check we don't associate while AP is doing CSA (different channel)" + _assoc_while_csa(dev, apdev, 5200, False)