mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-25 00:38:24 -05:00
DBus: Add "Roam" command support
Add D-Bus interface for ROAM command, imitating the existing wpa_cli command. Chromium OS has been carrying a form of this patch for a very long time. I've cleaned it up a bit and documented it. Signed-off-by: Brian Norris <briannorris@chromium.org>
This commit is contained in:
parent
6e757bba8a
commit
17d6ba4c9e
@ -322,6 +322,24 @@ fi.w1.wpa_supplicant1.CreateInterface.
|
|||||||
</dl>
|
</dl>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<h3>Roam ( s : addr ) --> nothing</h3>
|
||||||
|
<p>Initiate a roam to another BSS within the current ESS.</p>
|
||||||
|
<h4>Possible errors</h4>
|
||||||
|
<dl>
|
||||||
|
<dt>fi.w1.wpa_supplicant1.InvalidArgs</dt>
|
||||||
|
<dd>Missing address argument.</dd>
|
||||||
|
<dt>fi.w1.wpa_supplicant1.InvalidArgs</dt>
|
||||||
|
<dd>Invalid hardware address format.</dd>
|
||||||
|
<dt>fi.w1.wpa_supplicant1.InvalidArgs</dt>
|
||||||
|
<dd>Target BSS not found.</dd>
|
||||||
|
<dt>fi.w1.wpa_supplicant1.NotConnected</dt>
|
||||||
|
<dd>Interface is not connected to any network.</dd>
|
||||||
|
<dt>fi.w1.wpa_supplicant1.UnknownError</dt>
|
||||||
|
<dd>Scan processing was not included in the build.</dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<h3>AddBlob ( s : name, ay : data ) --> nothing</h3>
|
<h3>AddBlob ( s : name, ay : data ) --> nothing</h3>
|
||||||
<p>Adds a blob to the interface.</p>
|
<p>Adds a blob to the interface.</p>
|
||||||
|
@ -3212,6 +3212,14 @@ static const struct wpa_dbus_method_desc wpas_dbus_interface_methods[] = {
|
|||||||
END_ARGS
|
END_ARGS
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{ "Roam", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
||||||
|
(WPADBusMethodHandler) wpas_dbus_handler_roam,
|
||||||
|
{
|
||||||
|
{ "addr", "s", ARG_IN },
|
||||||
|
END_ARGS
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
#ifndef CONFIG_NO_CONFIG_BLOBS
|
#ifndef CONFIG_NO_CONFIG_BLOBS
|
||||||
{ "AddBlob", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
{ "AddBlob", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
||||||
(WPADBusMethodHandler) wpas_dbus_handler_add_blob,
|
(WPADBusMethodHandler) wpas_dbus_handler_add_blob,
|
||||||
|
@ -1976,6 +1976,55 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wpas_dbus_handler_roam - Initiate a roam to another BSS within the ESS
|
||||||
|
* @message: Pointer to incoming dbus message
|
||||||
|
* @wpa_s: wpa_supplicant structure for a network interface
|
||||||
|
* Returns: NULL on success or dbus error on failure
|
||||||
|
*
|
||||||
|
* Handler function for "Roam" method call of network interface.
|
||||||
|
*/
|
||||||
|
DBusMessage * wpas_dbus_handler_roam(DBusMessage *message,
|
||||||
|
struct wpa_supplicant *wpa_s)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_NO_SCAN_PROCESSING
|
||||||
|
return wpas_dbus_error_unknown_error(message,
|
||||||
|
"scan processing not included");
|
||||||
|
#else /* CONFIG_NO_SCAN_PROCESSING */
|
||||||
|
u8 bssid[ETH_ALEN];
|
||||||
|
struct wpa_bss *bss;
|
||||||
|
struct wpa_ssid *ssid = wpa_s->current_ssid;
|
||||||
|
char *addr;
|
||||||
|
|
||||||
|
if (!dbus_message_get_args(message, NULL, DBUS_TYPE_STRING, &addr,
|
||||||
|
DBUS_TYPE_INVALID))
|
||||||
|
return wpas_dbus_error_invalid_args(message, NULL);
|
||||||
|
|
||||||
|
if (hwaddr_aton(addr, bssid))
|
||||||
|
return wpas_dbus_error_invalid_args(
|
||||||
|
message, "Invalid hardware address format");
|
||||||
|
|
||||||
|
wpa_printf(MSG_DEBUG, "dbus: Roam " MACSTR, MAC2STR(bssid));
|
||||||
|
|
||||||
|
if (!ssid)
|
||||||
|
return dbus_message_new_error(
|
||||||
|
message, WPAS_DBUS_ERROR_NOT_CONNECTED,
|
||||||
|
"This interface is not connected");
|
||||||
|
|
||||||
|
bss = wpa_bss_get(wpa_s, bssid, ssid->ssid, ssid->ssid_len);
|
||||||
|
if (!bss) {
|
||||||
|
wpa_printf(MSG_DEBUG, "dbus: Roam: Target BSS not found");
|
||||||
|
return wpas_dbus_error_invalid_args(
|
||||||
|
message, "Target BSS not found");
|
||||||
|
}
|
||||||
|
|
||||||
|
wpa_s->reassociate = 1;
|
||||||
|
wpa_supplicant_connect(wpa_s, bss, ssid);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
#endif /* CONFIG_NO_SCAN_PROCESSING */
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef CONFIG_NO_CONFIG_BLOBS
|
#ifndef CONFIG_NO_CONFIG_BLOBS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -117,6 +117,9 @@ DBusMessage * wpas_dbus_handler_select_network(DBusMessage *message,
|
|||||||
DBusMessage * wpas_dbus_handler_network_reply(DBusMessage *message,
|
DBusMessage * wpas_dbus_handler_network_reply(DBusMessage *message,
|
||||||
struct wpa_supplicant *wpa_s);
|
struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
|
DBusMessage * wpas_dbus_handler_roam(DBusMessage *message,
|
||||||
|
struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
DBusMessage * wpas_dbus_handler_add_blob(DBusMessage *message,
|
DBusMessage * wpas_dbus_handler_add_blob(DBusMessage *message,
|
||||||
struct wpa_supplicant *wpa_s);
|
struct wpa_supplicant *wpa_s);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user