diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h index cf5efbc94..34734506a 100644 --- a/src/p2p/p2p.h +++ b/src/p2p/p2p.h @@ -1788,7 +1788,7 @@ unsigned int p2p_get_group_num_members(struct p2p_group *group); * @group: P2P group context from p2p_group_init() * @next: iteration pointer, must be a pointer to a void * that is set to %NULL * on the first call and not modified later - * Returns: A P2P Interface Address for each call and %NULL for no more members + * Returns: A P2P Device Address for each call and %NULL for no more members */ const u8 * p2p_iterate_group_members(struct p2p_group *group, void **next); diff --git a/src/p2p/p2p_group.c b/src/p2p/p2p_group.c index c678208b9..aa075bdb2 100644 --- a/src/p2p/p2p_group.c +++ b/src/p2p/p2p_group.c @@ -973,7 +973,7 @@ const u8 * p2p_iterate_group_members(struct p2p_group *group, void **next) if (!iter) return NULL; - return iter->addr; + return iter->dev_addr; } diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c index 71cf1c937..7823f3ac4 100644 --- a/wpa_supplicant/dbus/dbus_new.c +++ b/wpa_supplicant/dbus/dbus_new.c @@ -1398,15 +1398,15 @@ nomem: * constructed using p2p i/f addr used for connecting. * * @wpa_s: %wpa_supplicant network interface data - * @member_addr: addr (p2p i/f) of the peer joining the group + * @peer_addr: P2P Device Address of the peer joining the group */ void wpas_dbus_signal_p2p_peer_joined(struct wpa_supplicant *wpa_s, - const u8 *member) + const u8 *peer_addr) { struct wpas_dbus_priv *iface; DBusMessage *msg; DBusMessageIter iter; - char groupmember_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path; + char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path; iface = wpa_s->global->dbus; @@ -1417,10 +1417,10 @@ void wpas_dbus_signal_p2p_peer_joined(struct wpa_supplicant *wpa_s, if (!wpa_s->dbus_groupobj_path) return; - os_snprintf(groupmember_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, - "%s/" WPAS_DBUS_NEW_P2P_GROUPMEMBERS_PART "/" + os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, + "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR, - wpa_s->dbus_groupobj_path, MAC2STR(member)); + wpa_s->parent->dbus_new_path, MAC2STR(peer_addr)); msg = dbus_message_new_signal(wpa_s->dbus_groupobj_path, WPAS_DBUS_NEW_IFACE_P2P_GROUP, @@ -1429,7 +1429,7 @@ void wpas_dbus_signal_p2p_peer_joined(struct wpa_supplicant *wpa_s, return; dbus_message_iter_init_append(msg, &iter); - path = groupmember_obj_path; + path = peer_obj_path; if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH, &path)) goto err; @@ -1449,18 +1449,18 @@ err: * * Method to emit a signal for a peer disconnecting the group. * The signal will carry path to the group member object - * constructed using p2p i/f addr used for connecting. + * constructed using the P2P Device Address of the peer. * * @wpa_s: %wpa_supplicant network interface data - * @member_addr: addr (p2p i/f) of the peer joining the group + * @peer_addr: P2P Device Address of the peer joining the group */ void wpas_dbus_signal_p2p_peer_disconnected(struct wpa_supplicant *wpa_s, - const u8 *member) + const u8 *peer_addr) { struct wpas_dbus_priv *iface; DBusMessage *msg; DBusMessageIter iter; - char groupmember_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path; + char peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path; iface = wpa_s->global->dbus; @@ -1471,10 +1471,10 @@ void wpas_dbus_signal_p2p_peer_disconnected(struct wpa_supplicant *wpa_s, if (!wpa_s->dbus_groupobj_path) return; - os_snprintf(groupmember_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, - "%s/" WPAS_DBUS_NEW_P2P_GROUPMEMBERS_PART "/" + os_snprintf(peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, + "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR, - wpa_s->dbus_groupobj_path, MAC2STR(member)); + wpa_s->dbus_groupobj_path, MAC2STR(peer_addr)); msg = dbus_message_new_signal(wpa_s->dbus_groupobj_path, WPAS_DBUS_NEW_IFACE_P2P_GROUP, @@ -1483,7 +1483,7 @@ void wpas_dbus_signal_p2p_peer_disconnected(struct wpa_supplicant *wpa_s, return; dbus_message_iter_init_append(msg, &iter); - path = groupmember_obj_path; + path = peer_obj_path; if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH, &path)) goto err; @@ -3618,109 +3618,6 @@ void wpas_dbus_unregister_p2p_group(struct wpa_supplicant *wpa_s, wpa_s->dbus_groupobj_path = NULL; } -static const struct wpa_dbus_property_desc -wpas_dbus_p2p_groupmember_properties[] = { - { NULL, NULL, NULL, NULL, NULL } -}; - -/** - * wpas_dbus_register_p2p_groupmember - Register a p2p groupmember - * object with dbus - * @wpa_s: wpa_supplicant interface structure - * @p2p_if_addr: i/f addr of the device joining this group - * - * Registers p2p groupmember representing object with dbus - */ -void wpas_dbus_register_p2p_groupmember(struct wpa_supplicant *wpa_s, - const u8 *p2p_if_addr) -{ - struct wpas_dbus_priv *ctrl_iface; - struct wpa_dbus_object_desc *obj_desc = NULL; - struct groupmember_handler_args *arg; - char groupmember_obj_path[WPAS_DBUS_OBJECT_PATH_MAX]; - - /* Do nothing if the control interface is not turned on */ - if (wpa_s == NULL || wpa_s->global == NULL) - return; - - ctrl_iface = wpa_s->global->dbus; - if (ctrl_iface == NULL) - return; - - if (!wpa_s->dbus_groupobj_path) - return; - - os_snprintf(groupmember_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, - "%s/" WPAS_DBUS_NEW_P2P_GROUPMEMBERS_PART "/" COMPACT_MACSTR, - wpa_s->dbus_groupobj_path, MAC2STR(p2p_if_addr)); - - obj_desc = os_zalloc(sizeof(struct wpa_dbus_object_desc)); - if (!obj_desc) { - wpa_printf(MSG_ERROR, "Not enough memory " - "to create object description"); - goto err; - } - - /* allocate memory for handlers arguments */ - arg = os_zalloc(sizeof(struct groupmember_handler_args)); - if (!arg) { - wpa_printf(MSG_ERROR, "Not enough memory " - "to create arguments for method"); - goto err; - } - - arg->wpa_s = wpa_s; - os_memcpy(arg->member_addr, p2p_if_addr, ETH_ALEN); - - wpas_dbus_register(obj_desc, arg, wpa_dbus_free, NULL, - wpas_dbus_p2p_groupmember_properties, NULL); - - if (wpa_dbus_register_object_per_iface(ctrl_iface, groupmember_obj_path, - wpa_s->ifname, obj_desc)) - goto err; - - wpa_printf(MSG_INFO, - "dbus: Registered group member object '%s' successfully", - groupmember_obj_path); - return; - -err: - free_dbus_object_desc(obj_desc); -} - -/** - * wpas_dbus_unregister_p2p_groupmember - Unregister a p2p groupmember - * object with dbus - * @wpa_s: wpa_supplicant interface structure - * @p2p_if_addr: i/f addr of the device joining this group - * - * Unregisters p2p groupmember representing object with dbus - */ -void wpas_dbus_unregister_p2p_groupmember(struct wpa_supplicant *wpa_s, - const u8 *p2p_if_addr) -{ - struct wpas_dbus_priv *ctrl_iface; - char groupmember_obj_path[WPAS_DBUS_OBJECT_PATH_MAX]; - - /* Do nothing if the control interface is not turned on */ - if (wpa_s == NULL || wpa_s->global == NULL) - return; - - ctrl_iface = wpa_s->global->dbus; - if (ctrl_iface == NULL) - return; - - if (!wpa_s->dbus_groupobj_path) - return; - - os_snprintf(groupmember_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, - "%s/" WPAS_DBUS_NEW_P2P_GROUPMEMBERS_PART "/" COMPACT_MACSTR, - wpa_s->dbus_groupobj_path, MAC2STR(p2p_if_addr)); - - wpa_dbus_unregister_object_per_iface(ctrl_iface, groupmember_obj_path); -} - - static const struct wpa_dbus_property_desc wpas_dbus_persistent_group_properties[] = { { "Properties", WPAS_DBUS_NEW_IFACE_PERSISTENT_GROUP, "a{sv}", diff --git a/wpa_supplicant/dbus/dbus_new.h b/wpa_supplicant/dbus/dbus_new.h index 1aec9bea8..9e0ec8910 100644 --- a/wpa_supplicant/dbus/dbus_new.h +++ b/wpa_supplicant/dbus/dbus_new.h @@ -79,10 +79,6 @@ enum wpas_dbus_bss_prop { #define WPAS_DBUS_NEW_P2P_PEERS_PART "Peers" #define WPAS_DBUS_NEW_IFACE_P2P_PEER WPAS_DBUS_NEW_INTERFACE ".Peer" -#define WPAS_DBUS_NEW_P2P_GROUPMEMBERS_PART "Members" -#define WPAS_DBUS_NEW_IFACE_P2P_GROUPMEMBER \ - WPAS_DBUS_NEW_INTERFACE ".GroupMember" - /* Top-level Errors */ #define WPAS_DBUS_ERROR_UNKNOWN_ERROR \ WPAS_DBUS_NEW_INTERFACE ".UnknownError" @@ -201,10 +197,6 @@ int wpas_dbus_unregister_persistent_group(struct wpa_supplicant *wpa_s, int nid); void wpas_dbus_signal_p2p_invitation_result(struct wpa_supplicant *wpa_s, int status, const u8 *bssid); -void wpas_dbus_register_p2p_groupmember(struct wpa_supplicant *wpa_s, - const u8 *p2p_if_addr); -void wpas_dbus_unregister_p2p_groupmember(struct wpa_supplicant *wpa_s, - const u8 *p2p_if_addr); void wpas_dbus_signal_p2p_peer_disconnected(struct wpa_supplicant *wpa_s, const u8 *member); void wpas_dbus_signal_p2p_sd_request(struct wpa_supplicant *wpa_s, diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c index 3fb5f4cf3..a3b63bcce 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c +++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c @@ -1979,9 +1979,9 @@ dbus_bool_t wpas_dbus_getter_p2p_group_members(DBusMessageIter *iter, if (!paths[i]) goto out_of_memory; os_snprintf(paths[i], WPAS_DBUS_OBJECT_PATH_MAX, - "%s/" WPAS_DBUS_NEW_P2P_GROUPMEMBERS_PART + "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR, - wpa_s->dbus_groupobj_path, MAC2STR(addr)); + wpa_s->parent->dbus_new_path, MAC2STR(addr)); i++; } diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.h b/wpa_supplicant/dbus/dbus_new_handlers_p2p.h index ea307a274..67dbfc95f 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.h +++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.h @@ -14,11 +14,6 @@ struct peer_handler_args { u8 p2p_device_addr[ETH_ALEN]; }; -struct groupmember_handler_args { - struct wpa_supplicant *wpa_s; - u8 member_addr[ETH_ALEN]; -}; - /* * P2P Device methods */ diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c index d096357c2..7ba1dec35 100644 --- a/wpa_supplicant/notify.c +++ b/wpa_supplicant/notify.c @@ -536,18 +536,11 @@ static void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s, #ifdef CONFIG_P2P wpas_p2p_notify_ap_sta_authorized(wpa_s, p2p_dev_addr); - /* - * Register a group member object corresponding to this peer and - * emit a PeerJoined signal. This will check if it really is a - * P2P group. - */ - wpas_dbus_register_p2p_groupmember(wpa_s, sta); - /* * Create 'peer-joined' signal on group object -- will also * check P2P itself. */ - wpas_dbus_signal_p2p_peer_joined(wpa_s, sta); + wpas_dbus_signal_p2p_peer_joined(wpa_s, p2p_dev_addr); #endif /* CONFIG_P2P */ /* Notify listeners a new station has been authorized */ @@ -556,20 +549,15 @@ static void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s, static void wpas_notify_ap_sta_deauthorized(struct wpa_supplicant *wpa_s, - const u8 *sta) + const u8 *sta, + const u8 *p2p_dev_addr) { #ifdef CONFIG_P2P - /* - * Unregister a group member object corresponding to this peer - * if this is a P2P group. - */ - wpas_dbus_unregister_p2p_groupmember(wpa_s, sta); - /* * Create 'peer-disconnected' signal on group object if this * is a P2P group. */ - wpas_dbus_signal_p2p_peer_disconnected(wpa_s, sta); + wpas_dbus_signal_p2p_peer_disconnected(wpa_s, p2p_dev_addr); #endif /* CONFIG_P2P */ /* Notify listeners a station has been deauthorized */ @@ -584,7 +572,7 @@ void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s, if (authorized) wpas_notify_ap_sta_authorized(wpa_s, mac_addr, p2p_dev_addr); else - wpas_notify_ap_sta_deauthorized(wpa_s, mac_addr); + wpas_notify_ap_sta_deauthorized(wpa_s, mac_addr, p2p_dev_addr); }