2 * Wi-Fi Direct - P2P Group Owner Negotiation
3 * Copyright (c) 2009-2010, Atheros Communications
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
12 #include "utils/eloop.h"
13 #include "common/ieee802_11_defs.h"
14 #include "common/wpa_ctrl.h"
15 #include "wps/wps_defs.h"
20 static int p2p_go_det(u8 own_intent, u8 peer_value)
22 u8 peer_intent = peer_value >> 1;
23 if (own_intent == peer_intent) {
24 if (own_intent == P2P_MAX_GO_INTENT)
25 return -1; /* both devices want to become GO */
27 /* Use tie breaker bit to determine GO */
28 return (peer_value & 0x01) ? 0 : 1;
31 return own_intent > peer_intent;
35 int p2p_peer_channels_check(struct p2p_data *p2p, struct p2p_channels *own,
36 struct p2p_device *dev,
37 const u8 *channel_list, size_t channel_list_len)
40 struct p2p_channels *ch;
42 struct p2p_channels intersection;
45 os_memset(ch, 0, sizeof(*ch));
47 end = channel_list + channel_list_len;
51 os_memcpy(dev->country, pos, 3);
52 wpa_hexdump_ascii(MSG_DEBUG, "P2P: Peer country", pos, 3);
53 if (pos[2] != 0x04 && os_memcmp(pos, p2p->cfg->country, 2) != 0) {
54 p2p_info(p2p, "Mismatching country (ours=%c%c peer's=%c%c)",
55 p2p->cfg->country[0], p2p->cfg->country[1],
61 while (pos + 2 < end) {
62 struct p2p_reg_class *cl = &ch->reg_class[ch->reg_classes];
63 cl->reg_class = *pos++;
64 if (pos + 1 + pos[0] > end) {
65 p2p_info(p2p, "Invalid peer Channel List");
69 cl->channels = channels > P2P_MAX_REG_CLASS_CHANNELS ?
70 P2P_MAX_REG_CLASS_CHANNELS : channels;
71 os_memcpy(cl->channel, pos, cl->channels);
74 if (ch->reg_classes == P2P_MAX_REG_CLASSES)
78 p2p_channels_intersect(own, &dev->channels, &intersection);
79 p2p_dbg(p2p, "Own reg_classes %d peer reg_classes %d intersection reg_classes %d",
80 (int) own->reg_classes,
81 (int) dev->channels.reg_classes,
82 (int) intersection.reg_classes);
83 if (intersection.reg_classes == 0) {
84 p2p_info(p2p, "No common channels found");
91 static int p2p_peer_channels(struct p2p_data *p2p, struct p2p_device *dev,
92 const u8 *channel_list, size_t channel_list_len)
94 return p2p_peer_channels_check(p2p, &p2p->channels, dev,
95 channel_list, channel_list_len);
99 u16 p2p_wps_method_pw_id(enum p2p_wps_method wps_method)
101 switch (wps_method) {
102 case WPS_PIN_DISPLAY:
103 return DEV_PW_REGISTRAR_SPECIFIED;
105 return DEV_PW_USER_SPECIFIED;
107 return DEV_PW_PUSHBUTTON;
109 return DEV_PW_NFC_CONNECTION_HANDOVER;
111 return DEV_PW_P2PS_DEFAULT;
113 return DEV_PW_DEFAULT;
118 static const char * p2p_wps_method_str(enum p2p_wps_method wps_method)
120 switch (wps_method) {
121 case WPS_PIN_DISPLAY:
137 static struct wpabuf * p2p_build_go_neg_req(struct p2p_data *p2p,
138 struct p2p_device *peer)
146 #ifdef CONFIG_WIFI_DISPLAY
147 if (p2p->wfd_ie_go_neg)
148 extra = wpabuf_len(p2p->wfd_ie_go_neg);
149 #endif /* CONFIG_WIFI_DISPLAY */
151 if (p2p->vendor_elem && p2p->vendor_elem[VENDOR_ELEM_P2P_GO_NEG_REQ])
152 extra += wpabuf_len(p2p->vendor_elem[VENDOR_ELEM_P2P_GO_NEG_REQ]);
154 buf = wpabuf_alloc(1000 + extra);
158 p2p_buf_add_public_action_hdr(buf, P2P_GO_NEG_REQ, peer->dialog_token);
160 len = p2p_buf_add_ie_hdr(buf);
162 if (peer->flags & P2P_DEV_PREFER_PERSISTENT_GROUP) {
163 group_capab |= P2P_GROUP_CAPAB_PERSISTENT_GROUP;
164 if (peer->flags & P2P_DEV_PREFER_PERSISTENT_RECONN)
165 group_capab |= P2P_GROUP_CAPAB_PERSISTENT_RECONN;
167 if (p2p->cross_connect)
168 group_capab |= P2P_GROUP_CAPAB_CROSS_CONN;
169 if (p2p->cfg->p2p_intra_bss)
170 group_capab |= P2P_GROUP_CAPAB_INTRA_BSS_DIST;
171 p2p_buf_add_capability(buf, p2p->dev_capab &
172 ~P2P_DEV_CAPAB_CLIENT_DISCOVERABILITY,
174 p2p_buf_add_go_intent(buf, (p2p->go_intent << 1) | peer->tie_breaker);
175 p2p_buf_add_config_timeout(buf, p2p->go_timeout, p2p->client_timeout);
176 p2p_buf_add_listen_channel(buf, p2p->cfg->country, p2p->cfg->reg_class,
178 if (p2p->ext_listen_interval)
179 p2p_buf_add_ext_listen_timing(buf, p2p->ext_listen_period,
180 p2p->ext_listen_interval);
181 p2p_buf_add_intended_addr(buf, p2p->intended_addr);
182 p2p_buf_add_channel_list(buf, p2p->cfg->country, &p2p->channels);
183 p2p_buf_add_device_info(buf, p2p, peer);
184 p2p_buf_add_operating_channel(buf, p2p->cfg->country,
185 p2p->op_reg_class, p2p->op_channel);
186 p2p_buf_update_ie_hdr(buf, len);
188 /* WPS IE with Device Password ID attribute */
189 pw_id = p2p_wps_method_pw_id(peer->wps_method);
191 pw_id = peer->oob_pw_id;
192 if (p2p_build_wps_ie(p2p, buf, pw_id, 0) < 0) {
193 p2p_dbg(p2p, "Failed to build WPS IE for GO Negotiation Request");
198 #ifdef CONFIG_WIFI_DISPLAY
199 if (p2p->wfd_ie_go_neg)
200 wpabuf_put_buf(buf, p2p->wfd_ie_go_neg);
201 #endif /* CONFIG_WIFI_DISPLAY */
203 if (p2p->vendor_elem && p2p->vendor_elem[VENDOR_ELEM_P2P_GO_NEG_REQ])
204 wpabuf_put_buf(buf, p2p->vendor_elem[VENDOR_ELEM_P2P_GO_NEG_REQ]);
210 int p2p_connect_send(struct p2p_data *p2p, struct p2p_device *dev)
215 if (dev->flags & P2P_DEV_PD_BEFORE_GO_NEG) {
217 p2p_dbg(p2p, "Use PD-before-GO-Neg workaround for " MACSTR,
218 MAC2STR(dev->info.p2p_device_addr));
219 if (dev->wps_method == WPS_PIN_DISPLAY)
220 config_method = WPS_CONFIG_KEYPAD;
221 else if (dev->wps_method == WPS_PIN_KEYPAD)
222 config_method = WPS_CONFIG_DISPLAY;
223 else if (dev->wps_method == WPS_PBC)
224 config_method = WPS_CONFIG_PUSHBUTTON;
225 else if (dev->wps_method == WPS_P2PS)
226 config_method = WPS_CONFIG_P2PS;
229 return p2p_prov_disc_req(p2p, dev->info.p2p_device_addr,
230 NULL, config_method, 0, 0, 1);
233 freq = dev->listen_freq > 0 ? dev->listen_freq : dev->oper_freq;
234 if (dev->oob_go_neg_freq > 0)
235 freq = dev->oob_go_neg_freq;
237 p2p_dbg(p2p, "No Listen/Operating frequency known for the peer "
238 MACSTR " to send GO Negotiation Request",
239 MAC2STR(dev->info.p2p_device_addr));
243 req = p2p_build_go_neg_req(p2p, dev);
246 p2p_dbg(p2p, "Sending GO Negotiation Request");
247 p2p_set_state(p2p, P2P_CONNECT);
248 p2p->pending_action_state = P2P_PENDING_GO_NEG_REQUEST;
249 p2p->go_neg_peer = dev;
250 eloop_cancel_timeout(p2p_go_neg_wait_timeout, p2p, NULL);
251 dev->flags |= P2P_DEV_WAIT_GO_NEG_RESPONSE;
253 if (p2p_send_action(p2p, freq, dev->info.p2p_device_addr,
254 p2p->cfg->dev_addr, dev->info.p2p_device_addr,
255 wpabuf_head(req), wpabuf_len(req), 500) < 0) {
256 p2p_dbg(p2p, "Failed to send Action frame");
257 /* Use P2P find to recover and retry */
258 p2p_set_timeout(p2p, 0, 0);
260 dev->go_neg_req_sent++;
268 static struct wpabuf * p2p_build_go_neg_resp(struct p2p_data *p2p,
269 struct p2p_device *peer,
270 u8 dialog_token, u8 status,
279 p2p_dbg(p2p, "Building GO Negotiation Response");
281 #ifdef CONFIG_WIFI_DISPLAY
282 if (p2p->wfd_ie_go_neg)
283 extra = wpabuf_len(p2p->wfd_ie_go_neg);
284 #endif /* CONFIG_WIFI_DISPLAY */
286 if (p2p->vendor_elem && p2p->vendor_elem[VENDOR_ELEM_P2P_GO_NEG_RESP])
287 extra += wpabuf_len(p2p->vendor_elem[VENDOR_ELEM_P2P_GO_NEG_RESP]);
289 buf = wpabuf_alloc(1000 + extra);
293 p2p_buf_add_public_action_hdr(buf, P2P_GO_NEG_RESP, dialog_token);
295 len = p2p_buf_add_ie_hdr(buf);
296 p2p_buf_add_status(buf, status);
298 if (peer && peer->go_state == LOCAL_GO) {
299 if (peer->flags & P2P_DEV_PREFER_PERSISTENT_GROUP) {
300 group_capab |= P2P_GROUP_CAPAB_PERSISTENT_GROUP;
301 if (peer->flags & P2P_DEV_PREFER_PERSISTENT_RECONN)
303 P2P_GROUP_CAPAB_PERSISTENT_RECONN;
305 if (p2p->cross_connect)
306 group_capab |= P2P_GROUP_CAPAB_CROSS_CONN;
307 if (p2p->cfg->p2p_intra_bss)
308 group_capab |= P2P_GROUP_CAPAB_INTRA_BSS_DIST;
310 p2p_buf_add_capability(buf, p2p->dev_capab &
311 ~P2P_DEV_CAPAB_CLIENT_DISCOVERABILITY,
313 p2p_buf_add_go_intent(buf, (p2p->go_intent << 1) | tie_breaker);
314 p2p_buf_add_config_timeout(buf, p2p->go_timeout, p2p->client_timeout);
315 if (peer && peer->go_state == REMOTE_GO) {
316 p2p_dbg(p2p, "Omit Operating Channel attribute");
318 p2p_buf_add_operating_channel(buf, p2p->cfg->country,
322 p2p_buf_add_intended_addr(buf, p2p->intended_addr);
323 if (status || peer == NULL) {
324 p2p_buf_add_channel_list(buf, p2p->cfg->country,
326 } else if (peer->go_state == REMOTE_GO) {
327 p2p_buf_add_channel_list(buf, p2p->cfg->country,
330 struct p2p_channels res;
331 p2p_channels_intersect(&p2p->channels, &peer->channels,
333 p2p_buf_add_channel_list(buf, p2p->cfg->country, &res);
335 p2p_buf_add_device_info(buf, p2p, peer);
336 if (peer && peer->go_state == LOCAL_GO) {
337 p2p_buf_add_group_id(buf, p2p->cfg->dev_addr, p2p->ssid,
340 p2p_buf_update_ie_hdr(buf, len);
342 /* WPS IE with Device Password ID attribute */
343 pw_id = p2p_wps_method_pw_id(peer ? peer->wps_method : WPS_NOT_READY);
344 if (peer && peer->oob_pw_id)
345 pw_id = peer->oob_pw_id;
346 if (p2p_build_wps_ie(p2p, buf, pw_id, 0) < 0) {
347 p2p_dbg(p2p, "Failed to build WPS IE for GO Negotiation Response");
352 #ifdef CONFIG_WIFI_DISPLAY
353 if (p2p->wfd_ie_go_neg)
354 wpabuf_put_buf(buf, p2p->wfd_ie_go_neg);
355 #endif /* CONFIG_WIFI_DISPLAY */
357 if (p2p->vendor_elem && p2p->vendor_elem[VENDOR_ELEM_P2P_GO_NEG_RESP])
358 wpabuf_put_buf(buf, p2p->vendor_elem[VENDOR_ELEM_P2P_GO_NEG_RESP]);
365 * p2p_reselect_channel - Re-select operating channel based on peer information
366 * @p2p: P2P module context from p2p_init()
367 * @intersection: Support channel list intersection from local and peer
369 * This function is used to re-select the best channel after having received
370 * information from the peer to allow supported channel lists to be intersected.
371 * This can be used to improve initial channel selection done in
372 * p2p_prepare_channel() prior to the start of GO Negotiation. In addition, this
373 * can be used for Invitation case.
375 void p2p_reselect_channel(struct p2p_data *p2p,
376 struct p2p_channels *intersection)
378 struct p2p_reg_class *cl;
380 u8 op_reg_class, op_channel;
382 const int op_classes_5ghz[] = { 124, 115, 0 };
383 const int op_classes_ht40[] = { 126, 127, 116, 117, 0 };
384 const int op_classes_vht[] = { 128, 0 };
386 if (p2p->own_freq_preference > 0 &&
387 p2p_freq_to_channel(p2p->own_freq_preference,
388 &op_reg_class, &op_channel) == 0 &&
389 p2p_channels_includes(intersection, op_reg_class, op_channel)) {
390 p2p_dbg(p2p, "Pick own channel preference (reg_class %u channel %u) from intersection",
391 op_reg_class, op_channel);
392 p2p->op_reg_class = op_reg_class;
393 p2p->op_channel = op_channel;
397 if (p2p->best_freq_overall > 0 &&
398 p2p_freq_to_channel(p2p->best_freq_overall,
399 &op_reg_class, &op_channel) == 0 &&
400 p2p_channels_includes(intersection, op_reg_class, op_channel)) {
401 p2p_dbg(p2p, "Pick best overall channel (reg_class %u channel %u) from intersection",
402 op_reg_class, op_channel);
403 p2p->op_reg_class = op_reg_class;
404 p2p->op_channel = op_channel;
408 /* First, try to pick the best channel from another band */
409 freq = p2p_channel_to_freq(p2p->op_reg_class, p2p->op_channel);
410 if (freq >= 2400 && freq < 2500 && p2p->best_freq_5 > 0 &&
411 !p2p_channels_includes(intersection, p2p->op_reg_class,
413 p2p_freq_to_channel(p2p->best_freq_5,
414 &op_reg_class, &op_channel) == 0 &&
415 p2p_channels_includes(intersection, op_reg_class, op_channel)) {
416 p2p_dbg(p2p, "Pick best 5 GHz channel (reg_class %u channel %u) from intersection",
417 op_reg_class, op_channel);
418 p2p->op_reg_class = op_reg_class;
419 p2p->op_channel = op_channel;
423 if (freq >= 4900 && freq < 6000 && p2p->best_freq_24 > 0 &&
424 !p2p_channels_includes(intersection, p2p->op_reg_class,
426 p2p_freq_to_channel(p2p->best_freq_24,
427 &op_reg_class, &op_channel) == 0 &&
428 p2p_channels_includes(intersection, op_reg_class, op_channel)) {
429 p2p_dbg(p2p, "Pick best 2.4 GHz channel (reg_class %u channel %u) from intersection",
430 op_reg_class, op_channel);
431 p2p->op_reg_class = op_reg_class;
432 p2p->op_channel = op_channel;
436 /* Select channel with highest preference if the peer supports it */
437 for (i = 0; p2p->cfg->pref_chan && i < p2p->cfg->num_pref_chan; i++) {
438 if (p2p_channels_includes(intersection,
439 p2p->cfg->pref_chan[i].op_class,
440 p2p->cfg->pref_chan[i].chan)) {
441 p2p->op_reg_class = p2p->cfg->pref_chan[i].op_class;
442 p2p->op_channel = p2p->cfg->pref_chan[i].chan;
443 p2p_dbg(p2p, "Pick highest preferred channel (op_class %u channel %u) from intersection",
444 p2p->op_reg_class, p2p->op_channel);
449 /* Try a channel where we might be able to use VHT */
450 if (p2p_channel_select(intersection, op_classes_vht,
451 &p2p->op_reg_class, &p2p->op_channel) == 0) {
452 p2p_dbg(p2p, "Pick possible VHT channel (op_class %u channel %u) from intersection",
453 p2p->op_reg_class, p2p->op_channel);
457 /* Try a channel where we might be able to use HT40 */
458 if (p2p_channel_select(intersection, op_classes_ht40,
459 &p2p->op_reg_class, &p2p->op_channel) == 0) {
460 p2p_dbg(p2p, "Pick possible HT40 channel (op_class %u channel %u) from intersection",
461 p2p->op_reg_class, p2p->op_channel);
465 /* Prefer a 5 GHz channel */
466 if (p2p_channel_select(intersection, op_classes_5ghz,
467 &p2p->op_reg_class, &p2p->op_channel) == 0) {
468 p2p_dbg(p2p, "Pick possible 5 GHz channel (op_class %u channel %u) from intersection",
469 p2p->op_reg_class, p2p->op_channel);
474 * Try to see if the original channel is in the intersection. If
475 * so, no need to change anything, as it already contains some
478 if (p2p_channels_includes(intersection, p2p->op_reg_class,
480 p2p_dbg(p2p, "Using original operating class and channel (op_class %u channel %u) from intersection",
481 p2p->op_reg_class, p2p->op_channel);
486 * Fall back to whatever is included in the channel intersection since
487 * no better options seems to be available.
489 cl = &intersection->reg_class[0];
490 p2p_dbg(p2p, "Pick another channel (reg_class %u channel %u) from intersection",
491 cl->reg_class, cl->channel[0]);
492 p2p->op_reg_class = cl->reg_class;
493 p2p->op_channel = cl->channel[0];
497 int p2p_go_select_channel(struct p2p_data *p2p, struct p2p_device *dev,
500 struct p2p_channels tmp, intersection;
502 p2p_channels_dump(p2p, "own channels", &p2p->channels);
503 p2p_channels_dump(p2p, "peer channels", &dev->channels);
504 p2p_channels_intersect(&p2p->channels, &dev->channels, &tmp);
505 p2p_channels_dump(p2p, "intersection", &tmp);
506 p2p_channels_remove_freqs(&tmp, &p2p->no_go_freq);
507 p2p_channels_dump(p2p, "intersection after no-GO removal", &tmp);
508 p2p_channels_intersect(&tmp, &p2p->cfg->channels, &intersection);
509 p2p_channels_dump(p2p, "intersection with local channel list",
511 if (intersection.reg_classes == 0 ||
512 intersection.reg_class[0].channels == 0) {
513 *status = P2P_SC_FAIL_NO_COMMON_CHANNELS;
514 p2p_dbg(p2p, "No common channels found");
518 if (!p2p_channels_includes(&intersection, p2p->op_reg_class,
520 if (dev->flags & P2P_DEV_FORCE_FREQ) {
521 *status = P2P_SC_FAIL_NO_COMMON_CHANNELS;
522 p2p_dbg(p2p, "Peer does not support the forced channel");
526 p2p_dbg(p2p, "Selected operating channel (op_class %u channel %u) not acceptable to the peer",
527 p2p->op_reg_class, p2p->op_channel);
528 p2p_reselect_channel(p2p, &intersection);
529 } else if (!(dev->flags & P2P_DEV_FORCE_FREQ) &&
530 !p2p->cfg->cfg_op_channel) {
531 p2p_dbg(p2p, "Try to optimize channel selection with peer information received; previously selected op_class %u channel %u",
532 p2p->op_reg_class, p2p->op_channel);
533 p2p_reselect_channel(p2p, &intersection);
536 if (!p2p->ssid_set) {
537 p2p_build_ssid(p2p, p2p->ssid, &p2p->ssid_len);
545 void p2p_process_go_neg_req(struct p2p_data *p2p, const u8 *sa,
546 const u8 *data, size_t len, int rx_freq)
548 struct p2p_device *dev = NULL;
550 struct p2p_message msg;
551 u8 status = P2P_SC_FAIL_INVALID_PARAMS;
555 p2p_dbg(p2p, "Received GO Negotiation Request from " MACSTR "(freq=%d)",
556 MAC2STR(sa), rx_freq);
558 if (p2p_parse(data, len, &msg))
561 if (!msg.capability) {
562 p2p_dbg(p2p, "Mandatory Capability attribute missing from GO Negotiation Request");
563 #ifdef CONFIG_P2P_STRICT
565 #endif /* CONFIG_P2P_STRICT */
569 tie_breaker = *msg.go_intent & 0x01;
571 p2p_dbg(p2p, "Mandatory GO Intent attribute missing from GO Negotiation Request");
572 #ifdef CONFIG_P2P_STRICT
574 #endif /* CONFIG_P2P_STRICT */
577 if (!msg.config_timeout) {
578 p2p_dbg(p2p, "Mandatory Configuration Timeout attribute missing from GO Negotiation Request");
579 #ifdef CONFIG_P2P_STRICT
581 #endif /* CONFIG_P2P_STRICT */
584 if (!msg.listen_channel) {
585 p2p_dbg(p2p, "No Listen Channel attribute received");
588 if (!msg.operating_channel) {
589 p2p_dbg(p2p, "No Operating Channel attribute received");
592 if (!msg.channel_list) {
593 p2p_dbg(p2p, "No Channel List attribute received");
596 if (!msg.intended_addr) {
597 p2p_dbg(p2p, "No Intended P2P Interface Address attribute received");
600 if (!msg.p2p_device_info) {
601 p2p_dbg(p2p, "No P2P Device Info attribute received");
605 if (os_memcmp(msg.p2p_device_addr, sa, ETH_ALEN) != 0) {
606 p2p_dbg(p2p, "Unexpected GO Negotiation Request SA=" MACSTR
607 " != dev_addr=" MACSTR,
608 MAC2STR(sa), MAC2STR(msg.p2p_device_addr));
612 dev = p2p_get_device(p2p, sa);
614 if (msg.status && *msg.status) {
615 p2p_dbg(p2p, "Unexpected Status attribute (%d) in GO Negotiation Request",
617 if (dev && p2p->go_neg_peer == dev &&
618 *msg.status == P2P_SC_FAIL_REJECTED_BY_USER) {
620 * This mechanism for using Status attribute in GO
621 * Negotiation Request is not compliant with the P2P
622 * specification, but some deployed devices use it to
623 * indicate rejection of GO Negotiation in a case where
624 * they have sent out GO Negotiation Response with
625 * status 1. The P2P specification explicitly disallows
626 * this. To avoid unnecessary interoperability issues
627 * and extra frames, mark the pending negotiation as
628 * failed and do not reply to this GO Negotiation
631 p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
632 p2p_go_neg_failed(p2p, *msg.status);
633 p2p_parse_free(&msg);
640 dev = p2p_add_dev_from_go_neg_req(p2p, sa, &msg);
641 else if ((dev->flags & P2P_DEV_PROBE_REQ_ONLY) ||
642 !(dev->flags & P2P_DEV_REPORTED))
643 p2p_add_dev_info(p2p, sa, dev, &msg);
644 else if (!dev->listen_freq && !dev->oper_freq) {
646 * This may happen if the peer entry was added based on PD
647 * Request and no Probe Request/Response frame has been received
648 * from this peer (or that information has timed out).
650 p2p_dbg(p2p, "Update peer " MACSTR
651 " based on GO Neg Req since listen/oper freq not known",
652 MAC2STR(dev->info.p2p_device_addr));
653 p2p_add_dev_info(p2p, sa, dev, &msg);
656 if (p2p->go_neg_peer && p2p->go_neg_peer == dev)
657 eloop_cancel_timeout(p2p_go_neg_wait_timeout, p2p, NULL);
659 if (dev && dev->flags & P2P_DEV_USER_REJECTED) {
660 p2p_dbg(p2p, "User has rejected this peer");
661 status = P2P_SC_FAIL_REJECTED_BY_USER;
662 } else if (dev == NULL ||
663 (dev->wps_method == WPS_NOT_READY &&
664 (p2p->authorized_oob_dev_pw_id == 0 ||
665 p2p->authorized_oob_dev_pw_id !=
666 msg.dev_password_id))) {
667 p2p_dbg(p2p, "Not ready for GO negotiation with " MACSTR,
669 status = P2P_SC_FAIL_INFO_CURRENTLY_UNAVAILABLE;
670 p2p->cfg->go_neg_req_rx(p2p->cfg->cb_ctx, sa,
671 msg.dev_password_id);
672 } else if (p2p->go_neg_peer && p2p->go_neg_peer != dev) {
673 p2p_dbg(p2p, "Already in Group Formation with another peer");
674 status = P2P_SC_FAIL_UNABLE_TO_ACCOMMODATE;
678 if (!p2p->go_neg_peer) {
679 p2p_dbg(p2p, "Starting GO Negotiation with previously authorized peer");
680 if (!(dev->flags & P2P_DEV_FORCE_FREQ)) {
681 p2p_dbg(p2p, "Use default channel settings");
682 p2p->op_reg_class = p2p->cfg->op_reg_class;
683 p2p->op_channel = p2p->cfg->op_channel;
684 os_memcpy(&p2p->channels, &p2p->cfg->channels,
685 sizeof(struct p2p_channels));
687 p2p_dbg(p2p, "Use previously configured forced channel settings");
691 dev->flags &= ~P2P_DEV_NOT_YET_READY;
693 if (!msg.go_intent) {
694 p2p_dbg(p2p, "No GO Intent attribute received");
697 if ((*msg.go_intent >> 1) > P2P_MAX_GO_INTENT) {
698 p2p_dbg(p2p, "Invalid GO Intent value (%u) received",
699 *msg.go_intent >> 1);
703 if (dev->go_neg_req_sent &&
704 os_memcmp(sa, p2p->cfg->dev_addr, ETH_ALEN) > 0) {
705 p2p_dbg(p2p, "Do not reply since peer has higher address and GO Neg Request already sent");
706 p2p_parse_free(&msg);
710 go = p2p_go_det(p2p->go_intent, *msg.go_intent);
712 p2p_dbg(p2p, "Incompatible GO Intent");
713 status = P2P_SC_FAIL_BOTH_GO_INTENT_15;
717 if (p2p_peer_channels(p2p, dev, msg.channel_list,
718 msg.channel_list_len) < 0) {
719 p2p_dbg(p2p, "No common channels found");
720 status = P2P_SC_FAIL_NO_COMMON_CHANNELS;
724 switch (msg.dev_password_id) {
725 case DEV_PW_REGISTRAR_SPECIFIED:
726 p2p_dbg(p2p, "PIN from peer Display");
727 if (dev->wps_method != WPS_PIN_KEYPAD) {
728 p2p_dbg(p2p, "We have wps_method=%s -> incompatible",
729 p2p_wps_method_str(dev->wps_method));
730 status = P2P_SC_FAIL_INCOMPATIBLE_PROV_METHOD;
734 case DEV_PW_USER_SPECIFIED:
735 p2p_dbg(p2p, "Peer entered PIN on Keypad");
736 if (dev->wps_method != WPS_PIN_DISPLAY) {
737 p2p_dbg(p2p, "We have wps_method=%s -> incompatible",
738 p2p_wps_method_str(dev->wps_method));
739 status = P2P_SC_FAIL_INCOMPATIBLE_PROV_METHOD;
743 case DEV_PW_PUSHBUTTON:
744 p2p_dbg(p2p, "Peer using pushbutton");
745 if (dev->wps_method != WPS_PBC) {
746 p2p_dbg(p2p, "We have wps_method=%s -> incompatible",
747 p2p_wps_method_str(dev->wps_method));
748 status = P2P_SC_FAIL_INCOMPATIBLE_PROV_METHOD;
752 case DEV_PW_P2PS_DEFAULT:
753 p2p_dbg(p2p, "Peer using P2PS pin");
754 if (dev->wps_method != WPS_P2PS) {
756 "We have wps_method=%s -> incompatible",
757 p2p_wps_method_str(dev->wps_method));
758 status = P2P_SC_FAIL_INCOMPATIBLE_PROV_METHOD;
763 if (msg.dev_password_id &&
764 msg.dev_password_id == dev->oob_pw_id) {
765 p2p_dbg(p2p, "Peer using NFC");
766 if (dev->wps_method != WPS_NFC) {
767 p2p_dbg(p2p, "We have wps_method=%s -> incompatible",
770 status = P2P_SC_FAIL_INCOMPATIBLE_PROV_METHOD;
775 #ifdef CONFIG_WPS_NFC
776 if (p2p->authorized_oob_dev_pw_id &&
777 msg.dev_password_id ==
778 p2p->authorized_oob_dev_pw_id) {
779 p2p_dbg(p2p, "Using static handover with our device password from NFC Tag");
780 dev->wps_method = WPS_NFC;
781 dev->oob_pw_id = p2p->authorized_oob_dev_pw_id;
784 #endif /* CONFIG_WPS_NFC */
785 p2p_dbg(p2p, "Unsupported Device Password ID %d",
786 msg.dev_password_id);
787 status = P2P_SC_FAIL_INCOMPATIBLE_PROV_METHOD;
791 if (go && p2p_go_select_channel(p2p, dev, &status) < 0)
794 dev->go_state = go ? LOCAL_GO : REMOTE_GO;
795 dev->oper_freq = p2p_channel_to_freq(msg.operating_channel[3],
796 msg.operating_channel[4]);
797 p2p_dbg(p2p, "Peer operating channel preference: %d MHz",
800 if (msg.config_timeout) {
801 dev->go_timeout = msg.config_timeout[0];
802 dev->client_timeout = msg.config_timeout[1];
805 p2p_dbg(p2p, "GO Negotiation with " MACSTR, MAC2STR(sa));
806 if (p2p->state != P2P_IDLE)
807 p2p_stop_find_for_freq(p2p, rx_freq);
808 p2p_set_state(p2p, P2P_GO_NEG);
809 p2p_clear_timeout(p2p);
810 dev->dialog_token = msg.dialog_token;
811 os_memcpy(dev->intended_addr, msg.intended_addr, ETH_ALEN);
812 p2p->go_neg_peer = dev;
813 eloop_cancel_timeout(p2p_go_neg_wait_timeout, p2p, NULL);
814 status = P2P_SC_SUCCESS;
819 dev->status = status;
820 resp = p2p_build_go_neg_resp(p2p, dev, msg.dialog_token, status,
822 p2p_parse_free(&msg);
825 p2p_dbg(p2p, "Sending GO Negotiation Response");
829 freq = p2p_channel_to_freq(p2p->cfg->reg_class,
832 p2p_dbg(p2p, "Unknown regulatory class/channel");
836 if (status == P2P_SC_SUCCESS) {
837 p2p->pending_action_state = P2P_PENDING_GO_NEG_RESPONSE;
838 dev->flags |= P2P_DEV_WAIT_GO_NEG_CONFIRM;
839 if (os_memcmp(sa, p2p->cfg->dev_addr, ETH_ALEN) < 0) {
841 * Peer has smaller address, so the GO Negotiation
842 * Response from us is expected to complete
843 * negotiation. Ignore a GO Negotiation Response from
844 * the peer if it happens to be received after this
845 * point due to a race condition in GO Negotiation
846 * Request transmission and processing.
848 dev->flags &= ~P2P_DEV_WAIT_GO_NEG_RESPONSE;
851 p2p->pending_action_state =
852 P2P_PENDING_GO_NEG_RESPONSE_FAILURE;
853 if (p2p_send_action(p2p, freq, sa, p2p->cfg->dev_addr,
855 wpabuf_head(resp), wpabuf_len(resp), 500) < 0) {
856 p2p_dbg(p2p, "Failed to send Action frame");
863 static struct wpabuf * p2p_build_go_neg_conf(struct p2p_data *p2p,
864 struct p2p_device *peer,
865 u8 dialog_token, u8 status,
866 const u8 *resp_chan, int go)
870 struct p2p_channels res;
874 p2p_dbg(p2p, "Building GO Negotiation Confirm");
876 #ifdef CONFIG_WIFI_DISPLAY
877 if (p2p->wfd_ie_go_neg)
878 extra = wpabuf_len(p2p->wfd_ie_go_neg);
879 #endif /* CONFIG_WIFI_DISPLAY */
881 if (p2p->vendor_elem && p2p->vendor_elem[VENDOR_ELEM_P2P_GO_NEG_CONF])
882 extra += wpabuf_len(p2p->vendor_elem[VENDOR_ELEM_P2P_GO_NEG_CONF]);
884 buf = wpabuf_alloc(1000 + extra);
888 p2p_buf_add_public_action_hdr(buf, P2P_GO_NEG_CONF, dialog_token);
890 len = p2p_buf_add_ie_hdr(buf);
891 p2p_buf_add_status(buf, status);
893 if (peer->go_state == LOCAL_GO) {
894 if (peer->flags & P2P_DEV_PREFER_PERSISTENT_GROUP) {
895 group_capab |= P2P_GROUP_CAPAB_PERSISTENT_GROUP;
896 if (peer->flags & P2P_DEV_PREFER_PERSISTENT_RECONN)
898 P2P_GROUP_CAPAB_PERSISTENT_RECONN;
900 if (p2p->cross_connect)
901 group_capab |= P2P_GROUP_CAPAB_CROSS_CONN;
902 if (p2p->cfg->p2p_intra_bss)
903 group_capab |= P2P_GROUP_CAPAB_INTRA_BSS_DIST;
905 p2p_buf_add_capability(buf, p2p->dev_capab &
906 ~P2P_DEV_CAPAB_CLIENT_DISCOVERABILITY,
908 if (go || resp_chan == NULL)
909 p2p_buf_add_operating_channel(buf, p2p->cfg->country,
913 p2p_buf_add_operating_channel(buf, (const char *) resp_chan,
914 resp_chan[3], resp_chan[4]);
915 p2p_channels_intersect(&p2p->channels, &peer->channels, &res);
916 p2p_buf_add_channel_list(buf, p2p->cfg->country, &res);
918 p2p_buf_add_group_id(buf, p2p->cfg->dev_addr, p2p->ssid,
921 p2p_buf_update_ie_hdr(buf, len);
923 #ifdef CONFIG_WIFI_DISPLAY
924 if (p2p->wfd_ie_go_neg)
925 wpabuf_put_buf(buf, p2p->wfd_ie_go_neg);
926 #endif /* CONFIG_WIFI_DISPLAY */
928 if (p2p->vendor_elem && p2p->vendor_elem[VENDOR_ELEM_P2P_GO_NEG_CONF])
929 wpabuf_put_buf(buf, p2p->vendor_elem[VENDOR_ELEM_P2P_GO_NEG_CONF]);
935 void p2p_process_go_neg_resp(struct p2p_data *p2p, const u8 *sa,
936 const u8 *data, size_t len, int rx_freq)
938 struct p2p_device *dev;
940 struct p2p_message msg;
941 u8 status = P2P_SC_SUCCESS;
944 p2p_dbg(p2p, "Received GO Negotiation Response from " MACSTR
945 " (freq=%d)", MAC2STR(sa), rx_freq);
946 dev = p2p_get_device(p2p, sa);
947 if (dev == NULL || dev->wps_method == WPS_NOT_READY ||
948 dev != p2p->go_neg_peer) {
949 p2p_dbg(p2p, "Not ready for GO negotiation with " MACSTR,
954 if (p2p_parse(data, len, &msg))
957 if (!(dev->flags & P2P_DEV_WAIT_GO_NEG_RESPONSE)) {
958 p2p_dbg(p2p, "Was not expecting GO Negotiation Response - ignore");
959 p2p_parse_free(&msg);
962 dev->flags &= ~P2P_DEV_WAIT_GO_NEG_RESPONSE;
964 if (msg.dialog_token != dev->dialog_token) {
965 p2p_dbg(p2p, "Unexpected Dialog Token %u (expected %u)",
966 msg.dialog_token, dev->dialog_token);
967 p2p_parse_free(&msg);
972 p2p_dbg(p2p, "No Status attribute received");
973 status = P2P_SC_FAIL_INVALID_PARAMS;
977 p2p_dbg(p2p, "GO Negotiation rejected: status %d", *msg.status);
978 dev->go_neg_req_sent = 0;
979 if (*msg.status == P2P_SC_FAIL_INFO_CURRENTLY_UNAVAILABLE) {
980 p2p_dbg(p2p, "Wait for the peer to become ready for GO Negotiation");
981 dev->flags |= P2P_DEV_NOT_YET_READY;
982 eloop_cancel_timeout(p2p_go_neg_wait_timeout, p2p,
984 eloop_register_timeout(120, 0, p2p_go_neg_wait_timeout,
986 if (p2p->state == P2P_CONNECT_LISTEN)
987 p2p_set_state(p2p, P2P_WAIT_PEER_CONNECT);
989 p2p_set_state(p2p, P2P_WAIT_PEER_IDLE);
990 p2p_set_timeout(p2p, 0, 0);
992 p2p_dbg(p2p, "Stop GO Negotiation attempt");
993 p2p_go_neg_failed(p2p, *msg.status);
995 p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
996 p2p_parse_free(&msg);
1000 if (!msg.capability) {
1001 p2p_dbg(p2p, "Mandatory Capability attribute missing from GO Negotiation Response");
1002 #ifdef CONFIG_P2P_STRICT
1003 status = P2P_SC_FAIL_INVALID_PARAMS;
1005 #endif /* CONFIG_P2P_STRICT */
1008 if (!msg.p2p_device_info) {
1009 p2p_dbg(p2p, "Mandatory P2P Device Info attribute missing from GO Negotiation Response");
1010 #ifdef CONFIG_P2P_STRICT
1011 status = P2P_SC_FAIL_INVALID_PARAMS;
1013 #endif /* CONFIG_P2P_STRICT */
1016 if (!msg.intended_addr) {
1017 p2p_dbg(p2p, "No Intended P2P Interface Address attribute received");
1018 status = P2P_SC_FAIL_INVALID_PARAMS;
1022 if (!msg.go_intent) {
1023 p2p_dbg(p2p, "No GO Intent attribute received");
1024 status = P2P_SC_FAIL_INVALID_PARAMS;
1027 if ((*msg.go_intent >> 1) > P2P_MAX_GO_INTENT) {
1028 p2p_dbg(p2p, "Invalid GO Intent value (%u) received",
1029 *msg.go_intent >> 1);
1030 status = P2P_SC_FAIL_INVALID_PARAMS;
1034 go = p2p_go_det(p2p->go_intent, *msg.go_intent);
1036 p2p_dbg(p2p, "Incompatible GO Intent");
1037 status = P2P_SC_FAIL_INCOMPATIBLE_PARAMS;
1041 if (!go && msg.group_id) {
1042 /* Store SSID for Provisioning step */
1043 p2p->ssid_len = msg.group_id_len - ETH_ALEN;
1044 os_memcpy(p2p->ssid, msg.group_id + ETH_ALEN, p2p->ssid_len);
1046 p2p_dbg(p2p, "Mandatory P2P Group ID attribute missing from GO Negotiation Response");
1048 status = P2P_SC_FAIL_INVALID_PARAMS;
1052 if (!msg.config_timeout) {
1053 p2p_dbg(p2p, "Mandatory Configuration Timeout attribute missing from GO Negotiation Response");
1054 #ifdef CONFIG_P2P_STRICT
1055 status = P2P_SC_FAIL_INVALID_PARAMS;
1057 #endif /* CONFIG_P2P_STRICT */
1059 dev->go_timeout = msg.config_timeout[0];
1060 dev->client_timeout = msg.config_timeout[1];
1063 if (!msg.operating_channel && !go) {
1065 * Note: P2P Client may omit Operating Channel attribute to
1066 * indicate it does not have a preference.
1068 p2p_dbg(p2p, "No Operating Channel attribute received");
1069 status = P2P_SC_FAIL_INVALID_PARAMS;
1072 if (!msg.channel_list) {
1073 p2p_dbg(p2p, "No Channel List attribute received");
1074 status = P2P_SC_FAIL_INVALID_PARAMS;
1078 if (p2p_peer_channels(p2p, dev, msg.channel_list,
1079 msg.channel_list_len) < 0) {
1080 p2p_dbg(p2p, "No common channels found");
1081 status = P2P_SC_FAIL_NO_COMMON_CHANNELS;
1085 if (msg.operating_channel) {
1086 dev->oper_freq = p2p_channel_to_freq(msg.operating_channel[3],
1087 msg.operating_channel[4]);
1088 p2p_dbg(p2p, "Peer operating channel preference: %d MHz",
1093 switch (msg.dev_password_id) {
1094 case DEV_PW_REGISTRAR_SPECIFIED:
1095 p2p_dbg(p2p, "PIN from peer Display");
1096 if (dev->wps_method != WPS_PIN_KEYPAD) {
1097 p2p_dbg(p2p, "We have wps_method=%s -> incompatible",
1098 p2p_wps_method_str(dev->wps_method));
1099 status = P2P_SC_FAIL_INCOMPATIBLE_PROV_METHOD;
1103 case DEV_PW_USER_SPECIFIED:
1104 p2p_dbg(p2p, "Peer entered PIN on Keypad");
1105 if (dev->wps_method != WPS_PIN_DISPLAY) {
1106 p2p_dbg(p2p, "We have wps_method=%s -> incompatible",
1107 p2p_wps_method_str(dev->wps_method));
1108 status = P2P_SC_FAIL_INCOMPATIBLE_PROV_METHOD;
1112 case DEV_PW_PUSHBUTTON:
1113 p2p_dbg(p2p, "Peer using pushbutton");
1114 if (dev->wps_method != WPS_PBC) {
1115 p2p_dbg(p2p, "We have wps_method=%s -> incompatible",
1116 p2p_wps_method_str(dev->wps_method));
1117 status = P2P_SC_FAIL_INCOMPATIBLE_PROV_METHOD;
1121 case DEV_PW_P2PS_DEFAULT:
1122 p2p_dbg(p2p, "P2P: Peer using P2PS default pin");
1123 if (dev->wps_method != WPS_P2PS) {
1124 p2p_dbg(p2p, "We have wps_method=%s -> incompatible",
1125 p2p_wps_method_str(dev->wps_method));
1126 status = P2P_SC_FAIL_INCOMPATIBLE_PROV_METHOD;
1131 if (msg.dev_password_id &&
1132 msg.dev_password_id == dev->oob_pw_id) {
1133 p2p_dbg(p2p, "Peer using NFC");
1134 if (dev->wps_method != WPS_NFC) {
1135 p2p_dbg(p2p, "We have wps_method=%s -> incompatible",
1136 p2p_wps_method_str(dev->wps_method));
1137 status = P2P_SC_FAIL_INCOMPATIBLE_PROV_METHOD;
1142 p2p_dbg(p2p, "Unsupported Device Password ID %d",
1143 msg.dev_password_id);
1144 status = P2P_SC_FAIL_INCOMPATIBLE_PROV_METHOD;
1148 if (go && p2p_go_select_channel(p2p, dev, &status) < 0)
1151 p2p_set_state(p2p, P2P_GO_NEG);
1152 p2p_clear_timeout(p2p);
1154 p2p_dbg(p2p, "GO Negotiation with " MACSTR, MAC2STR(sa));
1155 os_memcpy(dev->intended_addr, msg.intended_addr, ETH_ALEN);
1158 /* Store GO Negotiation Confirmation to allow retransmission */
1159 wpabuf_free(dev->go_neg_conf);
1160 dev->go_neg_conf = p2p_build_go_neg_conf(p2p, dev, msg.dialog_token,
1161 status, msg.operating_channel,
1163 p2p_parse_free(&msg);
1164 if (dev->go_neg_conf == NULL)
1166 p2p_dbg(p2p, "Sending GO Negotiation Confirm");
1167 if (status == P2P_SC_SUCCESS) {
1168 p2p->pending_action_state = P2P_PENDING_GO_NEG_CONFIRM;
1169 dev->go_state = go ? LOCAL_GO : REMOTE_GO;
1171 p2p->pending_action_state = P2P_NO_PENDING_ACTION;
1175 freq = dev->listen_freq;
1177 dev->go_neg_conf_freq = freq;
1178 dev->go_neg_conf_sent = 0;
1180 if (p2p_send_action(p2p, freq, sa, p2p->cfg->dev_addr, sa,
1181 wpabuf_head(dev->go_neg_conf),
1182 wpabuf_len(dev->go_neg_conf), 200) < 0) {
1183 p2p_dbg(p2p, "Failed to send Action frame");
1184 p2p_go_neg_failed(p2p, -1);
1185 p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
1187 dev->go_neg_conf_sent++;
1188 if (status != P2P_SC_SUCCESS) {
1189 p2p_dbg(p2p, "GO Negotiation failed");
1190 p2p_go_neg_failed(p2p, status);
1195 void p2p_process_go_neg_conf(struct p2p_data *p2p, const u8 *sa,
1196 const u8 *data, size_t len)
1198 struct p2p_device *dev;
1199 struct p2p_message msg;
1201 p2p_dbg(p2p, "Received GO Negotiation Confirm from " MACSTR,
1203 dev = p2p_get_device(p2p, sa);
1204 if (dev == NULL || dev->wps_method == WPS_NOT_READY ||
1205 dev != p2p->go_neg_peer) {
1206 p2p_dbg(p2p, "Not ready for GO negotiation with " MACSTR,
1211 if (p2p->pending_action_state == P2P_PENDING_GO_NEG_RESPONSE) {
1212 p2p_dbg(p2p, "Stopped waiting for TX status on GO Negotiation Response since we already received Confirmation");
1213 p2p->pending_action_state = P2P_NO_PENDING_ACTION;
1216 if (p2p_parse(data, len, &msg))
1219 if (!(dev->flags & P2P_DEV_WAIT_GO_NEG_CONFIRM)) {
1220 p2p_dbg(p2p, "Was not expecting GO Negotiation Confirm - ignore");
1221 p2p_parse_free(&msg);
1224 dev->flags &= ~P2P_DEV_WAIT_GO_NEG_CONFIRM;
1225 p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
1227 if (msg.dialog_token != dev->dialog_token) {
1228 p2p_dbg(p2p, "Unexpected Dialog Token %u (expected %u)",
1229 msg.dialog_token, dev->dialog_token);
1230 p2p_parse_free(&msg);
1235 p2p_dbg(p2p, "No Status attribute received");
1236 p2p_parse_free(&msg);
1240 p2p_dbg(p2p, "GO Negotiation rejected: status %d", *msg.status);
1241 p2p_go_neg_failed(p2p, *msg.status);
1242 p2p_parse_free(&msg);
1246 if (dev->go_state == REMOTE_GO && msg.group_id) {
1247 /* Store SSID for Provisioning step */
1248 p2p->ssid_len = msg.group_id_len - ETH_ALEN;
1249 os_memcpy(p2p->ssid, msg.group_id + ETH_ALEN, p2p->ssid_len);
1250 } else if (dev->go_state == REMOTE_GO) {
1251 p2p_dbg(p2p, "Mandatory P2P Group ID attribute missing from GO Negotiation Confirmation");
1253 p2p_go_neg_failed(p2p, P2P_SC_FAIL_INVALID_PARAMS);
1254 p2p_parse_free(&msg);
1258 if (!msg.operating_channel) {
1259 p2p_dbg(p2p, "Mandatory Operating Channel attribute missing from GO Negotiation Confirmation");
1260 #ifdef CONFIG_P2P_STRICT
1261 p2p_parse_free(&msg);
1263 #endif /* CONFIG_P2P_STRICT */
1264 } else if (dev->go_state == REMOTE_GO) {
1265 int oper_freq = p2p_channel_to_freq(msg.operating_channel[3],
1266 msg.operating_channel[4]);
1267 if (oper_freq != dev->oper_freq) {
1268 p2p_dbg(p2p, "Updated peer (GO) operating channel preference from %d MHz to %d MHz",
1269 dev->oper_freq, oper_freq);
1270 dev->oper_freq = oper_freq;
1274 if (!msg.channel_list) {
1275 p2p_dbg(p2p, "Mandatory Operating Channel attribute missing from GO Negotiation Confirmation");
1276 #ifdef CONFIG_P2P_STRICT
1277 p2p_parse_free(&msg);
1279 #endif /* CONFIG_P2P_STRICT */
1282 p2p_parse_free(&msg);
1284 if (dev->go_state == UNKNOWN_GO) {
1286 * This should not happen since GO negotiation has already
1289 p2p_dbg(p2p, "Unexpected GO Neg state - do not know which end becomes GO");
1294 * The peer could have missed our ctrl::ack frame for GO Negotiation
1295 * Confirm and continue retransmitting the frame. To reduce the
1296 * likelihood of the peer not getting successful TX status for the
1297 * GO Negotiation Confirm frame, wait a short time here before starting
1298 * the group so that we will remain on the current channel to
1299 * acknowledge any possible retransmission from the peer.
1301 p2p_dbg(p2p, "20 ms wait on current channel before starting group");
1304 p2p_go_complete(p2p, dev);