diff mbox series

[v2] hwsim: update misbehaving MBO AP test to include roam

Message ID 20210316201955.3246649-1-matthewmwang@chromium.org
State Accepted
Headers show
Series [v2] hwsim: update misbehaving MBO AP test to include roam | expand

Commit Message

Matthew Wang March 16, 2021, 8:19 p.m. UTC
APs PMF capabilities can differ. wpa_supplicant should be able to
disable and enable MBO when roaming to and from a misbehaving MBO AP
that doesn't support PMF.

Signed-off-by: Matthew Wang <matthewmwang@chromium.org>
---
 tests/hwsim/test_mbo.py | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

Comments

Jouni Malinen March 19, 2021, 7:32 p.m. UTC | #1
On Tue, Mar 16, 2021 at 01:19:55PM -0700, Matthew Wang wrote:
> APs PMF capabilities can differ. wpa_supplicant should be able to
> disable and enable MBO when roaming to and from a misbehaving MBO AP
> that doesn't support PMF.

Thanks, applied.
diff mbox series

Patch

diff --git a/tests/hwsim/test_mbo.py b/tests/hwsim/test_mbo.py
index 65d446b7ee2..532365f52ff 100644
--- a/tests/hwsim/test_mbo.py
+++ b/tests/hwsim/test_mbo.py
@@ -543,15 +543,32 @@  def test_mbo_without_pmf(dev, apdev):
 def test_mbo_without_pmf_workaround(dev, apdev):
     """MBO and WPA2 without PMF on misbehaving AP"""
     ssid = "test-wnm-mbo"
-    params = {'ssid': ssid, "wpa": '2',
+    params0 = {'ssid': ssid, "wpa": '2',
               "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
               "wpa_passphrase": "12345678",
               "vendor_elements": "dd07506f9a16010100"}
-    hapd = hostapd.add_ap(apdev[0], params)
+    params1 = {'ssid': ssid, "mbo": '1', "wpa": '2',
+              "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
+              "wpa_passphrase": "12345678", "ieee80211w": "1"}
+    hapd0 = hostapd.add_ap(apdev[0], params0)
     dev[0].connect(ssid, psk="12345678", key_mgmt="WPA-PSK",
                    proto="WPA2", ieee80211w="1", scan_freq="2412")
-    hapd.wait_sta()
-    sta = hapd.get_sta(dev[0].own_addr())
+    hapd0.wait_sta()
+    sta = hapd0.get_sta(dev[0].own_addr())
+    ext_capab = bytearray(binascii.unhexlify(sta['ext_capab']))
+    if ext_capab[2] & 0x08:
+        raise Exception("STA did not disable BSS Transition capability")
+    hapd1 = hostapd.add_ap(apdev[1], params1)
+    dev[0].scan(type="ONLY")
+    dev[0].roam(apdev[1]['bssid'])
+    hapd1.wait_sta()
+    sta = hapd1.get_sta(dev[0].own_addr())
+    ext_capab = bytearray(binascii.unhexlify(sta['ext_capab']))
+    if not ext_capab[2] & 0x08:
+        raise Exception("STA disabled BSS Transition capability")
+    dev[0].roam(apdev[0]['bssid'])
+    hapd0.wait_sta()
+    sta = hapd0.get_sta(dev[0].own_addr())
     ext_capab = bytearray(binascii.unhexlify(sta['ext_capab']))
     if ext_capab[2] & 0x08:
         raise Exception("STA did not disable BSS Transition capability")