diff options
author | Jose Blanquicet <blanquicet@gmail.com> | 2016-07-13 11:19:37 +0200 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2016-07-13 14:29:02 +0300 |
commit | 81eb5014f6b094562ae4245921e4ea18f7a5c6a7 (patch) | |
tree | 94af0e0ecabc26dff9b5f7fb72bfe17b25057741 | |
parent | e8986b8f14a05172590d215a0ab983b8c386ae8f (diff) | |
download | connman-81eb5014f6b094562ae4245921e4ea18f7a5c6a7.tar.gz |
gsupplicant: Avoid skipping wpa_supplicant interfaces
If the wpa_supplicant has been launched before ConnMan, when the Connman
calls the GetAll method on fi.w1.wpa_supplicant1, the properties are
returned as an array where there is an entry named "Interfaces". This
entry is an array itself with only the object path of the current
available interfaces. The problem occurs when ConnMan goes across this
array using the function interface_added(), because this function tries
also to extract the interface properties next to object path which is
wrong because properties are not appended in this message reply. So, by
doing dbus_message_iter_next(iter), we are actually skipping one interface
of the list and it will result in a future error because the skipped
interface(s) were not stored and ConnMan will not be aware of them.
This issue is due to the function interface_added() is also used when
signal "fi.w1.wpa_supplicant1.InterfaceAdded" arrives, and in this
message the properties are actually appended. This patch aims to solve
this issue by distinguishing the caller to avoid trying to extract
properties if they are not appended in the message.
-rw-r--r-- | gsupplicant/supplicant.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index 09a3ac5c..4cb533d2 100644 --- a/gsupplicant/supplicant.c +++ b/gsupplicant/supplicant.c @@ -2320,6 +2320,7 @@ static void interface_added(DBusMessageIter *iter, void *user_data) { GSupplicantInterface *interface; const char *path = NULL; + bool properties_appended = GPOINTER_TO_UINT(user_data); SUPPLICANT_DBG(""); @@ -2338,18 +2339,20 @@ static void interface_added(DBusMessageIter *iter, void *user_data) if (!interface) return; + if (!properties_appended) { + supplicant_dbus_property_get_all(path, + SUPPLICANT_INTERFACE ".Interface", + interface_property, interface, + interface); + return; + } + dbus_message_iter_next(iter); if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_INVALID) { supplicant_dbus_property_foreach(iter, interface_property, interface); interface_property(NULL, NULL, interface); - return; } - - supplicant_dbus_property_get_all(path, - SUPPLICANT_INTERFACE ".Interface", - interface_property, interface, - interface); } static void interface_removed(DBusMessageIter *iter, void *user_data) @@ -2479,7 +2482,7 @@ static void signal_interface_added(const char *path, DBusMessageIter *iter) SUPPLICANT_DBG("path %s %s", path, SUPPLICANT_PATH); if (g_strcmp0(path, SUPPLICANT_PATH) == 0) - interface_added(iter, NULL); + interface_added(iter, GUINT_TO_POINTER(true)); } static void signal_interface_removed(const char *path, DBusMessageIter *iter) |