[PATCH] Append P2P device address to AP-STA-CONNECTED event for P2P

Jouni Malinen j
Mon Oct 24 14:17:28 PDT 2011

On Fri, Oct 21, 2011 at 09:41:36PM -0700, Jithu Jance wrote:
> For P2P, the p2p_connect takes in device address argument to make a connection. However the connected event [AP-STA-CONNECTED] comes 
> with interface address. The application listening on events would find it difficult to map interface address to the p2p device address which is provided for connection.
> This patch appends P2P device address to AP-STA-CONNECTED event for P2P Client connection.

Thanks, applied with some changes:

> diff --git a/src/ap/ieee802_1x.c b/src/ap/ieee802_1x.c
> @@ -36,6 +36,7 @@
> +#include "p2p/p2p_i.h"

The internal *_i.h header files are not allowed to be included in other
directories, so I moved the function prototype into p2p.h instead.

> diff --git a/src/p2p/p2p_group.c b/src/p2p/p2p_group.c
> @@ -542,6 +542,17 @@ static struct p2p_group_member * p2p_group_get_client_iface(
>  	return NULL;
>  }
> +const u8* p2p_group_get_dev_addr(struct p2p_group *group, const u8 *addr)
> +{
> +	struct p2p_group_member *m;
> +
> +	m = p2p_group_get_client_iface(group, addr);

This could potentially result in NULL pointer deference in some cases,
so I added a validation on group != NULL here to be sure that non-P2P AP
mode does not hit this.

> +    if(m)
> +		return m->dev_addr;

This can return 00:00:00:00:00:00 for non-P2P devices in the group. That
does not sound correct, so I added !is_zero_ether_addr condition here.

Jouni Malinen                                            PGP id EFC895FA

More information about the Hostap mailing list