]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: IEEE 802.1X and FORCE_UNAUTH state
authorJouni Malinen <j@w1.fi>
Sun, 28 Mar 2021 09:36:18 +0000 (12:36 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 28 Mar 2021 09:36:18 +0000 (12:36 +0300)
Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_ieee8021x.py
wpa_supplicant/ctrl_iface.c

index 89c282b396e0a78594c9c101e7f31b60feb76c61..630d6d0dbe928260b3bd6031ac95f1f1c1e724c4 100644 (file)
@@ -245,6 +245,23 @@ def test_ieee8021x_held(dev, apdev):
         dev[0].request("SET EAPOL::maxStart 3")
         dev[0].request("SET EAPOL::heldPeriod 60")
 
+def test_ieee8021x_force_unauth(dev, apdev):
+    """IEEE 802.1X and FORCE_UNAUTH state"""
+    params = hostapd.radius_params()
+    params["ssid"] = "ieee8021x-open"
+    params["ieee8021x"] = "1"
+    hapd = hostapd.add_ap(apdev[0], params)
+    bssid = apdev[0]['bssid']
+
+    dev[0].connect("ieee8021x-open", key_mgmt="IEEE8021X", eapol_flags="0",
+                   eap="PSK", identity="psk.user@example.com",
+                   password_hex="0123456789abcdef0123456789abcdef",
+                   scan_freq="2412")
+    dev[0].request("SET EAPOL::portControl ForceUnauthorized")
+    pae = dev[0].get_status_field('Supplicant PAE state')
+    dev[0].wait_disconnected()
+    dev[0].request("SET EAPOL::portControl Auto")
+
 def send_eapol_key(dev, bssid, signkey, frame_start, frame_end):
     zero_sign = "00000000000000000000000000000000"
     frame = frame_start + zero_sign + frame_end
index 003de7bb1848ebb479f863e2d791289ae3b6a37c..0cf2a44ff974cf34b586b1f55bfb6d6c52118b46 100644 (file)
@@ -512,6 +512,19 @@ static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s,
        } else if (os_strcasecmp(cmd, "EAPOL::maxStart") == 0) {
                eapol_sm_configure(wpa_s->eapol,
                                   -1, -1, -1, atoi(value));
+#ifdef CONFIG_TESTING_OPTIONS
+       } else if (os_strcasecmp(cmd, "EAPOL::portControl") == 0) {
+               if (os_strcmp(value, "Auto") == 0)
+                       eapol_sm_notify_portControl(wpa_s->eapol, Auto);
+               else if (os_strcmp(value, "ForceUnauthorized") == 0)
+                       eapol_sm_notify_portControl(wpa_s->eapol,
+                                                   ForceUnauthorized);
+               else if (os_strcmp(value, "ForceAuthorized") == 0)
+                       eapol_sm_notify_portControl(wpa_s->eapol,
+                                                   ForceAuthorized);
+               else
+                       ret = -1;
+#endif /* CONFIG_TESTING_OPTIONS */
        } else if (os_strcasecmp(cmd, "dot11RSNAConfigPMKLifetime") == 0) {
                if (wpa_sm_set_param(wpa_s->wpa, RSNA_PMK_LIFETIME,
                                     atoi(value))) {