diff --git a/src/ap/ieee802_1x.c b/src/ap/ieee802_1x.c index 63598e921..f6e9f0866 100644 --- a/src/ap/ieee802_1x.c +++ b/src/ap/ieee802_1x.c @@ -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, diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h index 3d97136f9..aa7889b06 100644 --- a/src/p2p/p2p.h +++ b/src/p2p/p2p.h @@ -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() diff --git a/src/p2p/p2p_group.c b/src/p2p/p2p_group.c index e0f0c5604..58b24c5b0 100644 --- a/src/p2p/p2p_group.c +++ b/src/p2p/p2p_group.c @@ -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;