gsupplicant: Set WPA protocol
authorSamuel Ortiz <sameo@linux.intel.com>
Wed, 2 Feb 2011 23:38:37 +0000 (00:38 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Wed, 2 Feb 2011 23:38:37 +0000 (00:38 +0100)
gsupplicant/gsupplicant.h
gsupplicant/supplicant.c

index c6d10abc12bcf2faa3235929daaf8bbfaf8f8788..5c453aac72eba36675fae5b819647ace1fb31f3d 100644 (file)
@@ -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;
index 3dc509138c6d63b3a1b3e76034af9c6780798ce6..97e5858f520fe98bc3484a7070b958f82c19e6d5 100644 (file)
@@ -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;
        }