[PATCH 6/9] wpas: Add p2p utility function to get go iface from a peer dev address
Jouni Malinen
j
Fri May 16 08:17:27 PDT 2014
On Wed, May 14, 2014 at 04:10:43PM +0300, Tomasz Bursztyka wrote:
> 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.
> diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
> @@ -16,6 +16,7 @@
> #include "p2p/p2p.h"
> +#include "p2p/p2p_i.h"
Same here.. Not allowed due to p2p_i.h being internal and
p2p_supplicant.c shall not poke at struct p2p_data directly.
> @@ -3630,11 +3631,9 @@ static int wpas_get_noa(void *ctx, const u8 *interface_addr, u8 *buf,
> +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;
> }
This function would need to live in src/p2p or well, the initial part of
this to get the p2p_group_get_interface_addr() return value.
--
Jouni Malinen PGP id EFC895FA
More information about the Hostap
mailing list