summaryrefslogtreecommitdiff
path: root/gsupplicant
diff options
context:
space:
mode:
authorJose Blanquicet <jose.blanquicet-melendez@magnetimarelli.com>2017-02-23 09:12:35 +0000
committerDaniel Wagner <wagi@monom.org>2017-03-12 20:32:33 +0100
commit8ce6519c64d0002fd60e91bf65905645ffb7e4b4 (patch)
treee065ef025c0bd98be22b9db8895e9bddc2b6f717 /gsupplicant
parent6da06df119c1dd497056f204ded925160751f1b0 (diff)
downloadconnman-8ce6519c64d0002fd60e91bf65905645ffb7e4b4.tar.gz
gsupplicant: Do not modify ConfigMethods if they are already set
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.
Diffstat (limited to 'gsupplicant')
-rw-r--r--gsupplicant/supplicant.c39
1 files changed, 32 insertions, 7 deletions
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 36c4dd5d..fcf53712 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);