gsupplicant: Creating an helper function to compute bss security
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Sat, 28 Apr 2012 09:00:06 +0000 (12:00 +0300)
committerMarcel Holtmann <marcel@holtmann.org>
Sat, 28 Apr 2012 18:05:27 +0000 (20:05 +0200)
gsupplicant/supplicant.c

index f7faa8a..8d87dae 100644 (file)
@@ -1345,6 +1345,19 @@ static void bss_process_ies(DBusMessageIter *iter, void *user_data)
        }
 }
 
+static void bss_compute_security(struct g_supplicant_bss *bss)
+{
+       if (bss->ieee8021x == TRUE)
+               bss->security = G_SUPPLICANT_SECURITY_IEEE8021X;
+       else if (bss->psk == TRUE)
+               bss->security = G_SUPPLICANT_SECURITY_PSK;
+       else if (bss->privacy == TRUE)
+               bss->security = G_SUPPLICANT_SECURITY_WEP;
+       else
+               bss->security = G_SUPPLICANT_SECURITY_NONE;
+}
+
+
 static void bss_property(const char *key, DBusMessageIter *iter,
                                                        void *user_data)
 {
@@ -1356,14 +1369,7 @@ static void bss_property(const char *key, DBusMessageIter *iter,
        SUPPLICANT_DBG("key %s", key);
 
        if (key == NULL) {
-               if (bss->ieee8021x == TRUE)
-                       bss->security = G_SUPPLICANT_SECURITY_IEEE8021X;
-               else if (bss->psk == TRUE)
-                       bss->security = G_SUPPLICANT_SECURITY_PSK;
-               else if (bss->privacy == TRUE)
-                       bss->security = G_SUPPLICANT_SECURITY_WEP;
-               else
-                       bss->security = G_SUPPLICANT_SECURITY_NONE;
+               bss_compute_security(bss);
 
                add_or_replace_bss_to_network(bss);
                return;