From: Lucio Maciel <lucio.mac...@hp.com>

If the user changes the security of the AP from wpa to wpa2
or vice-versa, connman correctly updates the network sctruct
but don't reflect it on the service.

This changes the service security and emits a Security PropertyChanged
signal.
---
 src/service.c |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/src/service.c b/src/service.c
index 25d0f9d..249c748 100644
--- a/src/service.c
+++ b/src/service.c
@@ -657,6 +657,19 @@ const char *__connman_service_default(void)
        return __connman_service_type2string(service->type);
 }
 +static void security_changed(struct connman_service *service)
+{
+       const char *str;
+
+       str = security2string(service->security);
+       if (str == NULL)
+               return;
+
+       connman_dbus_property_changed_basic(service->path,
+                               CONNMAN_SERVICE_INTERFACE, "Security",
+                                               DBUS_TYPE_STRING, &str);
+}
+
 static void mode_changed(struct connman_service *service)
 {
        const char *str;
@@ -3750,7 +3763,7 @@ void __connman_service_update_from_network(struct connman_network *network)
        connman_uint8_t strength, value;
        connman_bool_t roaming;
        GSequenceIter *iter;
-       const char *name;
+       const char *name, *security;
        connman_bool_t stats_enable;
        DBG("network %p", network);
@@ -3782,7 +3795,7 @@ void __connman_service_update_from_network(struct connman_network *network)
 roaming:
        roaming = connman_network_get_bool(service->network, "Roaming");
        if (roaming == service->roaming)
-               goto done;
+               goto security;
        stats_enable = stats_enabled(service);
        if (stats_enable == TRUE)
@@ -3799,6 +3812,15 @@ roaming:
        if (iter != NULL)
                g_sequence_sort_changed(iter, service_compare, NULL);
 +security:
+       security = connman_network_get_string(service->network, 
"WiFi.Security");
+       if (!security || service->security == convert_wifi_security(security))
+               goto done;
+
+       service->security = convert_wifi_security(security);
+
+       security_changed(service);
+
 done:
        if (service->type != CONNMAN_SERVICE_TYPE_CELLULAR)
                return;
_______________________________________________
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman

Reply via email to