Send connman mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.01.org/mailman/listinfo/connman
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of connman digest..."


Today's Topics:

   1. [PATCH] gsupplicant: Do not modify ConfigMethods if they are
      already set ([email protected])


----------------------------------------------------------------------

Message: 1
Date: Thu, 23 Feb 2017 09:12:35 +0000
From: [email protected]
To: [email protected]
Subject: [PATCH] gsupplicant: Do not modify ConfigMethods if they are
        already set
Message-ID:
        
<1487841155-10590-1-git-send-email-jose.blanquicet-melen...@magnetimarelli.com>
        

From: Jose Blanquicet <[email protected]>

If ConnMan does not allow to configure the value to be set to ConfigMethods,
then it should not modify the ones that were configured on wpa_s.

With this patch ConnMan will first verify if the ConfigMethods were already set
on wpa_s before setting its ones. Doing so, ConnMan will not change the
configuration users already set at wpa_s level.

---
 gsupplicant/supplicant.c | 39 ++++++++++++++++++++++++++++++++-------
 1 file changed, 32 insertions(+), 7 deletions(-)

diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 36c4dd5..4a1d147 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -2111,10 +2111,37 @@ static void interface_bss_removed(DBusMessageIter 
*iter, void *user_data)
 
 static void set_config_methods(DBusMessageIter *iter, void *user_data)
 {
-       const char *config_methods = "push_button";
+       dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, user_data);
+}
+
+static void wps_property(const char *key, DBusMessageIter *iter,
+                                                       void *user_data)
+{
+       GSupplicantInterface *interface = user_data;
+
+       if (!interface)
+               return;
+
+       SUPPLICANT_DBG("key: %s", key);
+
+       if (g_strcmp0(key, "ConfigMethods") == 0) {
+               const char *config_methods = "push_button", *str = NULL;
+
+               dbus_message_iter_get_basic(iter, &str);
+               if (str && strlen(str) > 0) {
+                       // It was already set at wpa_s level, don't modify it.
+                       SUPPLICANT_DBG("%s", str);
+                       return;
+               }
+
+               supplicant_dbus_property_set(interface->path,
+                       SUPPLICANT_INTERFACE ".Interface.WPS",
+                       "ConfigMethods", DBUS_TYPE_STRING_AS_STRING,
+                       set_config_methods, NULL, &config_methods, NULL);
+
+               SUPPLICANT_DBG("No value. Set %s", config_methods);
+       }
 
-       dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING,
-                                                       &config_methods);
 }
 
 static void interface_property(const char *key, DBusMessageIter *iter,
@@ -2143,11 +2170,9 @@ static void interface_property(const char *key, 
DBusMessageIter *iter,
                debug_strvalmap("Mode capability", mode_capa_map,
                                                interface->mode_capa);
 
-
-               supplicant_dbus_property_set(interface->path,
+               supplicant_dbus_property_get_all(interface->path,
                                SUPPLICANT_INTERFACE ".Interface.WPS",
-                               "ConfigMethods", DBUS_TYPE_STRING_AS_STRING,
-                               set_config_methods, NULL, NULL, NULL);
+                               wps_property, interface, interface);
 
                if (interface->ready)
                        callback_interface_added(interface);
-- 
1.9.1



------------------------------

Subject: Digest Footer

_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman


------------------------------

End of connman Digest, Vol 16, Issue 24
***************************************

Reply via email to