]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Verify that WPS re-provisioning replaces old network block
authorJouni Malinen <jouni@qca.qualcomm.com>
Fri, 29 Nov 2013 12:58:11 +0000 (14:58 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 26 Dec 2013 18:50:28 +0000 (20:50 +0200)
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

tests/hwsim/test_ap_wps.py

index 486dd206e1dde098e97332f631718a191470789b..2c9057a1139a090811021fb4180753497eb652d8 100644 (file)
@@ -65,6 +65,41 @@ def test_ap_wps_conf(dev, apdev):
     if status['key_mgmt'] != 'WPA2-PSK':
         raise Exception("Unexpected key_mgmt")
 
+def test_ap_wps_twice(dev, apdev):
+    """WPS provisioning with twice to change passphrase"""
+    ssid = "test-wps-twice"
+    params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
+               "wpa_passphrase": "12345678", "wpa": "2",
+               "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP" }
+    hostapd.add_ap(apdev[0]['ifname'], params)
+    hapd = hostapd.Hostapd(apdev[0]['ifname'])
+    logger.info("WPS provisioning step")
+    hapd.request("WPS_PBC")
+    dev[0].request("SET ignore_old_scan_res 1")
+    dev[0].dump_monitor()
+    dev[0].request("WPS_PBC")
+    ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED"], timeout=30)
+    if ev is None:
+        raise Exception("Association with the AP timed out")
+    dev[0].request("DISCONNECT")
+
+    logger.info("Restart AP with different passphrase and re-run WPS")
+    hapd_global = hostapd.HostapdGlobal()
+    hapd_global.remove(apdev[0]['ifname'])
+    params['wpa_passphrase'] = 'another passphrase'
+    hostapd.add_ap(apdev[0]['ifname'], params)
+    hapd = hostapd.Hostapd(apdev[0]['ifname'])
+    logger.info("WPS provisioning step")
+    hapd.request("WPS_PBC")
+    dev[0].dump_monitor()
+    dev[0].request("WPS_PBC")
+    ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED"], timeout=30)
+    if ev is None:
+        raise Exception("Association with the AP timed out")
+    networks = dev[0].list_networks()
+    if len(networks) > 1:
+        raise Exception("Unexpected duplicated network block present")
+
 def test_ap_wps_conf_pin(dev, apdev):
     """WPS PIN provisioning with configured AP"""
     ssid = "test-wps-conf-pin"