]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Skip D-Bus signals if the dbus_path is not yet set
authorJouni Malinen <j@w1.fi>
Sun, 23 May 2010 17:23:11 +0000 (20:23 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 23 May 2010 17:23:11 +0000 (20:23 +0300)
This avoids an invalid D-Bus call during interface initialization.
The wpa_state change can happen before the D-Bus interface is set up,
so we must be preparted to handle this early event signal. In theory,
it should be possible to reorder initialization code to make sure
D-Bus signals are ready, but that would likely require quite a bit of
code restructuring, so it looks like a safer option for now is to just
skip the early event.

wpa_supplicant/dbus/dbus_new.c
wpa_supplicant/dbus/dbus_old.c

index 30c9872f27a21cdc955bcc9b66b7c4be2bc842c5..bdfbbac125d0a6f24c07712b05685e897bf2e43b 100644 (file)
@@ -665,6 +665,9 @@ void wpas_dbus_signal_prop_changed(struct wpa_supplicant *wpa_s,
        WPADBusPropertyAccessor getter;
        char *prop;
 
+       if (wpa_s->dbus_new_path == NULL)
+               return; /* Skip signal since D-Bus setup is not yet ready */
+
        switch (property) {
        case WPAS_DBUS_PROP_AP_SCAN:
                getter = (WPADBusPropertyAccessor) wpas_dbus_getter_ap_scan;
index 437a04dc92ae03e1ef21f6b57fba21249d9b14c2..7f25bf03a1e360e373ceab2f6c6bc8c1f52999dd 100644 (file)
@@ -410,6 +410,9 @@ void wpa_supplicant_dbus_notify_state_change(struct wpa_supplicant *wpa_s,
        DBusMessage *_signal = NULL;
        const char *new_state_str, *old_state_str;
 
+       if (wpa_s->dbus_path == NULL)
+               return; /* Skip signal since D-Bus setup is not yet ready */
+
        /* Do nothing if the control interface is not turned on */
        if (wpa_s->global == NULL)
                return;