+def test_mbo_assoc_disallow_ignore(dev, apdev):
+ """MBO and ignoring disallowed association"""
+ try:
+ _test_mbo_assoc_disallow_ignore(dev, apdev)
+ finally:
+ dev[0].request("SCAN_INTERVAL 5")
+
+def _test_mbo_assoc_disallow_ignore(dev, apdev):
+ hapd1 = hostapd.add_ap(apdev[0], { "ssid": "MBO", "mbo": "1" })
+ if "OK" not in hapd1.request("SET mbo_assoc_disallow 1"):
+ raise Exception("Failed to set mbo_assoc_disallow for AP1")
+
+ if "OK" not in dev[0].request("SCAN_INTERVAL 1"):
+ raise Exception("Failed to set scan interval")
+ dev[0].connect("MBO", key_mgmt="NONE", scan_freq="2412", wait_connect=False)
+ ev = dev[0].wait_event(["CTRL-EVENT-NETWORK-NOT-FOUND"], timeout=10)
+ if ev is None:
+ raise Exception("CTRL-EVENT-NETWORK-NOT-FOUND not seen")
+
+ if "OK" not in dev[0].request("SET ignore_assoc_disallow 1"):
+ raise Exception("Failed to set ignore_assoc_disallow")
+ ev = dev[0].wait_event(["CTRL-EVENT-ASSOC-REJECT"], timeout=10)
+ if ev is None:
+ raise Exception("CTRL-EVENT-ASSOC-REJECT not seen")
+ if "status_code=17" not in ev:
+ raise Exception("Unexpected association reject reason: " + ev)
+
+ if "OK" not in hapd1.request("SET mbo_assoc_disallow 0"):
+ raise Exception("Failed to set mbo_assoc_disallow for AP1")
+ dev[0].wait_connected()
+