tests: DPP connection status - success with hostapd as Configurator
Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
6bbbd9729f
commit
9056f918b6
2 changed files with 47 additions and 1 deletions
|
@ -466,7 +466,8 @@ class Hostapd:
|
|||
|
||||
def dpp_auth_init(self, peer=None, uri=None, conf=None, configurator=None,
|
||||
extra=None, own=None, role=None, neg_freq=None,
|
||||
ssid=None, passphrase=None, expect_fail=False):
|
||||
ssid=None, passphrase=None, expect_fail=False,
|
||||
conn_status=False):
|
||||
cmd = "DPP_AUTH_INIT"
|
||||
if peer is None:
|
||||
peer = self.dpp_qr_code(uri)
|
||||
|
@ -487,6 +488,8 @@ class Hostapd:
|
|||
cmd += " ssid=" + binascii.hexlify(ssid.encode()).decode()
|
||||
if passphrase:
|
||||
cmd += " pass=" + binascii.hexlify(passphrase.encode()).decode()
|
||||
if conn_status:
|
||||
cmd += " conn_status=1"
|
||||
res = self.request(cmd)
|
||||
if expect_fail:
|
||||
if "FAIL" not in res:
|
||||
|
|
|
@ -5311,6 +5311,49 @@ def run_dpp_conn_status(dev, apdev, result=0, assoc_reject=False):
|
|||
if result == 10 and "channel_list=" not in ev:
|
||||
raise Exception("Channel list not reported for no-AP")
|
||||
|
||||
def test_dpp_conn_status_success_hostapd_configurator(dev, apdev):
|
||||
"""DPP connection status - success with hostapd as Configurator"""
|
||||
try:
|
||||
run_dpp_conn_status_hostapd_configurator(dev, apdev)
|
||||
finally:
|
||||
dev[0].set("dpp_config_processing", "0", allow_fail=True)
|
||||
|
||||
def run_dpp_conn_status_hostapd_configurator(dev, apdev):
|
||||
check_dpp_capab(dev[0])
|
||||
hapd = hostapd.add_ap(apdev[0], {"ssid": "unconfigured",
|
||||
"channel": "1"})
|
||||
check_dpp_capab(hapd)
|
||||
conf_id = hapd.dpp_configurator_add()
|
||||
|
||||
cmd = "DPP_CONFIGURATOR_SIGN conf=ap-dpp configurator=%d" % conf_id
|
||||
res = hapd.request(cmd)
|
||||
if "FAIL" in res:
|
||||
raise Exception("Failed to generate own configuration")
|
||||
update_hapd_config(hapd)
|
||||
|
||||
id0 = dev[0].dpp_bootstrap_gen(chan="81/1", mac=True)
|
||||
uri0 = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id0)
|
||||
id1 = hapd.dpp_qr_code(uri0)
|
||||
res = hapd.request("DPP_BOOTSTRAP_INFO %d" % id1)
|
||||
if "FAIL" in res:
|
||||
raise Exception("DPP_BOOTSTRAP_INFO failed")
|
||||
if "type=QRCODE" not in res:
|
||||
raise Exception("DPP_BOOTSTRAP_INFO did not report correct type")
|
||||
if "mac_addr=" + dev[0].own_addr() not in res:
|
||||
raise Exception("DPP_BOOTSTRAP_INFO did not report correct mac_addr")
|
||||
dev[0].set("dpp_config_processing", "2")
|
||||
dev[0].dpp_listen(2412)
|
||||
hapd.dpp_auth_init(peer=id1, configurator=conf_id, conf="sta-dpp",
|
||||
conn_status=True)
|
||||
res = wait_auth_success(dev[0], hapd, configurator=hapd, enrollee=dev[0])
|
||||
if 'wait_conn_status' not in res:
|
||||
raise Exception("Configurator did not request connection status")
|
||||
ev = hapd.wait_event(["DPP-CONN-STATUS-RESULT"], timeout=20)
|
||||
if ev is None:
|
||||
raise Exception("No connection status reported")
|
||||
if "result=0" not in ev:
|
||||
raise Exception("Unexpected connection status: " + ev)
|
||||
|
||||
def test_dpp_mud_url(dev, apdev):
|
||||
"""DPP MUD URL"""
|
||||
check_dpp_capab(dev[0])
|
||||
|
|
Loading…
Reference in a new issue