P2P: Store P2P Device Address in per-device PSK records

This makes the P2P Device Address of the Enrollee available with the PSK
records to allow P2P Device Address instead of P2P Interface Address to
be used for finding the correct PSK.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2013-09-01 10:47:34 +03:00
parent 05766ed8de
commit 52177fbb70
5 changed files with 36 additions and 13 deletions

View file

@ -91,15 +91,24 @@ static int hostapd_wps_for_each(struct hostapd_data *hapd,
}
static int hostapd_wps_new_psk_cb(void *ctx, const u8 *mac_addr, const u8 *psk,
static int hostapd_wps_new_psk_cb(void *ctx, const u8 *mac_addr,
const u8 *p2p_dev_addr, const u8 *psk,
size_t psk_len)
{
struct hostapd_data *hapd = ctx;
struct hostapd_wpa_psk *p;
struct hostapd_ssid *ssid = &hapd->conf->ssid;
wpa_printf(MSG_DEBUG, "Received new WPA/WPA2-PSK from WPS for STA "
MACSTR, MAC2STR(mac_addr));
if (is_zero_ether_addr(p2p_dev_addr)) {
wpa_printf(MSG_DEBUG,
"Received new WPA/WPA2-PSK from WPS for STA " MACSTR,
MAC2STR(mac_addr));
} else {
wpa_printf(MSG_DEBUG,
"Received new WPA/WPA2-PSK from WPS for STA " MACSTR
" P2P Device Addr " MACSTR,
MAC2STR(mac_addr), MAC2STR(p2p_dev_addr));
}
wpa_hexdump_key(MSG_DEBUG, "Per-device PSK", psk, psk_len);
if (psk_len != PMK_LEN) {
@ -113,6 +122,7 @@ static int hostapd_wps_new_psk_cb(void *ctx, const u8 *mac_addr, const u8 *psk,
if (p == NULL)
return -1;
os_memcpy(p->addr, mac_addr, ETH_ALEN);
os_memcpy(p->p2p_dev_addr, p2p_dev_addr, ETH_ALEN);
os_memcpy(p->psk, psk, PMK_LEN);
p->next = ssid->wpa_psk;