[PATCH 3/4] supplicant/tests: add FILS test



Signed-off-by: Masashi Honma <masashi honma gmail com>
---
 src/supplicant/tests/test-supplicant-config.c | 50 ++++++++++++++++++++++++---
 1 file changed, 46 insertions(+), 4 deletions(-)

diff --git a/src/supplicant/tests/test-supplicant-config.c b/src/supplicant/tests/test-supplicant-config.c
index 4b4a493..31d2b87 100644
--- a/src/supplicant/tests/test-supplicant-config.c
+++ b/src/supplicant/tests/test-supplicant-config.c
@@ -386,7 +386,7 @@ test_wifi_wpa_psk_types (void)
 }
 
 static NMConnection *
-generate_wifi_eap_connection (const char *id, GBytes *ssid, const char *bssid_str)
+generate_wifi_eap_connection (const char *id, GBytes *ssid, const char *bssid_str, const char *key_mgmt)
 {
        NMConnection *connection = NULL;
        NMSettingWirelessSecurity *s_wsec;
@@ -400,7 +400,7 @@ generate_wifi_eap_connection (const char *id, GBytes *ssid, const char *bssid_st
        s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new ();
        nm_connection_add_setting (connection, NM_SETTING (s_wsec));
        g_object_set (s_wsec,
-                     NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-eap",
+                     NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, key_mgmt,
                      NULL);
        nm_setting_wireless_security_add_proto (s_wsec, "wpa");
        nm_setting_wireless_security_add_proto (s_wsec, "rsn");
@@ -434,7 +434,7 @@ test_wifi_eap_locked_bssid (void)
        const char *bssid_str = "11:22:33:44:55:66";
        guint32 mtu = 1100;
 
-       connection = generate_wifi_eap_connection ("Test Wifi EAP-TLS Locked", ssid, bssid_str);
+       connection = generate_wifi_eap_connection ("Test Wifi EAP-TLS Locked", ssid, bssid_str, "wpa-eap");
 
        EXPECT ("*added 'ssid' value 'Test SSID'*");
        EXPECT ("*added 'scan_ssid' value '1'*");
@@ -475,7 +475,7 @@ test_wifi_eap_unlocked_bssid (void)
        gs_unref_bytes GBytes *bgscan = g_bytes_new (bgscan_data, strlen (bgscan_data));
        guint32 mtu = 1100;
 
-       connection = generate_wifi_eap_connection ("Test Wifi EAP-TLS Unlocked", ssid, NULL);
+       connection = generate_wifi_eap_connection ("Test Wifi EAP-TLS Unlocked", ssid, NULL, "wpa-eap");
 
        EXPECT ("*added 'ssid' value 'Test SSID'*");
        EXPECT ("*added 'scan_ssid' value '1'*");
@@ -505,6 +505,47 @@ test_wifi_eap_unlocked_bssid (void)
        validate_opt ("wifi-eap", config_dict, "bgscan", TYPE_BYTES, bgscan);
 }
 
+static void
+test_wifi_fils (void)
+{
+       gs_unref_object NMConnection *connection = NULL;
+       gs_unref_variant GVariant *config_dict = NULL;
+       const unsigned char ssid_data[] = { 0x54, 0x65, 0x73, 0x74, 0x20, 0x53, 0x53, 0x49, 0x44 };
+       gs_unref_bytes GBytes *ssid = g_bytes_new (ssid_data, sizeof (ssid_data));
+       const char *bgscan_data = "simple:30:-65:300";
+       gs_unref_bytes GBytes *bgscan = g_bytes_new (bgscan_data, strlen (bgscan_data));
+       guint32 mtu = 1100;
+
+       connection = generate_wifi_eap_connection ("Test Wifi FILS", ssid, NULL, "wpa-fils");
+
+       EXPECT ("*added 'ssid' value 'Test SSID'*");
+       EXPECT ("*added 'scan_ssid' value '1'*");
+       EXPECT ("*added 'freq_list' value *");
+       EXPECT ("*added 'key_mgmt' value 'FILS-SHA256 FILS-SHA384'");
+       EXPECT ("*added 'proto' value 'WPA RSN'");
+       EXPECT ("*added 'pairwise' value 'TKIP CCMP'");
+       EXPECT ("*added 'group' value 'TKIP CCMP'");
+       EXPECT ("*Config: added 'eap' value 'TLS'");
+       EXPECT ("*Config: added 'fragment_size' value '1086'");
+       EXPECT ("* Config: added 'ca_cert' value '*/test-ca-cert.pem'");
+       EXPECT ("* Config: added 'private_key' value '*/test-cert.p12'");
+       EXPECT ("*Config: added 'proactive_key_caching' value '1'");
+       EXPECT ("*Config: added 'bgscan' value 'simple:30:-65:300'");
+       config_dict = build_supplicant_config (connection, mtu, 0);
+       g_test_assert_expected_messages ();
+       g_assert (config_dict);
+
+       validate_opt ("wifi-fils", config_dict, "scan_ssid", TYPE_INT, GINT_TO_POINTER (1));
+       validate_opt ("wifi-fils", config_dict, "ssid", TYPE_BYTES, ssid);
+       validate_opt ("wifi-fils", config_dict, "key_mgmt", TYPE_KEYWORD, "FILS-SHA256 FILS-SHA384");
+       validate_opt ("wifi-fils", config_dict, "eap", TYPE_KEYWORD, "TLS");
+       validate_opt ("wifi-fils", config_dict, "proto", TYPE_KEYWORD, "WPA RSN");
+       validate_opt ("wifi-fils", config_dict, "pairwise", TYPE_KEYWORD, "TKIP CCMP");
+       validate_opt ("wifi-fils", config_dict, "group", TYPE_KEYWORD, "TKIP CCMP");
+       validate_opt ("wifi-fils", config_dict, "fragment_size", TYPE_INT, GINT_TO_POINTER(mtu-14));
+       validate_opt ("wifi-fils", config_dict, "bgscan", TYPE_BYTES, bgscan);
+}
+
 NMTST_DEFINE ();
 
 int main (int argc, char **argv)
@@ -516,6 +557,7 @@ int main (int argc, char **argv)
        g_test_add_func ("/supplicant-config/wifi-wpa-psk-types", test_wifi_wpa_psk_types);
        g_test_add_func ("/supplicant-config/wifi-eap/locked-bssid", test_wifi_eap_locked_bssid);
        g_test_add_func ("/supplicant-config/wifi-eap/unlocked-bssid", test_wifi_eap_unlocked_bssid);
+       g_test_add_func ("/supplicant-config/wifi-fils", test_wifi_fils);
 
        return g_test_run ();
 }
-- 
2.7.4



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