From 2c0b31ac7d185ed6464f25df27cb93835ea812e5 Mon Sep 17 00:00:00 2001 From: Tomasz Bursztyka Date: Sat, 28 Apr 2012 12:00:06 +0300 Subject: [PATCH] gsupplicant: Creating an helper function to compute bss security --- gsupplicant/supplicant.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index f7faa8a..8d87dae 100644 --- a/gsupplicant/supplicant.c +++ b/gsupplicant/supplicant.c @@ -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; -- 2.7.4