diff options
author | Jaehyun Kim <jeik01.kim@samsung.com> | 2022-02-14 19:16:29 +0900 |
---|---|---|
committer | Jaehyun Kim <jeik01.kim@samsung.com> | 2022-02-14 19:16:29 +0900 |
commit | 2985b9822ac3f5acfef2933cbda98c1285e11af4 (patch) | |
tree | b96bb85b24be4518b1e1ab4ca9ff697461967ba5 | |
parent | cb44445ef9d0efad53051e796ecfa7c42add5d78 (diff) | |
download | connman-2985b9822ac3f5acfef2933cbda98c1285e11af4.tar.gz connman-2985b9822ac3f5acfef2933cbda98c1285e11af4.tar.bz2 connman-2985b9822ac3f5acfef2933cbda98c1285e11af4.zip |
Add support to get PMF informationsubmit/tizen/20220215.060643accepted/tizen/unified/20220216.175734
Change-Id: I7286c346750504175e24cbb569404e586b309a85
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
-rwxr-xr-x | gsupplicant/gsupplicant.h | 1 | ||||
-rwxr-xr-x | gsupplicant/supplicant.c | 30 | ||||
-rw-r--r-- | packaging/connman.spec | 2 | ||||
-rwxr-xr-x | plugins/wifi.c | 2 | ||||
-rwxr-xr-x | src/network.c | 8 | ||||
-rwxr-xr-x | src/service.c | 4 |
6 files changed, 41 insertions, 6 deletions
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h index e7c4e58b..0823a394 100755 --- a/gsupplicant/gsupplicant.h +++ b/gsupplicant/gsupplicant.h @@ -523,6 +523,7 @@ dbus_bool_t g_supplicant_network_get_privacy(GSupplicantNetwork *network); void *g_supplicant_network_get_wifi_vsie(GSupplicantNetwork *network); const unsigned char *g_supplicant_network_get_countrycode(GSupplicantNetwork *network); +dbus_bool_t g_supplicant_network_is_pmf_required(GSupplicantNetwork *network); void *g_supplicant_network_get_bssid_list(GSupplicantNetwork *network); GSupplicantPhy_mode g_supplicant_network_get_phy_mode(GSupplicantNetwork *network); dbus_bool_t g_supplicant_network_get_transition_mode(GSupplicantNetwork *network); diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index 6cf4cf22..9ecaf069 100755 --- a/gsupplicant/supplicant.c +++ b/gsupplicant/supplicant.c @@ -317,6 +317,7 @@ struct g_supplicant_bss { unsigned int transition_mode_ssid_len; unsigned char transition_mode_bssid[6]; unsigned char transition_mode_ssid[32]; + dbus_bool_t pmf_required; #endif }; @@ -1764,6 +1765,14 @@ const unsigned char *g_supplicant_network_get_countrycode(GSupplicantNetwork return network->country_code; } + +dbus_bool_t g_supplicant_network_is_pmf_required(GSupplicantNetwork *network) +{ + if (!network) + return 0; + + return network->best_bss->pmf_required; +} #endif const unsigned char *g_supplicant_peer_get_widi_ies(GSupplicantPeer *peer, @@ -2929,6 +2938,7 @@ static void bss_process_ies(DBusMessageIter *iter, void *user_data) unsigned char *ext_rates = NULL; unsigned int max_rate = 0; unsigned int max_ext_rate = 0; + unsigned int offset = 0; bool ht = false; bool vht = false; #endif @@ -2946,6 +2956,8 @@ static void bss_process_ies(DBusMessageIter *iter, void *user_data) #if defined TIZEN_EXT #define VENDOR_SPECIFIC_INFO 0xDD #define WLAN_EID_COUNTRY 7 +#define WLAN_EID_RSN_INFO 48 +#define RSN_CAPABILITY_MFP_REQ (1 << 6) #endif dbus_message_iter_recurse(iter, &array); @@ -2963,7 +2975,7 @@ static void bss_process_ies(DBusMessageIter *iter, void *user_data) unsigned char *vsie; int vsie_len = 0; - if(ie[0] == VENDOR_SPECIFIC_INFO && memcmp(ie+2, OWE_WFA_OUI, sizeof(OWE_WFA_OUI)) == 0) { + if (ie[0] == VENDOR_SPECIFIC_INFO && memcmp(ie+2, OWE_WFA_OUI, sizeof(OWE_WFA_OUI)) == 0) { SUPPLICANT_DBG("IE: match vendor specific data : OWE Transition Mode"); /* @@ -2993,7 +3005,7 @@ static void bss_process_ies(DBusMessageIter *iter, void *user_data) continue; } - if(ie[0] == VENDOR_SPECIFIC_INFO && memcmp(ie+2, WPS_OUI, sizeof(WPS_OUI)) != 0) { + if (ie[0] == VENDOR_SPECIFIC_INFO && memcmp(ie+2, WPS_OUI, sizeof(WPS_OUI)) != 0) { if (!simplified_log) SUPPLICANT_DBG("IE: match vendor specific data"); @@ -3009,7 +3021,7 @@ static void bss_process_ies(DBusMessageIter *iter, void *user_data) continue; } - if(ie[0] == WLAN_EID_COUNTRY && ie[1] >= 2) { + if (ie[0] == WLAN_EID_COUNTRY && ie[1] >= 2) { /* Add country code only if it is a valid alphabet */ if (ie[2] >= 65 && ie[2] <= 90 && ie[3] >= 65 && ie[3] <= 90) { memcpy(bss->country_code, ie+2, COUNTRY_CODE_LENGTH); @@ -3054,6 +3066,18 @@ static void bss_process_ies(DBusMessageIter *iter, void *user_data) } continue; } + + if (ie[0] == WLAN_EID_RSN_INFO && ie[1] >= 20) { + r_len = ie[1]; + offset = 10 + ie[8] * 4; + offset += ie[offset] * 4 + 2; + + if (offset <= r_len + 1 && + (ie[offset] & RSN_CAPABILITY_MFP_REQ) != 0) + bss->pmf_required = TRUE; + + continue; + } #endif if (ie[0] != WMM_WPA1_WPS_INFO || ie[1] < WPS_INFO_MIN_LEN || memcmp(ie+2, WPS_OUI, sizeof(WPS_OUI)) != 0) diff --git a/packaging/connman.spec b/packaging/connman.spec index 7273013a..ff92bd63 100644 --- a/packaging/connman.spec +++ b/packaging/connman.spec @@ -6,7 +6,7 @@ Name: connman Version: 1.38 -Release: 12 +Release: 14 License: GPL-2.0+ Summary: Connection Manager Url: http://connman.net diff --git a/plugins/wifi.c b/plugins/wifi.c index 0b5315f0..26b988e0 100755 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -5318,6 +5318,8 @@ static void network_added(GSupplicantNetwork *supplicant_network) g_supplicant_network_get_enc_mode(supplicant_network)); connman_network_set_rsn_mode(network, g_supplicant_network_get_rsn_mode(supplicant_network)); + connman_network_set_bool(network, "WiFi.PMFRequired", + (bool)g_supplicant_network_is_pmf_required(supplicant_network)); connman_network_set_keymgmt(network, keymgmt); connman_network_set_bool(network, "WiFi.HS20AP", g_supplicant_network_is_hs20AP(supplicant_network)); diff --git a/src/network.c b/src/network.c index ed05a52a..6849c1b7 100755 --- a/src/network.c +++ b/src/network.c @@ -122,6 +122,7 @@ struct connman_network { unsigned int keymgmt; char *keymgmt_type; bool rsn_mode; + bool pmf_required; int disconnect_reason; int assoc_status_code; GSList *vsie_list; @@ -3013,9 +3014,10 @@ int connman_network_set_bool(struct connman_network *network, network->wifi.isHS20AP = value; else if (g_strcmp0(key, "WiFi.TRANSITION_MODE") == 0) network->wifi.owe_transition_mode = value; - else if (g_strcmp0(key, "WiFi.Roaming") == 0) { + else if (g_strcmp0(key, "WiFi.Roaming") == 0) network->wifi.roaming_progress = value; - } + else if (g_strcmp0(key, "WiFi.PMFRequired") == 0) + network->wifi.pmf_required = value; #endif return -EINVAL; @@ -3048,6 +3050,8 @@ bool connman_network_get_bool(struct connman_network *network, return network->wifi.owe_transition_mode; else if (g_str_equal(key, "WiFi.Roaming")) return network->wifi.roaming_progress; + else if (g_str_equal(key, "WiFi.PMFRequired")) + return network->wifi.pmf_required; #endif return false; diff --git a/src/service.c b/src/service.c index 5e7eb8d0..19056a81 100755 --- a/src/service.c +++ b/src/service.c @@ -4288,6 +4288,7 @@ static void append_wifi_ext_info(DBusMessageIter *dict, const char *enc_mode; const char *str; gboolean passpoint; + gboolean pmf_required; char country_code_buff[WIFI_COUNTRY_CODE_LEN + 1] = {0,}; char *country_code_str = country_code_buff; unsigned char *country_code; @@ -4302,6 +4303,7 @@ static void append_wifi_ext_info(DBusMessageIter *dict, enc_mode = connman_network_get_enc_mode(network); passpoint = connman_network_get_bool(network, "WiFi.HS20AP"); keymgmt = connman_network_get_keymgmt(network); + pmf_required = connman_network_get_bool(network, "WiFi.PMFRequired"); country_code = connman_network_get_countrycode(network); connection_mode = connman_network_get_connection_mode(network); sec_list = (GSList *)connman_network_get_sec_list(network); @@ -4331,6 +4333,8 @@ static void append_wifi_ext_info(DBusMessageIter *dict, DBUS_TYPE_BOOLEAN, &passpoint); connman_dbus_dict_append_basic(dict, "Keymgmt", DBUS_TYPE_UINT32, &keymgmt); + connman_dbus_dict_append_basic(dict, "PmfReq", + DBUS_TYPE_BOOLEAN, &pmf_required); connman_dbus_dict_append_basic(dict, "Country", DBUS_TYPE_STRING, &country_code_str); connman_dbus_dict_append_basic(dict, "ConnMode", |