P2P: Mark peer authorized for persistent group invitation

When p2p_invite persistent=<id> is used to request a persistent group to
be re-invoked, the peer may reply with status=1 (info not yet available)
if upper layer processing of the invitiation is requested. The peer is
ten expected to start another invitation exchanged within 120 seconds if
the user authorizes the connection. Allow this process to be used more
easily by automatically authorizing the peer that we tried to invite to
use this second invitation sequence even if persistent_reconnect=0.

For this mechanism to work, the device that starts the invitation needs
to start listen mode to be able to receive the invitation request from
the peer. At least for now, this is not done automatically, but future
changes could potentially enable this automatically at least if there
are no concurrent operations in progress.

Example sequence on the initiator:

cmd: P2P_INVITE persistent=1 peer=<addr>
event: P2P-INVITATION-RESULT status=1
cmd: P2P_LISTEN 120
wait for peer to start another invitiation round.. group will be
re-invoked automatically

On the peer (with persistent_reconnect=0):

event: P2P-INVITATION-RECEIVED sa=<addr> persistent=1 [freq=<MHz>]
wait for user approval
cmd: P2P_INVITE persistent=1 peer=<addr>
group will be re-invoked automatically

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2013-03-01 21:32:33 +02:00 committed by Jouni Malinen
parent cd1e2309a2
commit 77e4e85321

View File

@ -2364,7 +2364,11 @@ static u8 wpas_invitation_process(void *ctx, const u8 *sa, const u8 *bssid,
goto accept_inv;
}
if (!wpa_s->conf->persistent_reconnect)
if (!is_zero_ether_addr(wpa_s->p2p_auth_invite) &&
os_memcmp(sa, wpa_s->p2p_auth_invite, ETH_ALEN) == 0) {
wpa_printf(MSG_DEBUG, "P2P: Accept previously initiated "
"invitation to re-invoke a persistent group");
} else if (!wpa_s->conf->persistent_reconnect)
return P2P_SC_FAIL_INFO_CURRENTLY_UNAVAILABLE;
for (s = wpa_s->conf->ssid; s; s = s->next) {
@ -2506,6 +2510,12 @@ static void wpas_invitation_result(void *ctx, int status, const u8 *bssid,
if (wpa_s->pending_invite_ssid_id == -1)
return; /* Invitation to active group */
if (status == P2P_SC_FAIL_INFO_CURRENTLY_UNAVAILABLE) {
wpa_printf(MSG_DEBUG, "P2P: Waiting for peer to start another "
"invitation exchange to indicate readiness for "
"re-invocation");
}
if (status != P2P_SC_SUCCESS) {
wpas_p2p_remove_pending_group_interface(wpa_s);
return;
@ -4630,6 +4640,11 @@ int wpas_p2p_invite(struct wpa_supplicant *wpa_s, const u8 *peer_addr,
int force_freq = 0, oper_freq = 0;
int res;
if (peer_addr)
os_memcpy(wpa_s->p2p_auth_invite, peer_addr, ETH_ALEN);
else
os_memset(wpa_s->p2p_auth_invite, 0, ETH_ALEN);
wpa_s->p2p_persistent_go_freq = freq;
wpa_s->p2p_go_ht40 = !!ht40;
if (ssid->mode == WPAS_MODE_P2P_GO) {