[PATCH 6/7] p2p: Add a utility function to run a method on every known peers

Jouni Malinen j
Wed May 21 14:22:59 PDT 2014


On Tue, May 20, 2014 at 02:51:13PM +0300, Tomasz Bursztyka wrote:
> This will be useful in wpa_supplicant part to signal if a peer got its
> group changed

> diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
> @@ -4692,3 +4692,21 @@ void p2p_set_authorized_oob_dev_pw_id(struct p2p_data *p2p, u16 dev_pw_id,
> +void p2p_loop_on_known_peers(struct p2p_data *p2p,
> +			     void (*peer_callback)(struct p2p_peer_info *,
> +						   void *),
> +			     void *user_data)
> +{
> +	struct p2p_device *dev, *n;
> +
> +	if (peer_callback == NULL)
> +		return;
> +
> +	dl_list_for_each_safe(dev, n, &p2p->devices, struct p2p_device, list) {
> +		if (dev == p2p->go_neg_peer)
> +			continue;
> +
> +		peer_callback(&dev->info, user_data);

Could you please clarify why dev == p2p->go_neg_peer case skips the
callback? That looks quite unexpected for a function called
"p2p_loop_on_known_peers"..

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list