[PATCH 4/4] ifcfg-rh/tests: add Wi-Fi FILS test



Signed-off-by: Masashi Honma <masashi honma gmail com>
---
 Makefile.am                                        |  1 +
 .../tests/network-scripts/ifcfg-test-wifi-wpa-fils | 24 +++++++
 .../tests/network-scripts/keys-test-wifi-wpa-fils  |  1 +
 .../plugins/ifcfg-rh/tests/test-ifcfg-rh.c         | 78 ++++++++++++++++++++++
 4 files changed, 104 insertions(+)
 create mode 100644 src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wpa-fils
 create mode 100644 src/settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-fils

diff --git a/Makefile.am b/Makefile.am
index 8b442dc..c43dcaf 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2248,6 +2248,7 @@ EXTRA_DIST += \
        src/settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wep-passphrase \
        src/settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-eap-tls \
        src/settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-eap-ttls-tls \
+       src/settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-fils \
        src/settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-psk \
        src/settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-psk-2 \
        src/settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-psk-adhoc \
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wpa-fils 
b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wpa-fils
new file mode 100644
index 0000000..9593177
--- /dev/null
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-wpa-fils
@@ -0,0 +1,24 @@
+# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile)
+TYPE=Wireless
+DEVICE=eth2
+HWADDR=00:16:41:11:22:33
+BOOTPROTO=dhcp
+ONBOOT=yes
+ONBOOT=yes
+USERCTL=yes
+IPV6INIT=no
+NM_CONTROLLED=yes
+PEERDNS=yes
+ESSID=blahblah
+MODE=Managed
+RATE=auto
+CIPHER_PAIRWISE="TKIP CCMP"
+CIPHER_GROUP="TKIP CCMP WEP40 WEP104"
+KEY_MGMT=WPA-FILS
+WPA_ALLOW_WPA=yes
+WPA_ALLOW_WPA2=yes
+IEEE_8021X_EAP_METHODS=TLS
+IEEE_8021X_IDENTITY="Bill Smith"
+IEEE_8021X_CA_CERT=test_ca_cert.pem
+IEEE_8021X_CLIENT_CERT=test1_key_and_cert.pem
+IEEE_8021X_PRIVATE_KEY=test1_key_and_cert.pem
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-fils 
b/src/settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-fils
new file mode 100644
index 0000000..788b7b8
--- /dev/null
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/keys-test-wifi-wpa-fils
@@ -0,0 +1 @@
+IEEE_8021X_PRIVATE_KEY_PASSWORD="test1"
diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c 
b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
index 61a9b84..b708f9b 100644
--- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
+++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
@@ -3149,6 +3149,7 @@ test_read_wifi_wpa_eap_tls (void)
 {
        NMConnection *connection;
        NMSettingWireless *s_wireless;
+       NMSettingWirelessSecurity *s_wsec;
        NMSettingIPConfig *s_ip4;
        NMSetting8021x *s_8021x;
        char *unmanaged = NULL;
@@ -3163,6 +3164,12 @@ test_read_wifi_wpa_eap_tls (void)
        s_wireless = nm_connection_get_setting_wireless (connection);
        g_assert (s_wireless);
 
+       /* ===== WIRELESS SECURITY SETTING ===== */
+
+       s_wsec = nm_connection_get_setting_wireless_security (connection);
+       g_assert (s_wsec);
+       g_assert_cmpstr (nm_setting_wireless_security_get_key_mgmt (s_wsec), ==, "wpa-eap");
+
        /* ===== IPv4 SETTING ===== */
 
        s_ip4 = nm_connection_get_setting_ip4_config (connection);
@@ -3207,6 +3214,7 @@ test_read_wifi_wpa_eap_ttls_tls (void)
 {
        NMConnection *connection;
        NMSettingWireless *s_wireless;
+       NMSettingWirelessSecurity *s_wsec;
        NMSettingIPConfig *s_ip4;
        NMSetting8021x *s_8021x;
        char *unmanaged = NULL;
@@ -3221,6 +3229,12 @@ test_read_wifi_wpa_eap_ttls_tls (void)
        s_wireless = nm_connection_get_setting_wireless (connection);
        g_assert (s_wireless);
 
+       /* ===== WIRELESS SECURITY SETTING ===== */
+
+       s_wsec = nm_connection_get_setting_wireless_security (connection);
+       g_assert (s_wsec);
+       g_assert_cmpstr (nm_setting_wireless_security_get_key_mgmt (s_wsec), ==, "wpa-eap");
+
        /* ===== IPv4 SETTING ===== */
 
        s_ip4 = nm_connection_get_setting_ip4_config (connection);
@@ -3268,6 +3282,69 @@ test_read_wifi_wpa_eap_ttls_tls (void)
 }
 
 static void
+test_read_wifi_wpa_fils (void)
+{
+       NMConnection *connection;
+       NMSettingWireless *s_wireless;
+       NMSettingWirelessSecurity *s_wsec;
+       NMSettingIPConfig *s_ip4;
+       NMSetting8021x *s_8021x;
+       char *unmanaged = NULL;
+       const char *expected_privkey_password = "test1";
+
+       connection = _connection_from_file (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-wifi-wpa-fils",
+                                           NULL, TYPE_ETHERNET, &unmanaged);
+       g_assert (!unmanaged);
+
+       /* ===== WIRELESS SETTING ===== */
+
+       s_wireless = nm_connection_get_setting_wireless (connection);
+       g_assert (s_wireless);
+
+       /* ===== WIRELESS SECURITY SETTING ===== */
+
+       s_wsec = nm_connection_get_setting_wireless_security (connection);
+       g_assert (s_wsec);
+       g_assert_cmpstr (nm_setting_wireless_security_get_key_mgmt (s_wsec), ==, "wpa-fils");
+
+       /* ===== IPv4 SETTING ===== */
+
+       s_ip4 = nm_connection_get_setting_ip4_config (connection);
+       g_assert (s_ip4);
+       g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_AUTO);
+
+       /* ===== 802.1x SETTING ===== */
+       s_8021x = nm_connection_get_setting_802_1x (connection);
+       g_assert (s_8021x);
+       g_assert_cmpint (nm_setting_802_1x_get_num_eap_methods (s_8021x), ==, 1);
+       g_assert_cmpstr (nm_setting_802_1x_get_eap_method (s_8021x, 0), ==, "tls");
+       g_assert_cmpstr (nm_setting_802_1x_get_identity (s_8021x), ==, "Bill Smith");
+
+       /* CA Cert */
+       verify_cert_or_key (s_8021x,
+                           TEST_IFCFG_WIFI_WPA_EAP_TLS_CA_CERT,
+                           NULL,
+                           NM_SETTING_802_1X_CA_CERT);
+
+       /* Client Cert */
+       verify_cert_or_key (s_8021x,
+                           TEST_IFCFG_WIFI_WPA_EAP_TLS_CLIENT_CERT,
+                           NULL,
+                           NM_SETTING_802_1X_CLIENT_CERT);
+
+       /* Private Key Password */
+       g_assert_cmpstr (nm_setting_802_1x_get_private_key_password (s_8021x), ==, expected_privkey_password);
+
+       /* Private key */
+       verify_cert_or_key (s_8021x,
+                           TEST_IFCFG_WIFI_WPA_EAP_TLS_PRIVATE_KEY,
+                           expected_privkey_password,
+                           NM_SETTING_802_1X_PRIVATE_KEY);
+
+       g_object_unref (connection);
+}
+
+static void
 test_read_wifi_dynamic_wep_leap (void)
 {
        NMConnection *connection;
@@ -9761,6 +9838,7 @@ int main (int argc, char **argv)
        g_test_add_func (TPATH "wifi/read/dynamic-wep/leap", test_read_wifi_dynamic_wep_leap);
        g_test_add_func (TPATH "wifi/read/wpa/eap/tls", test_read_wifi_wpa_eap_tls);
        g_test_add_func (TPATH "wifi/read/wpa/eap/ttls/tls", test_read_wifi_wpa_eap_ttls_tls);
+       g_test_add_func (TPATH "wifi/read/wpa/fils", test_read_wifi_wpa_fils);
        g_test_add_func (TPATH "wifi/read/dynamic-wep/eap/ttls/chap", test_read_wifi_wep_eap_ttls_chap);
        g_test_add_func (TPATH "wifi/read-band-a", test_read_wifi_band_a);
        g_test_add_func (TPATH "wifi/read-band-a-channel-mismatch", test_read_wifi_band_a_channel_mismatch);
-- 
2.7.4



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]