@@ -16,6 +16,7 @@
#include "common/wpa_ctrl.h"
#include "wps/wps_i.h"
#include "p2p/p2p.h"
+#include "p2p/p2p_i.h"
#include "ap/hostapd.h"
#include "ap/ap_config.h"
#include "ap/sta_info.h"
@@ -3630,11 +3631,9 @@ static int wpas_get_noa(void *ctx, const u8 *interface_addr, u8 *buf,
return wpa_drv_get_noa(wpa_s, buf, buf_len);
}
-
-static int wpas_go_connected(void *ctx, const u8 *dev_addr)
+struct wpa_supplicant *wpas_get_go_p2p_client(struct wpa_supplicant *wpa_s,
+ const u8 *dev_addr)
{
- struct wpa_supplicant *wpa_s = ctx;
-
for (wpa_s = wpa_s->global->ifaces; wpa_s; wpa_s = wpa_s->next) {
struct wpa_ssid *ssid = wpa_s->current_ssid;
if (ssid == NULL)
@@ -3645,12 +3644,43 @@ static int wpas_go_connected(void *ctx, const u8 *dev_addr)
wpa_s->wpa_state != WPA_GROUP_HANDSHAKE)
continue;
if (os_memcmp(wpa_s->go_dev_addr, dev_addr, ETH_ALEN) == 0)
- return 1;
+ return wpa_s;
}
- return 0;
+ return NULL;
+}
+
+struct wpa_supplicant *wpas_get_go_p2p_go(struct wpa_supplicant *wpa_s,
+ const u8 *dev_addr)
+{
+ struct p2p_data *p2p = wpa_s->global->p2p;
+ int i;
+
+ for (i = 0; i < p2p->num_groups; i++) {
+ if (p2p_group_is_client_connected(p2p->groups[i], dev_addr))
+ break;
+ }
+
+ if (i >= p2p->num_groups)
+ return NULL;
+
+ dev_addr = p2p_group_get_interface_addr(p2p->groups[i]);
+ for (wpa_s = wpa_s->global->ifaces; wpa_s; wpa_s = wpa_s->next) {
+ if (os_memcmp(wpa_s->go_dev_addr, dev_addr, ETH_ALEN) == 0)
+ return wpa_s;
+ }
+
+ return NULL;
}
+static int wpas_go_connected(void *ctx, const u8 *dev_addr)
+{
+ struct wpa_supplicant *wpa_s = ctx;
+
+ if (wpas_get_go_p2p_client(wpa_s, dev_addr) != NULL)
+ return 1;
+ return 0;
+}
static int wpas_is_concurrent_session_active(void *ctx)
{
@@ -142,6 +142,10 @@ int wpas_p2p_get_ht40_mode(struct wpa_supplicant *wpa_s,
struct hostapd_hw_modes *mode, u8 channel);
int wpas_p2p_get_vht80_center(struct wpa_supplicant *wpa_s,
struct hostapd_hw_modes *mode, u8 channel);
+struct wpa_supplicant *wpas_get_go_p2p_client(struct wpa_supplicant *wpa_s,
+ const u8 *dev_addr);
+struct wpa_supplicant *wpas_get_go_p2p_go(struct wpa_supplicant *wpa_s,
+ const u8 *dev_addr);
unsigned int wpas_p2p_search_delay(struct wpa_supplicant *wpa_s);
void wpas_p2p_new_psk_cb(struct wpa_supplicant *wpa_s, const u8 *mac_addr,
const u8 *p2p_dev_addr,
This will be useful for a peer to know if it is part of a group, what is its interface and thus its dbus object path. Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com> --- wpa_supplicant/p2p_supplicant.c | 42 +++++++++++++++++++++++++++++++++++------ wpa_supplicant/p2p_supplicant.h | 4 ++++ 2 files changed, 40 insertions(+), 6 deletions(-)