dbus: Redirect P2P request to the managment device if present

In case of a P2P management device being present, it will be up to that
interface to handle P2P requests.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2014-10-23 11:31:21 +03:00 committed by Jouni Malinen
parent bb3df9a569
commit 745d62322b
2 changed files with 122 additions and 11 deletions

View file

@ -950,15 +950,20 @@ void wpas_dbus_signal_p2p_group_removed(struct wpa_supplicant *wpa_s,
DBusMessage *msg; DBusMessage *msg;
DBusMessageIter iter, dict_iter; DBusMessageIter iter, dict_iter;
struct wpas_dbus_priv *iface = wpa_s->global->dbus; struct wpas_dbus_priv *iface = wpa_s->global->dbus;
struct wpa_supplicant *parent;
/* Do nothing if the control interface is not turned on */ /* Do nothing if the control interface is not turned on */
if (iface == NULL) if (iface == NULL)
return; return;
parent = wpa_s->parent;
if (parent->p2p_mgmt)
parent = parent->parent;
if (!wpa_s->dbus_groupobj_path) if (!wpa_s->dbus_groupobj_path)
return; return;
msg = dbus_message_new_signal(wpa_s->parent->dbus_new_path, msg = dbus_message_new_signal(parent->dbus_new_path,
WPAS_DBUS_NEW_IFACE_P2PDEVICE, WPAS_DBUS_NEW_IFACE_P2PDEVICE,
"GroupFinished"); "GroupFinished");
if (msg == NULL) if (msg == NULL)
@ -1034,6 +1039,9 @@ void wpas_dbus_signal_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
if (iface == NULL) if (iface == NULL)
return; return;
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
if (request || !status) { if (request || !status) {
if (config_methods & WPS_CONFIG_DISPLAY) if (config_methods & WPS_CONFIG_DISPLAY)
_signal = request ? _signal = request ?
@ -1119,6 +1127,9 @@ void wpas_dbus_signal_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
if (iface == NULL) if (iface == NULL)
return; return;
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR, "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR,
wpa_s->dbus_new_path, MAC2STR(src)); wpa_s->dbus_new_path, MAC2STR(src));
@ -1245,8 +1256,13 @@ void wpas_dbus_signal_p2p_group_started(struct wpa_supplicant *wpa_s,
DBusMessage *msg; DBusMessage *msg;
DBusMessageIter iter, dict_iter; DBusMessageIter iter, dict_iter;
struct wpas_dbus_priv *iface; struct wpas_dbus_priv *iface;
struct wpa_supplicant *parent;
iface = wpa_s->parent->global->dbus; parent = wpa_s->parent;
if (parent->p2p_mgmt)
parent = parent->parent;
iface = parent->global->dbus;
/* Do nothing if the control interface is not turned on */ /* Do nothing if the control interface is not turned on */
if (iface == NULL) if (iface == NULL)
@ -1256,7 +1272,7 @@ void wpas_dbus_signal_p2p_group_started(struct wpa_supplicant *wpa_s,
return; return;
/* New interface has been created for this group */ /* New interface has been created for this group */
msg = dbus_message_new_signal(wpa_s->parent->dbus_new_path, msg = dbus_message_new_signal(parent->dbus_new_path,
WPAS_DBUS_NEW_IFACE_P2PDEVICE, WPAS_DBUS_NEW_IFACE_P2PDEVICE,
"GroupStarted"); "GroupStarted");
if (msg == NULL) if (msg == NULL)
@ -1315,6 +1331,9 @@ void wpas_dbus_signal_p2p_go_neg_resp(struct wpa_supplicant *wpa_s,
iface = wpa_s->global->dbus; iface = wpa_s->global->dbus;
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
os_memset(freqs, 0, sizeof(freqs)); os_memset(freqs, 0, sizeof(freqs));
/* Do nothing if the control interface is not turned on */ /* Do nothing if the control interface is not turned on */
if (iface == NULL) if (iface == NULL)
@ -1441,6 +1460,9 @@ void wpas_dbus_signal_p2p_invitation_result(struct wpa_supplicant *wpa_s,
if (iface == NULL) if (iface == NULL)
return; return;
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
msg = dbus_message_new_signal(wpa_s->dbus_new_path, msg = dbus_message_new_signal(wpa_s->dbus_new_path,
WPAS_DBUS_NEW_IFACE_P2PDEVICE, WPAS_DBUS_NEW_IFACE_P2PDEVICE,
"InvitationResult"); "InvitationResult");
@ -1486,6 +1508,7 @@ void wpas_dbus_signal_p2p_peer_joined(struct wpa_supplicant *wpa_s,
DBusMessage *msg; DBusMessage *msg;
DBusMessageIter iter; DBusMessageIter iter;
char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path; char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path;
struct wpa_supplicant *parent;
iface = wpa_s->global->dbus; iface = wpa_s->global->dbus;
@ -1496,10 +1519,14 @@ void wpas_dbus_signal_p2p_peer_joined(struct wpa_supplicant *wpa_s,
if (!wpa_s->dbus_groupobj_path) if (!wpa_s->dbus_groupobj_path)
return; return;
parent = wpa_s->parent;
if (parent->p2p_mgmt)
parent = parent->parent;
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/"
COMPACT_MACSTR, COMPACT_MACSTR,
wpa_s->parent->dbus_new_path, MAC2STR(peer_addr)); parent->dbus_new_path, MAC2STR(peer_addr));
msg = dbus_message_new_signal(wpa_s->dbus_groupobj_path, msg = dbus_message_new_signal(wpa_s->dbus_groupobj_path,
WPAS_DBUS_NEW_IFACE_P2P_GROUP, WPAS_DBUS_NEW_IFACE_P2P_GROUP,
@ -1516,7 +1543,7 @@ void wpas_dbus_signal_p2p_peer_joined(struct wpa_supplicant *wpa_s,
dbus_connection_send(iface->con, msg, NULL); dbus_connection_send(iface->con, msg, NULL);
dbus_message_unref(msg); dbus_message_unref(msg);
wpas_dbus_signal_peer_groups_changed(wpa_s->parent, peer_addr); wpas_dbus_signal_peer_groups_changed(parent, peer_addr);
return; return;
@ -1542,6 +1569,7 @@ void wpas_dbus_signal_p2p_peer_disconnected(struct wpa_supplicant *wpa_s,
DBusMessage *msg; DBusMessage *msg;
DBusMessageIter iter; DBusMessageIter iter;
char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path; char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path;
struct wpa_supplicant *parent;
iface = wpa_s->global->dbus; iface = wpa_s->global->dbus;
@ -1552,10 +1580,14 @@ void wpas_dbus_signal_p2p_peer_disconnected(struct wpa_supplicant *wpa_s,
if (!wpa_s->dbus_groupobj_path) if (!wpa_s->dbus_groupobj_path)
return; return;
parent = wpa_s->parent;
if (parent->p2p_mgmt)
parent = parent->parent;
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/"
COMPACT_MACSTR, COMPACT_MACSTR,
wpa_s->dbus_groupobj_path, MAC2STR(peer_addr)); parent->dbus_new_path, MAC2STR(peer_addr));
msg = dbus_message_new_signal(wpa_s->dbus_groupobj_path, msg = dbus_message_new_signal(wpa_s->dbus_groupobj_path,
WPAS_DBUS_NEW_IFACE_P2P_GROUP, WPAS_DBUS_NEW_IFACE_P2P_GROUP,
@ -1572,7 +1604,7 @@ void wpas_dbus_signal_p2p_peer_disconnected(struct wpa_supplicant *wpa_s,
dbus_connection_send(iface->con, msg, NULL); dbus_connection_send(iface->con, msg, NULL);
dbus_message_unref(msg); dbus_message_unref(msg);
wpas_dbus_signal_peer_groups_changed(wpa_s->parent, peer_addr); wpas_dbus_signal_peer_groups_changed(parent, peer_addr);
return; return;
@ -1611,6 +1643,9 @@ void wpas_dbus_signal_p2p_sd_request(struct wpa_supplicant *wpa_s,
if (iface == NULL) if (iface == NULL)
return; return;
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
msg = dbus_message_new_signal(wpa_s->dbus_new_path, msg = dbus_message_new_signal(wpa_s->dbus_new_path,
WPAS_DBUS_NEW_IFACE_P2PDEVICE, WPAS_DBUS_NEW_IFACE_P2PDEVICE,
"ServiceDiscoveryRequest"); "ServiceDiscoveryRequest");
@ -1680,9 +1715,12 @@ void wpas_dbus_signal_p2p_sd_response(struct wpa_supplicant *wpa_s,
if (iface == NULL) if (iface == NULL)
return; return;
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
msg = dbus_message_new_signal(wpa_s->dbus_new_path, msg = dbus_message_new_signal(wpa_s->dbus_new_path,
WPAS_DBUS_NEW_IFACE_P2PDEVICE, WPAS_DBUS_NEW_IFACE_P2PDEVICE,
"ServiceDiscoveryResponse"); "ServiceDiscoveryResponse");
if (msg == NULL) if (msg == NULL)
return; return;
@ -1744,6 +1782,9 @@ static void wpas_dbus_signal_persistent_group(struct wpa_supplicant *wpa_s,
if (iface == NULL) if (iface == NULL)
return; return;
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
os_snprintf(pgrp_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, os_snprintf(pgrp_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART "/%u", "%s/" WPAS_DBUS_NEW_PERSISTENT_GROUPS_PART "/%u",
wpa_s->dbus_new_path, id); wpa_s->dbus_new_path, id);
@ -1832,6 +1873,9 @@ void wpas_dbus_signal_p2p_wps_failed(struct wpa_supplicant *wpa_s,
if (iface == NULL) if (iface == NULL)
return; return;
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
msg = dbus_message_new_signal(wpa_s->dbus_new_path, msg = dbus_message_new_signal(wpa_s->dbus_new_path,
WPAS_DBUS_NEW_IFACE_P2PDEVICE, WPAS_DBUS_NEW_IFACE_P2PDEVICE,
"WpsFailed"); "WpsFailed");
@ -3415,6 +3459,9 @@ static void wpas_dbus_signal_peer(struct wpa_supplicant *wpa_s,
DBusMessageIter iter; DBusMessageIter iter;
char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path; char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path;
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
iface = wpa_s->global->dbus; iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */ /* Do nothing if the control interface is not turned on */
@ -3500,6 +3547,9 @@ int wpas_dbus_register_peer(struct wpa_supplicant *wpa_s, const u8 *dev_addr)
if (ctrl_iface == NULL) if (ctrl_iface == NULL)
return 0; return 0;
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR, "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR,
wpa_s->dbus_new_path, MAC2STR(dev_addr)); wpa_s->dbus_new_path, MAC2STR(dev_addr));
@ -3559,6 +3609,10 @@ int wpas_dbus_unregister_peer(struct wpa_supplicant *wpa_s,
if (wpa_s == NULL || wpa_s->global == NULL || if (wpa_s == NULL || wpa_s->global == NULL ||
wpa_s->dbus_new_path == NULL) wpa_s->dbus_new_path == NULL)
return 0; return 0;
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
ctrl_iface = wpa_s->global->dbus; ctrl_iface = wpa_s->global->dbus;
if (ctrl_iface == NULL) if (ctrl_iface == NULL)
return 0; return 0;
@ -3580,6 +3634,9 @@ void wpas_dbus_signal_peer_groups_changed(struct wpa_supplicant *wpa_s,
{ {
char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX]; char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR, "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR,
wpa_s->dbus_new_path, MAC2STR(dev_addr)); wpa_s->dbus_new_path, MAC2STR(dev_addr));
@ -3723,6 +3780,9 @@ void wpas_dbus_unregister_p2p_group(struct wpa_supplicant *wpa_s,
if (wpa_s == NULL || wpa_s->global == NULL) if (wpa_s == NULL || wpa_s->global == NULL)
return; return;
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
ctrl_iface = wpa_s->global->dbus; ctrl_iface = wpa_s->global->dbus;
if (ctrl_iface == NULL) if (ctrl_iface == NULL)
return; return;
@ -3783,6 +3843,9 @@ int wpas_dbus_register_persistent_group(struct wpa_supplicant *wpa_s,
if (ssid->disabled != 2 && !ssid->p2p_persistent_group) if (ssid->disabled != 2 && !ssid->p2p_persistent_group)
return -1; /* should we return w/o complaining? */ return -1; /* should we return w/o complaining? */
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
ctrl_iface = wpa_s->global->dbus; ctrl_iface = wpa_s->global->dbus;
if (ctrl_iface == NULL) if (ctrl_iface == NULL)
return 0; return 0;
@ -3862,6 +3925,10 @@ int wpas_dbus_unregister_persistent_group(struct wpa_supplicant *wpa_s,
if (wpa_s == NULL || wpa_s->global == NULL || if (wpa_s == NULL || wpa_s->global == NULL ||
wpa_s->dbus_new_path == NULL) wpa_s->dbus_new_path == NULL)
return 0; return 0;
if (wpa_s->p2p_mgmt)
wpa_s = wpa_s->parent;
ctrl_iface = wpa_s->global->dbus; ctrl_iface = wpa_s->global->dbus;
if (ctrl_iface == NULL) if (ctrl_iface == NULL)
return 0; return 0;

View file

@ -127,6 +127,9 @@ DBusMessage * wpas_dbus_handler_p2p_find(DBusMessage *message,
wpa_dbus_dict_entry_clear(&entry); wpa_dbus_dict_entry_clear(&entry);
} }
if (wpa_s->p2p_dev)
wpa_s = wpa_s->p2p_dev;
wpas_p2p_find(wpa_s, timeout, type, num_req_dev_types, req_dev_types, wpas_p2p_find(wpa_s, timeout, type, num_req_dev_types, req_dev_types,
NULL, 0); NULL, 0);
os_free(req_dev_types); os_free(req_dev_types);
@ -144,6 +147,9 @@ error:
DBusMessage * wpas_dbus_handler_p2p_stop_find(DBusMessage *message, DBusMessage * wpas_dbus_handler_p2p_stop_find(DBusMessage *message,
struct wpa_supplicant *wpa_s) struct wpa_supplicant *wpa_s)
{ {
if (wpa_s->p2p_dev)
wpa_s = wpa_s->p2p_dev;
wpas_p2p_stop_find(wpa_s); wpas_p2p_stop_find(wpa_s);
return NULL; return NULL;
} }
@ -162,6 +168,9 @@ DBusMessage * wpas_dbus_handler_p2p_rejectpeer(DBusMessage *message,
if (parse_peer_object_path(peer_object_path, peer_addr) < 0) if (parse_peer_object_path(peer_object_path, peer_addr) < 0)
return wpas_dbus_error_invalid_args(message, NULL); return wpas_dbus_error_invalid_args(message, NULL);
if (wpa_s->p2p_dev)
wpa_s = wpa_s->p2p_dev;
if (wpas_p2p_reject(wpa_s, peer_addr) < 0) if (wpas_p2p_reject(wpa_s, peer_addr) < 0)
return wpas_dbus_error_unknown_error(message, return wpas_dbus_error_unknown_error(message,
"Failed to call wpas_p2p_reject method."); "Failed to call wpas_p2p_reject method.");
@ -180,6 +189,9 @@ DBusMessage * wpas_dbus_handler_p2p_listen(DBusMessage *message,
return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY, return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
NULL); NULL);
if (wpa_s->p2p_dev)
wpa_s = wpa_s->p2p_dev;
if (wpas_p2p_listen(wpa_s, (unsigned int)timeout)) if (wpas_p2p_listen(wpa_s, (unsigned int)timeout))
return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY, return dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY,
NULL); NULL);
@ -217,6 +229,9 @@ DBusMessage * wpas_dbus_handler_p2p_extendedlisten(
wpa_dbus_dict_entry_clear(&entry); wpa_dbus_dict_entry_clear(&entry);
} }
if (wpa_s->p2p_dev)
wpa_s = wpa_s->p2p_dev;
if (wpas_p2p_ext_listen(wpa_s, period, interval)) if (wpas_p2p_ext_listen(wpa_s, period, interval))
return wpas_dbus_error_unknown_error( return wpas_dbus_error_unknown_error(
message, "failed to initiate a p2p_ext_listen."); message, "failed to initiate a p2p_ext_listen.");
@ -265,6 +280,10 @@ DBusMessage * wpas_dbus_handler_p2p_presence_request(
wpa_dbus_dict_entry_clear(&entry); wpa_dbus_dict_entry_clear(&entry);
} }
if (wpa_s->p2p_dev)
wpa_s = wpa_s->p2p_dev;
if (wpas_p2p_presence_req(wpa_s, dur1, int1, dur2, int2) < 0) if (wpas_p2p_presence_req(wpa_s, dur1, int1, dur2, int2) < 0)
return wpas_dbus_error_unknown_error(message, return wpas_dbus_error_unknown_error(message,
"Failed to invoke presence request."); "Failed to invoke presence request.");
@ -319,6 +338,9 @@ DBusMessage * wpas_dbus_handler_p2p_group_add(DBusMessage *message,
wpa_dbus_dict_entry_clear(&entry); wpa_dbus_dict_entry_clear(&entry);
} }
if (wpa_s->p2p_dev)
wpa_s = wpa_s->p2p_dev;
if (pg_object_path != NULL) { if (pg_object_path != NULL) {
/* /*
* A persistent group Object Path is defined meaning we want * A persistent group Object Path is defined meaning we want
@ -410,6 +432,9 @@ DBusMessage * wpas_dbus_handler_p2p_flush(DBusMessage *message,
if (!wpa_dbus_p2p_check_enabled(wpa_s, message, &reply, NULL)) if (!wpa_dbus_p2p_check_enabled(wpa_s, message, &reply, NULL))
return reply; return reply;
if (wpa_s->p2p_dev)
wpa_s = wpa_s->p2p_dev;
os_memset(wpa_s->p2p_auth_invite, 0, ETH_ALEN); os_memset(wpa_s->p2p_auth_invite, 0, ETH_ALEN);
wpa_s->force_long_sd = 0; wpa_s->force_long_sd = 0;
p2p_flush(wpa_s->global->p2p); p2p_flush(wpa_s->global->p2p);
@ -504,6 +529,9 @@ DBusMessage * wpas_dbus_handler_p2p_connect(DBusMessage *message,
if ((!pin || !pin[0]) && (wps_method == WPS_PIN_KEYPAD)) if ((!pin || !pin[0]) && (wps_method == WPS_PIN_KEYPAD))
goto inv_args; goto inv_args;
if (wpa_s->p2p_dev)
wpa_s = wpa_s->p2p_dev;
new_pin = wpas_p2p_connect(wpa_s, addr, pin, wps_method, new_pin = wpas_p2p_connect(wpa_s, addr, pin, wps_method,
persistent_group, 0, join, authorize_only, persistent_group, 0, join, authorize_only,
go_intent, freq, -1, 0, 0, 0); go_intent, freq, -1, 0, 0, 0);
@ -605,6 +633,9 @@ DBusMessage * wpas_dbus_handler_p2p_invite(DBusMessage *message,
goto err; goto err;
} }
if (wpa_s->p2p_dev)
wpa_s = wpa_s->p2p_dev;
if (persistent) { if (persistent) {
/* /*
* A group ID is defined meaning we want to re-invoke a * A group ID is defined meaning we want to re-invoke a
@ -690,6 +721,9 @@ DBusMessage * wpas_dbus_handler_p2p_prov_disc_req(DBusMessage *message,
os_strcmp(config_method, "pushbutton")) os_strcmp(config_method, "pushbutton"))
return wpas_dbus_error_invalid_args(message, NULL); return wpas_dbus_error_invalid_args(message, NULL);
if (wpa_s->p2p_dev)
wpa_s = wpa_s->p2p_dev;
if (wpas_p2p_prov_disc(wpa_s, peer_addr, config_method, if (wpas_p2p_prov_disc(wpa_s, peer_addr, config_method,
WPAS_P2P_PD_FOR_GO_NEG) < 0) WPAS_P2P_PD_FOR_GO_NEG) < 0)
return wpas_dbus_error_unknown_error(message, return wpas_dbus_error_unknown_error(message,
@ -719,6 +753,9 @@ dbus_bool_t wpas_dbus_getter_p2p_device_config(DBusMessageIter *iter,
if (!wpa_dbus_p2p_check_enabled(wpa_s, NULL, NULL, error)) if (!wpa_dbus_p2p_check_enabled(wpa_s, NULL, NULL, error))
return FALSE; return FALSE;
if (wpa_s->p2p_dev)
wpa_s = wpa_s->p2p_dev;
if (!dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT, if (!dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
"a{sv}", &variant_iter) || "a{sv}", &variant_iter) ||
!wpa_dbus_dict_open_write(&variant_iter, &dict_iter)) !wpa_dbus_dict_open_write(&variant_iter, &dict_iter))
@ -860,6 +897,9 @@ dbus_bool_t wpas_dbus_setter_p2p_device_config(DBusMessageIter *iter,
if (!wpa_dbus_p2p_check_enabled(wpa_s, NULL, NULL, error)) if (!wpa_dbus_p2p_check_enabled(wpa_s, NULL, NULL, error))
return FALSE; return FALSE;
if (wpa_s->p2p_dev)
wpa_s = wpa_s->p2p_dev;
dbus_message_iter_recurse(iter, &variant_iter); dbus_message_iter_recurse(iter, &variant_iter);
if (!wpa_dbus_dict_open_read(&variant_iter, &iter_dict, error)) if (!wpa_dbus_dict_open_read(&variant_iter, &iter_dict, error))
return FALSE; return FALSE;
@ -1583,7 +1623,7 @@ dbus_bool_t wpas_dbus_getter_p2p_peer_groups(DBusMessageIter *iter,
struct peer_handler_args *peer_args = user_data; struct peer_handler_args *peer_args = user_data;
const struct p2p_peer_info *info; const struct p2p_peer_info *info;
struct peer_group_data data; struct peer_group_data data;
struct wpa_supplicant *wpa_s_go; struct wpa_supplicant *wpa_s, *wpa_s_go;
dbus_bool_t success = FALSE; dbus_bool_t success = FALSE;
info = p2p_get_peer_found(peer_args->wpa_s->global->p2p, info = p2p_get_peer_found(peer_args->wpa_s->global->p2p,
@ -1595,8 +1635,12 @@ dbus_bool_t wpas_dbus_getter_p2p_peer_groups(DBusMessageIter *iter,
} }
os_memset(&data, 0, sizeof(data)); os_memset(&data, 0, sizeof(data));
wpa_s_go = wpas_get_p2p_client_iface(peer_args->wpa_s,
info->p2p_device_addr); wpa_s = peer_args->wpa_s;
if (wpa_s->p2p_dev)
wpa_s = wpa_s->p2p_dev;
wpa_s_go = wpas_get_p2p_client_iface(wpa_s, info->p2p_device_addr);
if (wpa_s_go) { if (wpa_s_go) {
data.paths = os_calloc(1, sizeof(char *)); data.paths = os_calloc(1, sizeof(char *));
if (data.paths == NULL) if (data.paths == NULL)