]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Reinvite with social operation channel if no common channels
authorRashmi Ramanna <c_ramanr@qti.qualcomm.com>
Wed, 26 Nov 2014 15:53:55 +0000 (21:23 +0530)
committerJouni Malinen <j@w1.fi>
Thu, 27 Nov 2014 15:55:54 +0000 (17:55 +0200)
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>
src/p2p/p2p_i.h
src/p2p/p2p_invitation.c

index 6243d70e2c5ba73785b06890a8a524ff184901aa..b36bb91bb73732bd50441fdc0b729e1219284834 100644 (file)
@@ -269,6 +269,8 @@ struct p2p_data {
        u8 invite_go_dev_addr_buf[ETH_ALEN];
        int invite_dev_pw_id;
 
+       unsigned int retry_invite_req;
+
        /**
         * sd_peer - Pointer to Service Discovery peer
         */
index bac9041e793b09c96748290b46748f3582fa17de..784bfa50f600f9c3e1cd7d650fbccf2c3676f6e0 100644 (file)
@@ -446,6 +446,22 @@ void p2p_process_invitation_resp(struct p2p_data *p2p, const u8 *sa,
                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) {
                p2p_dbg(p2p, "Mandatory Channel List attribute missing in Invitation Response from "
                        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);
        }
        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);
        if (dev == NULL || (dev->listen_freq <= 0 && dev->oper_freq <= 0 &&