From 609ea53e487a55298d7a168e616ab9bb91214084 Mon Sep 17 00:00:00 2001 From: Samuel Ortiz Date: Thu, 3 Feb 2011 00:38:37 +0100 Subject: [PATCH] gsupplicant: Set WPA protocol --- gsupplicant/gsupplicant.h | 4 ++++ gsupplicant/supplicant.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h index c6d10ab..5c453aa 100644 --- a/gsupplicant/gsupplicant.h +++ b/gsupplicant/gsupplicant.h @@ -61,6 +61,9 @@ extern "C" { #define G_SUPPLICANT_KEYMGMT_WPA_EAP_256 (1 << 8) #define G_SUPPLICANT_KEYMGMT_WPS (1 << 9) +#define G_SUPPLICANT_PROTO_WPA (1 << 0) +#define G_SUPPLICANT_PROTO_RSN (1 << 1) + #define G_SUPPLICANT_GROUP_WEP40 (1 << 0) #define G_SUPPLICANT_GROUP_WEP104 (1 << 1) #define G_SUPPLICANT_GROUP_TKIP (1 << 2) @@ -110,6 +113,7 @@ struct _GSupplicantSSID { unsigned int scan_ssid; GSupplicantMode mode; GSupplicantSecurity security; + unsigned int protocol; unsigned int pairwise_cipher; unsigned int group_cipher; unsigned int freq; diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index 3dc5091..97e5858 100644 --- a/gsupplicant/supplicant.c +++ b/gsupplicant/supplicant.c @@ -2726,6 +2726,39 @@ static void add_network_security_ciphers(DBusMessageIter *dict, g_free(group); } +static void add_network_security_proto(DBusMessageIter *dict, + GSupplicantSSID *ssid) +{ + unsigned int protocol, i; + char *proto; + char *protos[3]; + + protocol = ssid->protocol; + + if (protocol == 0) + return; + + i = 0; + + if (protocol & G_SUPPLICANT_PROTO_RSN) + protos[i++] = "RSN"; + + if (protocol & G_SUPPLICANT_PROTO_WPA) + protos[i++] = "WPA"; + + protos[i] = NULL; + + proto = g_strjoinv(" ", protos); + + SUPPLICANT_DBG("proto %s", proto); + + supplicant_dbus_dict_append_basic(dict, "proto", + DBUS_TYPE_STRING, + &proto); + + g_free(proto); +} + static void add_network_security(DBusMessageIter *dict, GSupplicantSSID *ssid) { char *key_mgmt; @@ -2740,10 +2773,12 @@ static void add_network_security(DBusMessageIter *dict, GSupplicantSSID *ssid) case G_SUPPLICANT_SECURITY_PSK: key_mgmt = "WPA-PSK"; add_network_security_psk(dict, ssid); + add_network_security_proto(dict, ssid); break; case G_SUPPLICANT_SECURITY_IEEE8021X: key_mgmt = "WPA-EAP"; add_network_security_eap(dict, ssid); + add_network_security_proto(dict, ssid); break; } -- 2.7.4