P2P: Use negotiated channel from invitation for persistent GO
During persistent group re-invocation, GO may end up using a different channel as the operation channel compared to what was indicated in the invitation frames. This may break the connection if the peer device ends up scanning the GO only on the channel from the invitation frame. Fix this by using the negotiated channel (if available) on the GO as the operating channel instead of the channel that was provided in the p2p_invite command to start negotiation. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
800d58721c
commit
dcd25d4c3b
4 changed files with 23 additions and 6 deletions
|
@ -3275,7 +3275,8 @@ static void p2p_timeout_invite_listen(struct p2p_data *p2p)
|
|||
if (p2p->cfg->invitation_result)
|
||||
p2p->cfg->invitation_result(
|
||||
p2p->cfg->cb_ctx, -1, NULL, NULL,
|
||||
p2p->invite_peer->info.p2p_device_addr);
|
||||
p2p->invite_peer->info.p2p_device_addr,
|
||||
0);
|
||||
}
|
||||
p2p_set_state(p2p, P2P_IDLE);
|
||||
}
|
||||
|
|
|
@ -758,6 +758,7 @@ struct p2p_config {
|
|||
* @bssid: P2P Group BSSID or %NULL if not received
|
||||
* @channels: Available operating channels for the group
|
||||
* @addr: Peer address
|
||||
* @freq: Frequency (in MHz) indicated during invitation or 0
|
||||
*
|
||||
* This callback is used to indicate result of an Invitation procedure
|
||||
* started with a call to p2p_invite(). The indicated status code is
|
||||
|
@ -767,7 +768,7 @@ struct p2p_config {
|
|||
*/
|
||||
void (*invitation_result)(void *ctx, int status, const u8 *bssid,
|
||||
const struct p2p_channels *channels,
|
||||
const u8 *addr);
|
||||
const u8 *addr, int freq);
|
||||
|
||||
/**
|
||||
* go_connected - Check whether we are connected to a GO
|
||||
|
|
|
@ -431,9 +431,15 @@ void p2p_process_invitation_resp(struct p2p_data *p2p, const u8 *sa,
|
|||
channels = &intersection;
|
||||
}
|
||||
|
||||
if (p2p->cfg->invitation_result)
|
||||
if (p2p->cfg->invitation_result) {
|
||||
int freq = p2p_channel_to_freq(p2p->op_reg_class,
|
||||
p2p->op_channel);
|
||||
if (freq < 0)
|
||||
freq = 0;
|
||||
p2p->cfg->invitation_result(p2p->cfg->cb_ctx, *msg.status,
|
||||
msg.group_bssid, channels, sa);
|
||||
msg.group_bssid, channels, sa,
|
||||
freq);
|
||||
}
|
||||
|
||||
p2p_parse_free(&msg);
|
||||
|
||||
|
|
|
@ -2846,10 +2846,11 @@ static void wpas_remove_persistent_client(struct wpa_supplicant *wpa_s,
|
|||
|
||||
static void wpas_invitation_result(void *ctx, int status, const u8 *bssid,
|
||||
const struct p2p_channels *channels,
|
||||
const u8 *peer)
|
||||
const u8 *peer, int neg_freq)
|
||||
{
|
||||
struct wpa_supplicant *wpa_s = ctx;
|
||||
struct wpa_ssid *ssid;
|
||||
int freq;
|
||||
|
||||
if (bssid) {
|
||||
wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_INVITATION_RESULT
|
||||
|
@ -2905,9 +2906,17 @@ static void wpas_invitation_result(void *ctx, int status, const u8 *bssid,
|
|||
"starting persistent group");
|
||||
os_sleep(0, 50000);
|
||||
|
||||
freq = wpa_s->p2p_persistent_go_freq;
|
||||
if (neg_freq > 0 && ssid->mode == WPAS_MODE_P2P_GO &&
|
||||
freq_included(channels, neg_freq)) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Use frequence %d MHz from invitation for GO mode",
|
||||
neg_freq);
|
||||
freq = neg_freq;
|
||||
}
|
||||
|
||||
wpas_p2p_group_add_persistent(wpa_s, ssid,
|
||||
ssid->mode == WPAS_MODE_P2P_GO,
|
||||
wpa_s->p2p_persistent_go_freq,
|
||||
freq,
|
||||
wpa_s->p2p_go_ht40, wpa_s->p2p_go_vht,
|
||||
channels,
|
||||
ssid->mode == WPAS_MODE_P2P_GO ?
|
||||
|
|
Loading…
Reference in a new issue