[PATCH 3/7] wpas: Add p2p utility function to get go iface from a peer dev address
Jouni Malinen
j
Wed May 21 14:14:42 PDT 2014
On Tue, May 20, 2014 at 02:51:10PM +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.
Hmm.. There is something quite confusing about these patches and how the
use P2P Device vs. Interface Addresses..
> -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)
> if (os_memcmp(wpa_s->go_dev_addr, dev_addr, ETH_ALEN) == 0)
> - return 1;
> + return wpa_s;
So this dev_addr here is the P2P Device Address of the GO that this
interface is connected to as a P2P Client.
> +struct wpa_supplicant *wpas_get_go_p2p_go(struct wpa_supplicant *wpa_s,
> + const u8 *dev_addr)
> +{
> + const u8 *go_dev_addr;
> +
> + go_dev_addr = p2p_get_own_go_device_address(wpa_s->global->p2p,
> + dev_addr);
> + if (go_dev_addr == NULL)
> + return NULL;
> +
> + for (wpa_s = wpa_s->global->ifaces; wpa_s; wpa_s = wpa_s->next) {
> + if (os_memcmp(wpa_s->go_dev_addr, go_dev_addr, ETH_ALEN) == 0)
> + return wpa_s;
> + }
wpa_s->go_dev_addr is that P2P Device Address of the GO, but go_dev_addr
from p2p_get_own_go_device_address() was P2P Interface Address.. This
type of matching will fail if the GO uses a design where the P2P Device
Address and P2P Interface Address(es) are different.
--
Jouni Malinen PGP id EFC895FA
More information about the Hostap
mailing list