From: Samuel Ortiz Date: Wed, 2 Feb 2011 23:23:13 +0000 (+0100) Subject: gsupplicant: Set WPA ciphers X-Git-Tag: accepted/2.0alpha-wayland/20121110.002834~1781 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c0e306d373d4dd9119400cef0f4473783974975e;p=profile%2Fivi%2Fconnman.git gsupplicant: Set WPA ciphers --- diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h index e018ada..c6d10ab 100644 --- a/gsupplicant/gsupplicant.h +++ b/gsupplicant/gsupplicant.h @@ -110,6 +110,8 @@ struct _GSupplicantSSID { unsigned int scan_ssid; GSupplicantMode mode; GSupplicantSecurity security; + unsigned int pairwise_cipher; + unsigned int group_cipher; unsigned int freq; const char *eap; const char *passphrase; diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index 909dc84..3dc5091 100644 --- a/gsupplicant/supplicant.c +++ b/gsupplicant/supplicant.c @@ -2667,6 +2667,65 @@ static void add_network_security_eap(DBusMessageIter *dict, g_free(eap_value); } +static void add_network_security_ciphers(DBusMessageIter *dict, + GSupplicantSSID *ssid) +{ + unsigned int p_cipher, g_cipher, i; + char *pairwise, *group; + char *pair_ciphers[4]; + char *group_ciphers[5]; + + p_cipher = ssid->pairwise_cipher; + g_cipher = ssid->group_cipher; + + if (p_cipher == 0 && g_cipher == 0) + return; + + i = 0; + + if (p_cipher & G_SUPPLICANT_PAIRWISE_CCMP) + pair_ciphers[i++] = "CCMP"; + + if (p_cipher & G_SUPPLICANT_PAIRWISE_TKIP) + pair_ciphers[i++] = "TKIP"; + + if (p_cipher & G_SUPPLICANT_PAIRWISE_NONE) + pair_ciphers[i++] = "NONE"; + + pair_ciphers[i] = NULL; + + i = 0; + + if (g_cipher & G_SUPPLICANT_GROUP_CCMP) + group_ciphers[i++] = "CCMP"; + + if (g_cipher & G_SUPPLICANT_GROUP_TKIP) + group_ciphers[i++] = "TKIP"; + + if (g_cipher & G_SUPPLICANT_GROUP_WEP104) + group_ciphers[i++] = "WEP104"; + + if (g_cipher & G_SUPPLICANT_GROUP_WEP40) + group_ciphers[i++] = "WEP40"; + + group_ciphers[i] = NULL; + + pairwise = g_strjoinv(" ", pair_ciphers); + group = g_strjoinv(" ", group_ciphers); + + SUPPLICANT_DBG("cipher %s %s", pairwise, group); + + supplicant_dbus_dict_append_basic(dict, "pairwise", + DBUS_TYPE_STRING, + &pairwise); + supplicant_dbus_dict_append_basic(dict, "group", + DBUS_TYPE_STRING, + &group); + + g_free(pairwise); + g_free(group); +} + static void add_network_security(DBusMessageIter *dict, GSupplicantSSID *ssid) { char *key_mgmt; @@ -2688,6 +2747,8 @@ static void add_network_security(DBusMessageIter *dict, GSupplicantSSID *ssid) break; } + add_network_security_ciphers(dict, ssid); + supplicant_dbus_dict_append_basic(dict, "key_mgmt", DBUS_TYPE_STRING, &key_mgmt); }