]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Do not change SSID during GO negotiation
authorJouni Malinen <jouni@qca.qualcomm.com>
Tue, 11 Oct 2011 15:29:31 +0000 (18:29 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 11 Oct 2011 15:29:31 +0000 (18:29 +0300)
If GO Negotiation Request (or in theory, also GO Negotiation Response)
frame is delivered multiple time for processing, the SSID of the group
could end up getting changed. This could result in possible issues if
the peer ended up using different SSID. To avoid this, make sure the
SSID does not get changed unless the negotiation is for a new group.

src/p2p/p2p.c
src/p2p/p2p_go_neg.c
src/p2p/p2p_i.h

index 25d4d55e5c5ebdfaa7aa29069d6bf961c357466b..259f85422b79fb92d0a518ca64cc894c1c88f0c6 100644 (file)
@@ -1047,6 +1047,7 @@ int p2p_connect(struct p2p_data *p2p, const u8 *peer_addr,
        if (p2p_prepare_channel(p2p, force_freq) < 0)
                return -1;
 
+       p2p->ssid_set = 0;
        dev = p2p_get_device(p2p, peer_addr);
        if (dev == NULL || (dev->flags & P2P_DEV_PROBE_REQ_ONLY)) {
                wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
@@ -1314,6 +1315,7 @@ void p2p_go_complete(struct p2p_data *p2p, struct p2p_device *peer)
        res.peer_config_timeout = go ? peer->client_timeout : peer->go_timeout;
 
        p2p_clear_timeout(p2p);
+       p2p->ssid_set = 0;
        peer->go_neg_req_sent = 0;
        peer->wps_method = WPS_NOT_READY;
 
index be04fadf84d156446d3f61ae93697c370e2c4253..b506a80b96424ce5eb07122d2eb9f468153a5262 100644 (file)
@@ -581,7 +581,10 @@ void p2p_process_go_neg_req(struct p2p_data *p2p, const u8 *sa,
                                                   p2p->op_channel))
                                p2p_reselect_channel(p2p, &intersection);
 
-                       p2p_build_ssid(p2p, p2p->ssid, &p2p->ssid_len);
+                       if (!p2p->ssid_set) {
+                               p2p_build_ssid(p2p, p2p->ssid, &p2p->ssid_len);
+                               p2p->ssid_set = 1;
+                       }
                }
 
                dev->go_state = go ? LOCAL_GO : REMOTE_GO;
@@ -950,7 +953,10 @@ void p2p_process_go_neg_resp(struct p2p_data *p2p, const u8 *sa,
                                           p2p->op_channel))
                        p2p_reselect_channel(p2p, &intersection);
 
-               p2p_build_ssid(p2p, p2p->ssid, &p2p->ssid_len);
+               if (!p2p->ssid_set) {
+                       p2p_build_ssid(p2p, p2p->ssid, &p2p->ssid_len);
+                       p2p->ssid_set = 1;
+               }
        }
 
        p2p_set_state(p2p, P2P_GO_NEG);
index 52d931165ccc43ae1be50ad16405a6cf442942c4..0e731368615c0bba836d62da29f3318e386db3e9 100644 (file)
@@ -272,6 +272,11 @@ struct p2p_data {
         */
        size_t ssid_len;
 
+       /**
+        * ssid_set - Whether SSID is already set for GO Negotiation
+        */
+       int ssid_set;
+
        /**
         * Regulatory class for own operational channel
         */