tests: Allow local disconnect in openssl_cipher_suite_config_wpas
authorJouni Malinen <j@w1.fi>
Tue, 28 Jul 2015 13:38:02 +0000 (16:38 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 28 Jul 2015 18:00:18 +0000 (21:00 +0300)
The openssl_ciphers="EXPORT" case may result in locally generated
disconnection event if the OpenSSL version used in the build rejects
export ciphers in default configuration (which is what OpenSSL 1.1.0
will likely do). Don't report a test case failure in such a case.

Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_ap_eap.py

index 579b04e..9147542 100644 (file)
@@ -64,7 +64,7 @@ def read_pem(fname):
 
 def eap_connect(dev, ap, method, identity,
                 sha256=False, expect_failure=False, local_error_report=False,
-                **kwargs):
+                maybe_local_error=False, **kwargs):
     hapd = hostapd.Hostapd(ap['ifname'])
     id = dev.connect("test-wpa2-eap", key_mgmt="WPA-EAP WPA-EAP-SHA256",
                      eap=method, identity=identity,
@@ -72,7 +72,8 @@ def eap_connect(dev, ap, method, identity,
                      **kwargs)
     eap_check_auth(dev, method, True, sha256=sha256,
                    expect_failure=expect_failure,
-                   local_error_report=local_error_report)
+                   local_error_report=local_error_report,
+                   maybe_local_error=maybe_local_error)
     if expect_failure:
         return id
     ev = hapd.wait_event([ "AP-STA-CONNECTED" ], timeout=5)
@@ -81,7 +82,8 @@ def eap_connect(dev, ap, method, identity,
     return id
 
 def eap_check_auth(dev, method, initial, rsn=True, sha256=False,
-                   expect_failure=False, local_error_report=False):
+                   expect_failure=False, local_error_report=False,
+                   maybe_local_error=False):
     ev = dev.wait_event(["CTRL-EVENT-EAP-STARTED"], timeout=10)
     if ev is None:
         raise Exception("Association and EAP start timed out")
@@ -95,6 +97,8 @@ def eap_check_auth(dev, method, initial, rsn=True, sha256=False,
         if ev is None:
             raise Exception("EAP failure timed out")
         ev = dev.wait_disconnected(timeout=10)
+        if maybe_local_error and "locally_generated=1" in ev:
+            return
         if not local_error_report:
             if "reason=23" not in ev:
                 raise Exception("Proper reason code for disconnection not reported")
@@ -3018,7 +3022,7 @@ def test_openssl_cipher_suite_config_wpas(dev, apdev):
                 anonymous_identity="ttls", password="password",
                 openssl_ciphers="EXPORT",
                 ca_cert="auth_serv/ca.pem", phase2="auth=PAP",
-                expect_failure=True)
+                expect_failure=True, maybe_local_error=True)
     dev[2].connect("test-wpa2-eap", key_mgmt="WPA-EAP", eap="TTLS",
                    identity="pap user", anonymous_identity="ttls",
                    password="password",