P2P: Reinvite with social operation channel if no common channels

If invitation to reinvoke a persistent group from the GO fails with the
peer indicating that there are no common channels, there is no defined
means for the peer to indicate which channel could have worked. Since
this type of issue with available channels changing over time can
happen, try to work around this by retrying invitation using one of the
social channels as the operating channel unless a specific operating
channel was forced for the group.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Rashmi Ramanna 2014-11-26 21:23:55 +05:30 committed by Jouni Malinen
parent 5214f4fafc
commit ac330cfd87
2 changed files with 20 additions and 0 deletions

View file

@ -269,6 +269,8 @@ struct p2p_data {
u8 invite_go_dev_addr_buf[ETH_ALEN]; u8 invite_go_dev_addr_buf[ETH_ALEN];
int invite_dev_pw_id; int invite_dev_pw_id;
unsigned int retry_invite_req;
/** /**
* sd_peer - Pointer to Service Discovery peer * sd_peer - Pointer to Service Discovery peer
*/ */

View file

@ -446,6 +446,22 @@ void p2p_process_invitation_resp(struct p2p_data *p2p, const u8 *sa,
return; return;
} }
if (*msg.status == P2P_SC_FAIL_NO_COMMON_CHANNELS &&
p2p->retry_invite_req &&
p2p_channel_random_social(&p2p->cfg->channels, &p2p->op_reg_class,
&p2p->op_channel) == 0) {
p2p->retry_invite_req = 0;
p2p->cfg->stop_listen(p2p->cfg->cb_ctx);
p2p_set_state(p2p, P2P_INVITE);
p2p_dbg(p2p, "Resend Invitation Request setting op_class %u channel %u as operating channel",
p2p->op_reg_class, p2p->op_channel);
p2p_invite_send(p2p, p2p->invite_peer, p2p->invite_go_dev_addr,
p2p->invite_dev_pw_id);
p2p_parse_free(&msg);
return;
}
p2p->retry_invite_req = 0;
if (!msg.channel_list && *msg.status == P2P_SC_SUCCESS) { if (!msg.channel_list && *msg.status == P2P_SC_SUCCESS) {
p2p_dbg(p2p, "Mandatory Channel List attribute missing in Invitation Response from " p2p_dbg(p2p, "Mandatory Channel List attribute missing in Invitation Response from "
MACSTR, MAC2STR(sa)); MACSTR, MAC2STR(sa));
@ -607,6 +623,8 @@ int p2p_invite(struct p2p_data *p2p, const u8 *peer, enum p2p_invite_role role,
dev_pw_id); dev_pw_id);
} }
p2p->invite_dev_pw_id = dev_pw_id; p2p->invite_dev_pw_id = dev_pw_id;
p2p->retry_invite_req = role == P2P_INVITE_ROLE_GO &&
persistent_group && !force_freq;
dev = p2p_get_device(p2p, peer); dev = p2p_get_device(p2p, peer);
if (dev == NULL || (dev->listen_freq <= 0 && dev->oper_freq <= 0 && if (dev == NULL || (dev->listen_freq <= 0 && dev->oper_freq <= 0 &&