Skip D-Bus signals if the dbus_path is not yet set

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.
This commit is contained in:
Jouni Malinen 2010-05-23 20:23:11 +03:00
parent 6db1602d5b
commit 7cc5995845
2 changed files with 6 additions and 0 deletions

View 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;

View 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;