diff mbox series

tests: kernel: add test for regulatory disconnect

Message ID 20230616222644.b01f16693ab7.Iab2bb00a77131397f34fec257b947a4fd69027c3@changeid
State Accepted
Headers show
Series tests: kernel: add test for regulatory disconnect | expand

Commit Message

Johannes Berg June 16, 2023, 8:26 p.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

Add a test for regulatory disconnect, since that was broken
for quite a while in various ways.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
Note that this still requires two upstream patches:
https://patchwork.kernel.org/project/linux-wireless/list/?series=758008&state=%2A&archive=both

---
 tests/hwsim/test_kernel.py | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

Comments

Jouni Malinen Dec. 6, 2023, 11:02 a.m. UTC | #1
On Fri, Jun 16, 2023 at 10:26:44PM +0200, Johannes Berg wrote:
> Add a test for regulatory disconnect, since that was broken
> for quite a while in various ways.

Thanks, applied.
diff mbox series

Patch

diff --git a/tests/hwsim/test_kernel.py b/tests/hwsim/test_kernel.py
index d0c4faec9da4..d8bb3fb8b3c5 100644
--- a/tests/hwsim/test_kernel.py
+++ b/tests/hwsim/test_kernel.py
@@ -8,10 +8,11 @@ 
 
 import hostapd
 import binascii
-import os
+import os, time
 import struct
 from test_wnm import expect_ack
 from tshark import run_tshark
+from utils import clear_regdom, long_duration_test
 
 def _test_kernel_bss_leak(dev, apdev, deauth):
     ssid = "test-bss-leak"
@@ -126,3 +127,24 @@  def test_kernel_unknown_action_frame_rejection_sta(dev, apdev, params):
         raise Exception("Unexpected Action frame rejection: " + str(categ))
     if 0xf0 not in categ or 0xf4 not in categ:
         raise Exception("Action frame rejection missing: " + str(categ))
+
+@long_duration_test
+def test_kernel_reg_disconnect(dev, apdev):
+    """Connect and force disconnect via regulatory"""
+    hapd = None
+    try:
+        ssid = "test-reg-disconnect"
+        passphrase = 'qwertyuiop'
+        params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase)
+        params["country_code"] = "DE"
+        params["hw_mode"] = "b"
+        params["channel"] = "13"
+        hapd = hostapd.add_ap(apdev[0], params)
+        dev[0].set("country", "DE")
+        dev[0].connect(ssid, psk=passphrase, scan_freq="2472")
+        dev[0].set("country", "US")
+        time.sleep(61)
+        dev[0].wait_disconnected(error="no regulatory disconnect")
+    finally:
+        dev[0].request("DISCONNECT")
+        clear_regdom(hapd, dev)