P2P: Append P2P Device Address to AP-STA-CONNECTED event

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.

Append P2P Device Address to AP-STA-CONNECTED event for P2P Client
connection. This will help applications to easily map the P2P Interface
Address to P2P Device Address on CONNECTED event. For non-P2P case, it
will just print the usual STA MAC address alone.

Signed-off-by: Jithu Jance <jithu@broadcom.com>
This commit is contained in:
Jithu Jance 2011-10-25 00:13:03 +03:00 committed by Jouni Malinen
parent 5cbd88d921
commit c9aab27406
3 changed files with 40 additions and 3 deletions

View File

@ -27,6 +27,7 @@
#include "eap_common/eap_wsc_common.h"
#include "eapol_auth/eapol_auth_sm.h"
#include "eapol_auth/eapol_auth_sm_i.h"
#include "p2p/p2p.h"
#include "hostapd.h"
#include "accounting.h"
#include "sta_info.h"
@ -89,9 +90,23 @@ void ieee802_1x_set_sta_authorized(struct hostapd_data *hapd,
return;
if (authorized) {
if (!ap_sta_is_authorized(sta))
wpa_msg(hapd->msg_ctx, MSG_INFO,
AP_STA_CONNECTED MACSTR, MAC2STR(sta->addr));
if (!ap_sta_is_authorized(sta)) {
const u8 *dev_addr = NULL;
#ifdef CONFIG_P2P
dev_addr = p2p_group_get_dev_addr(hapd->p2p_group,
sta->addr);
#endif /* CONFIG_P2P */
if (dev_addr)
wpa_msg(hapd->msg_ctx, MSG_INFO,
AP_STA_CONNECTED MACSTR
" dev_addr=" MACSTR,
MAC2STR(sta->addr), MAC2STR(dev_addr));
else
wpa_msg(hapd->msg_ctx, MSG_INFO,
AP_STA_CONNECTED MACSTR,
MAC2STR(sta->addr));
}
ap_sta_set_authorized(hapd, sta, 1);
res = hostapd_set_authorized(hapd, sta, 1);
hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,

View File

@ -1487,6 +1487,15 @@ unsigned int p2p_get_group_num_members(struct p2p_group *group);
*/
const u8 * p2p_iterate_group_members(struct p2p_group *group, void **next);
/**
* p2p_group_get_dev_addr - Get a P2P Device Address of a client in a group
* @group: P2P group context from p2p_group_init()
* @addr: P2P Interface Address of the client
* Returns: P2P Device Address of the client if found or %NULL if no match
* found
*/
const u8 * p2p_group_get_dev_addr(struct p2p_group *group, const u8 *addr);
/**
* p2p_get_peer_found - Get P2P peer info structure of a found peer
* @p2p: P2P module context from p2p_init()

View File

@ -546,6 +546,19 @@ static struct p2p_group_member * p2p_group_get_client_iface(
}
const u8 * p2p_group_get_dev_addr(struct p2p_group *group, const u8 *addr)
{
struct p2p_group_member *m;
if (group == NULL)
return NULL;
m = p2p_group_get_client_iface(group, addr);
if (m && !is_zero_ether_addr(m->dev_addr))
return m->dev_addr;
return NULL;
}
static struct wpabuf * p2p_build_go_disc_req(void)
{
struct wpabuf *buf;