dbus: Pass in MAC address in CreateInterface method
chromeOS uses random generated MAC address for AP interface so that the device could remain anonymous and untrackable. Add an address parameter for CreateInterface method to pass in OS managed MAC address. Signed-off-by: Jintao Lin <jintaolin@chromium.org>
This commit is contained in:
parent
b0722cf75e
commit
87bad8afad
2 changed files with 16 additions and 1 deletions
|
@ -43,6 +43,7 @@ registered in the bus with fi.w1.wpa_supplicant1 name.
|
||||||
<tr><td>ConfigFile</td><td>s</td><td>Configuration file path</td><td>No</td>
|
<tr><td>ConfigFile</td><td>s</td><td>Configuration file path</td><td>No</td>
|
||||||
<tr><td>Create</td><td>b</td><td>Whether to create a new interface in the kernel</td><td>No</td>
|
<tr><td>Create</td><td>b</td><td>Whether to create a new interface in the kernel</td><td>No</td>
|
||||||
<tr><td>Type</td><td>s</td><td>Interface type to create (sta or ap)</td><td>No</td>
|
<tr><td>Type</td><td>s</td><td>Interface type to create (sta or ap)</td><td>No</td>
|
||||||
|
<tr><td>Address</td><td>s</td><td>MAC address in colon-delimited format to be used in the created interface</td><td>No</td>
|
||||||
</table>
|
</table>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
|
@ -774,6 +774,7 @@ DBusMessage * wpas_dbus_handler_create_interface(DBusMessage *message,
|
||||||
char *confname = NULL;
|
char *confname = NULL;
|
||||||
char *bridge_ifname = NULL;
|
char *bridge_ifname = NULL;
|
||||||
bool create_iface = false;
|
bool create_iface = false;
|
||||||
|
u8 *if_addr = NULL;
|
||||||
enum wpa_driver_if_type if_type = WPA_IF_STATION;
|
enum wpa_driver_if_type if_type = WPA_IF_STATION;
|
||||||
|
|
||||||
dbus_message_iter_init(message, &iter);
|
dbus_message_iter_init(message, &iter);
|
||||||
|
@ -826,6 +827,18 @@ DBusMessage * wpas_dbus_handler_create_interface(DBusMessage *message,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
wpa_dbus_dict_entry_clear(&entry);
|
wpa_dbus_dict_entry_clear(&entry);
|
||||||
|
} else if (os_strcmp(entry.key, "Address") == 0 &&
|
||||||
|
entry.type == DBUS_TYPE_STRING) {
|
||||||
|
if_addr = os_malloc(ETH_ALEN);
|
||||||
|
if (if_addr == NULL) {
|
||||||
|
wpa_dbus_dict_entry_clear(&entry);
|
||||||
|
goto oom;
|
||||||
|
}
|
||||||
|
if (hwaddr_aton(entry.str_value, if_addr)) {
|
||||||
|
wpa_dbus_dict_entry_clear(&entry);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
wpa_dbus_dict_entry_clear(&entry);
|
||||||
} else {
|
} else {
|
||||||
wpa_dbus_dict_entry_clear(&entry);
|
wpa_dbus_dict_entry_clear(&entry);
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -855,7 +868,7 @@ DBusMessage * wpas_dbus_handler_create_interface(DBusMessage *message,
|
||||||
__func__, ifname);
|
__func__, ifname);
|
||||||
if (!global->ifaces ||
|
if (!global->ifaces ||
|
||||||
wpa_drv_if_add(global->ifaces, if_type, ifname,
|
wpa_drv_if_add(global->ifaces, if_type, ifname,
|
||||||
NULL, NULL, NULL, mac_addr,
|
if_addr, NULL, NULL, mac_addr,
|
||||||
NULL) < 0) {
|
NULL) < 0) {
|
||||||
reply = wpas_dbus_error_unknown_error(
|
reply = wpas_dbus_error_unknown_error(
|
||||||
message,
|
message,
|
||||||
|
@ -895,6 +908,7 @@ out:
|
||||||
os_free(ifname);
|
os_free(ifname);
|
||||||
os_free(confname);
|
os_free(confname);
|
||||||
os_free(bridge_ifname);
|
os_free(bridge_ifname);
|
||||||
|
os_free(if_addr);
|
||||||
return reply;
|
return reply;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
|
Loading…
Reference in a new issue