D-Bus: Add a dbus handler for expected disconnection

Add a global D-Bus handler ExpectDisconnect for setting
wpa_s->own_disconnect_req flag. This flag will prevent wpa_supplicant
from adding blacklists and requesting incomplete scan upon the incoming
disconnection. This is mainly meant for a case where suspend/resume is
used and some external component knows about that and can provide the
information to wpa_supplicant before the disconnection happens.

Signed-off-by: Ningyuan Wang <nywang@google.com>
This commit is contained in:
Ningyuan Wang 2015-09-29 14:13:33 -07:00 committed by Jouni Malinen
parent 7966674d73
commit c143c3b72a
4 changed files with 35 additions and 0 deletions

View File

@ -97,6 +97,11 @@ registered in the bus with fi.w1.wpa_supplicant1 name.
<dd>Getting an interface object path failed for an unknown reason.</dd>
</dl>
</li>
<li>
<h3>ExpectDisconnect ( ) --> nothing</h3>
<p>Notify wpa_supplicant of an externally triggered disconnection, e.g., due to system suspend.</p>
</li>
</ul>
\subsection dbus_main_properties Properties

View File

@ -2172,6 +2172,12 @@ static const struct wpa_dbus_method_desc wpas_dbus_global_methods[] = {
END_ARGS
}
},
{ "ExpectDisconnect", WPAS_DBUS_NEW_INTERFACE,
(WPADBusMethodHandler) wpas_dbus_handler_expect_disconnect,
{
END_ARGS
}
},
{ NULL, NULL, NULL, { END_ARGS } }
};

View File

@ -1579,6 +1579,27 @@ DBusMessage * wpas_dbus_handler_reassociate(DBusMessage *message,
}
/**
* wpas_dbus_handler_expect_disconnect - ExpectDisconnect
* @message: Pointer to incoming dbus message
* @global: %wpa_supplicant global data structure
* Returns: NULL
*
* Handler function for notifying system there will be a expected disconnect.
* This will prevent wpa_supplicant from adding blacklists upon next disconnect..
*/
DBusMessage * wpas_dbus_handler_expect_disconnect(DBusMessage *message,
struct wpa_global *global)
{
struct wpa_supplicant *wpa_s = global->ifaces;
for (; wpa_s; wpa_s = wpa_s->next)
if (wpa_s->wpa_state >= WPA_ASSOCIATED)
wpa_s->own_disconnect_req = 1;
return NULL;
}
/**
* wpas_dbus_handler_reattach - Reattach to current AP
* @message: Pointer to incoming dbus message

View File

@ -50,6 +50,9 @@ DBusMessage * wpas_dbus_handler_remove_interface(DBusMessage *message,
DBusMessage * wpas_dbus_handler_get_interface(DBusMessage *message,
struct wpa_global *global);
DBusMessage * wpas_dbus_handler_expect_disconnect(DBusMessage *message,
struct wpa_global *global);
dbus_bool_t wpas_dbus_getter_debug_level(DBusMessageIter *iter,
DBusError *error,
void *user_data);