[PATCH 2/7] p2p: Add a utility function to retrieve local GO device address
Jouni Malinen
j
Wed May 21 14:04:37 PDT 2014
On Tue, May 20, 2014 at 02:51:09PM +0300, Tomasz Bursztyka wrote:
> Provided the given device address in the parameters belongs to a peer
> device. This will be useful in wpa_supplicant part.
> diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
> +const u8 *p2p_get_own_go_device_address(struct p2p_data *p2p,
> + const u8 *peer_dev_addr)
> +{
> + int i;
> +
> + for (i = 0; i < p2p->num_groups; i++) {
> + if (p2p_group_is_client_connected(p2p->groups[i],
> + peer_dev_addr))
> + break;
> + }
> +
> + if (i >= p2p->num_groups)
> + return NULL;
> +
> + return p2p_group_get_interface_addr(p2p->groups[i]);
This function is named very confusingly. "device_address" seems to point
towards P2P Device Address, but this is clearly returning a P2P
Interface Address. In addition, it should be understood that more than a
single group may match, i.e., this function would return _a_ local P2P
Interface Address instead of _the_ address. This may still be useful,
but it would be better to rename the function and note that possibility
of multiple matches even if it is a bit unlikely to show up in practical
use cases.
--
Jouni Malinen PGP id EFC895FA
More information about the Hostap
mailing list