Lines Matching +full:channel +full:- +full:use
2 * Wi-Fi Direct - P2P Invitation procedure
30 struct wpabuf *wfd_ie = p2p->wfd_ie_invitation; in p2p_build_invitation_req()
31 if (wfd_ie && p2p->inv_role == P2P_INVITE_ROLE_ACTIVE_GO) { in p2p_build_invitation_req()
33 for (i = 0; i < p2p->num_groups; i++) { in p2p_build_invitation_req()
34 struct p2p_group *g = p2p->groups[i]; in p2p_build_invitation_req()
37 p2p->inv_bssid)) in p2p_build_invitation_req()
50 if (p2p->vendor_elem && p2p->vendor_elem[VENDOR_ELEM_P2P_INV_REQ]) in p2p_build_invitation_req()
51 extra += wpabuf_len(p2p->vendor_elem[VENDOR_ELEM_P2P_INV_REQ]); in p2p_build_invitation_req()
57 peer->dialog_token++; in p2p_build_invitation_req()
58 if (peer->dialog_token == 0) in p2p_build_invitation_req()
59 peer->dialog_token = 1; in p2p_build_invitation_req()
61 peer->dialog_token); in p2p_build_invitation_req()
64 if (p2p->inv_role == P2P_INVITE_ROLE_ACTIVE_GO || !p2p->inv_persistent) in p2p_build_invitation_req()
67 p2p_buf_add_config_timeout(buf, p2p->go_timeout, in p2p_build_invitation_req()
68 p2p->client_timeout); in p2p_build_invitation_req()
69 p2p_buf_add_invitation_flags(buf, p2p->inv_persistent ? in p2p_build_invitation_req()
71 if (p2p->inv_role != P2P_INVITE_ROLE_CLIENT || in p2p_build_invitation_req()
72 !(peer->flags & P2P_DEV_NO_PREF_CHAN)) in p2p_build_invitation_req()
73 p2p_buf_add_operating_channel(buf, p2p->cfg->country, in p2p_build_invitation_req()
74 p2p->op_reg_class, in p2p_build_invitation_req()
75 p2p->op_channel); in p2p_build_invitation_req()
76 if (p2p->inv_bssid_set) in p2p_build_invitation_req()
77 p2p_buf_add_group_bssid(buf, p2p->inv_bssid); in p2p_build_invitation_req()
79 p2p_is_peer_6ghz_capab(p2p, peer->info.p2p_device_addr); in p2p_build_invitation_req()
80 p2p_buf_add_channel_list(buf, p2p->cfg->country, &p2p->channels, in p2p_build_invitation_req()
84 else if (p2p->inv_role == P2P_INVITE_ROLE_CLIENT) in p2p_build_invitation_req()
85 dev_addr = peer->info.p2p_device_addr; in p2p_build_invitation_req()
87 dev_addr = p2p->cfg->dev_addr; in p2p_build_invitation_req()
88 p2p_buf_add_group_id(buf, dev_addr, p2p->inv_ssid, p2p->inv_ssid_len); in p2p_build_invitation_req()
92 p2p_buf_add_pref_channel_list(buf, p2p->pref_freq_list, in p2p_build_invitation_req()
93 p2p->num_pref_freq); in p2p_build_invitation_req()
100 if (p2p->vendor_elem && p2p->vendor_elem[VENDOR_ELEM_P2P_INV_REQ]) in p2p_build_invitation_req()
101 wpabuf_put_buf(buf, p2p->vendor_elem[VENDOR_ELEM_P2P_INV_REQ]); in p2p_build_invitation_req()
116 u8 reg_class, u8 channel, in p2p_build_invitation_resp() argument
124 struct wpabuf *wfd_ie = p2p->wfd_ie_invitation; in p2p_build_invitation_resp()
127 for (i = 0; i < p2p->num_groups; i++) { in p2p_build_invitation_resp()
128 struct p2p_group *g = p2p->groups[i]; in p2p_build_invitation_resp()
144 if (p2p->vendor_elem && p2p->vendor_elem[VENDOR_ELEM_P2P_INV_RESP]) in p2p_build_invitation_resp()
145 extra += wpabuf_len(p2p->vendor_elem[VENDOR_ELEM_P2P_INV_RESP]); in p2p_build_invitation_resp()
157 if (reg_class && channel) in p2p_build_invitation_resp()
158 p2p_buf_add_operating_channel(buf, p2p->cfg->country, in p2p_build_invitation_resp()
159 reg_class, channel); in p2p_build_invitation_resp()
166 p2p_is_peer_6ghz_capab(p2p, peer->info.p2p_device_addr); in p2p_build_invitation_resp()
167 p2p_buf_add_channel_list(buf, p2p->cfg->country, channels, in p2p_build_invitation_resp()
177 if (p2p->vendor_elem && p2p->vendor_elem[VENDOR_ELEM_P2P_INV_RESP]) in p2p_build_invitation_resp()
178 wpabuf_put_buf(buf, p2p->vendor_elem[VENDOR_ELEM_P2P_INV_RESP]); in p2p_build_invitation_resp()
195 u8 reg_class = 0, channel = 0; in p2p_process_invitation_req() local
208 if (dev == NULL || (dev->flags & P2P_DEV_PROBE_REQ_ONLY)) { in p2p_process_invitation_req()
212 if (p2p_add_device(p2p, sa, rx_freq, NULL, 0, data + 1, len - 1, in p2p_process_invitation_req()
248 p2p_channels_union(&p2p->cfg->channels, &p2p->cfg->cli_channels, in p2p_process_invitation_req()
259 p2p_channels_dump(p2p, "own channels", &p2p->cfg->channels); in p2p_process_invitation_req()
261 p2p_channels_dump(p2p, "peer channels", &dev->channels); in p2p_process_invitation_req()
262 p2p_channels_intersect(&all_channels, &dev->channels, in p2p_process_invitation_req()
266 if (p2p->cfg->invitation_process) { in p2p_process_invitation_req()
267 status = p2p->cfg->invitation_process( in p2p_process_invitation_req()
268 p2p->cfg->cb_ctx, sa, msg.group_bssid, msg.group_id, in p2p_process_invitation_req()
269 msg.group_id + ETH_ALEN, msg.group_id_len - ETH_ALEN, in p2p_process_invitation_req()
271 msg.dev_password_id_present ? msg.dev_password_id : -1); in p2p_process_invitation_req()
275 p2p_channels_intersect(&p2p->cfg->channels, &dev->channels, in p2p_process_invitation_req()
288 if (p2p_freq_to_channel(op_freq, ®_class, &channel) < 0) { in p2p_process_invitation_req()
295 if (!p2p_channels_includes(&intersection, reg_class, channel)) in p2p_process_invitation_req()
306 p2p_dbg(p2p, "No forced channel from invitation processing - figure out best one to use"); in p2p_process_invitation_req()
309 p2p->op_reg_class = p2p->cfg->op_reg_class; in p2p_process_invitation_req()
310 p2p->op_channel = p2p->cfg->op_channel; in p2p_process_invitation_req()
311 p2p_dbg(p2p, "Own default op_class %d channel %d", in p2p_process_invitation_req()
312 p2p->op_reg_class, p2p->op_channel); in p2p_process_invitation_req()
314 /* Use peer preference if specified and compatible */ in p2p_process_invitation_req()
320 p2p_dbg(p2p, "Peer operating channel preference: %d MHz", in p2p_process_invitation_req()
326 p2p->op_reg_class = msg.operating_channel[3]; in p2p_process_invitation_req()
327 p2p->op_channel = msg.operating_channel[4]; in p2p_process_invitation_req()
328 p2p_dbg(p2p, "Use peer preference op_class %d channel %d", in p2p_process_invitation_req()
329 p2p->op_reg_class, p2p->op_channel); in p2p_process_invitation_req()
331 p2p_dbg(p2p, "Cannot use peer channel preference"); in p2p_process_invitation_req()
335 /* Reselect the channel only for the case of the GO */ in p2p_process_invitation_req()
337 !p2p_channels_includes(&intersection, p2p->op_reg_class, in p2p_process_invitation_req()
338 p2p->op_channel)) { in p2p_process_invitation_req()
339 …p2p_dbg(p2p, "Initially selected channel (op_class %d channel %d) not in channel intersection - tr… in p2p_process_invitation_req()
340 p2p->op_reg_class, p2p->op_channel); in p2p_process_invitation_req()
342 p2p_dbg(p2p, "Re-selection result: op_class %d channel %d", in p2p_process_invitation_req()
343 p2p->op_reg_class, p2p->op_channel); in p2p_process_invitation_req()
345 p2p->op_reg_class, in p2p_process_invitation_req()
346 p2p->op_channel)) { in p2p_process_invitation_req()
347 p2p_dbg(p2p, "Peer does not support selected operating channel (reg_class=%u channel=%u)", in p2p_process_invitation_req()
348 p2p->op_reg_class, p2p->op_channel); in p2p_process_invitation_req()
352 } else if (go && !(dev->flags & P2P_DEV_FORCE_FREQ) && in p2p_process_invitation_req()
353 !p2p->cfg->cfg_op_channel) { in p2p_process_invitation_req()
354 …p2p_dbg(p2p, "Try to reselect channel selection with peer information received; previously selecte… in p2p_process_invitation_req()
355 p2p->op_reg_class, p2p->op_channel); in p2p_process_invitation_req()
360 * Use the driver preferred frequency list extension if in p2p_process_invitation_req()
365 op_freq = p2p_channel_to_freq(p2p->op_reg_class, in p2p_process_invitation_req()
366 p2p->op_channel); in p2p_process_invitation_req()
368 p2p_dbg(p2p, "Unknown operational channel (country=%c%c reg_class=%u channel=%u)", in p2p_process_invitation_req()
369 p2p->cfg->country[0], p2p->cfg->country[1], in p2p_process_invitation_req()
370 p2p->op_reg_class, p2p->op_channel); in p2p_process_invitation_req()
374 p2p_dbg(p2p, "Selected operating channel - %d MHz", op_freq); in p2p_process_invitation_req()
377 reg_class = p2p->op_reg_class; in p2p_process_invitation_req()
378 channel = p2p->op_channel; in p2p_process_invitation_req()
389 bssid, reg_class, channel, channels); in p2p_process_invitation_req()
397 freq = p2p_channel_to_freq(p2p->cfg->reg_class, in p2p_process_invitation_req()
398 p2p->cfg->channel); in p2p_process_invitation_req()
400 p2p_dbg(p2p, "Unknown regulatory class/channel"); in p2p_process_invitation_req()
408 os_memcpy(p2p->inv_sa, sa, ETH_ALEN); in p2p_process_invitation_req()
410 os_memcpy(p2p->inv_group_bssid, msg.group_bssid, ETH_ALEN); in p2p_process_invitation_req()
411 p2p->inv_group_bssid_ptr = p2p->inv_group_bssid; in p2p_process_invitation_req()
413 p2p->inv_group_bssid_ptr = NULL; in p2p_process_invitation_req()
415 if (msg.group_id_len - ETH_ALEN <= SSID_MAX_LEN) { in p2p_process_invitation_req()
416 os_memcpy(p2p->inv_ssid, msg.group_id + ETH_ALEN, in p2p_process_invitation_req()
417 msg.group_id_len - ETH_ALEN); in p2p_process_invitation_req()
418 p2p->inv_ssid_len = msg.group_id_len - ETH_ALEN; in p2p_process_invitation_req()
420 os_memcpy(p2p->inv_go_dev_addr, msg.group_id, ETH_ALEN); in p2p_process_invitation_req()
422 p2p->inv_ssid_len = 0; in p2p_process_invitation_req()
423 os_memset(p2p->inv_go_dev_addr, 0, ETH_ALEN); in p2p_process_invitation_req()
425 p2p->inv_status = status; in p2p_process_invitation_req()
426 p2p->inv_op_freq = op_freq; in p2p_process_invitation_req()
428 p2p->pending_action_state = P2P_PENDING_INVITATION_RESPONSE; in p2p_process_invitation_req()
429 if (p2p_send_action(p2p, freq, sa, p2p->cfg->dev_addr, in p2p_process_invitation_req()
430 p2p->cfg->dev_addr, in p2p_process_invitation_req()
455 p2p->cfg->send_action_done(p2p->cfg->cb_ctx); in p2p_process_invitation_resp()
459 if (dev != p2p->invite_peer) { in p2p_process_invitation_resp()
462 p2p->cfg->send_action_done(p2p->cfg->cb_ctx); in p2p_process_invitation_resp()
467 p2p->cfg->send_action_done(p2p->cfg->cb_ctx); in p2p_process_invitation_resp()
475 p2p->cfg->send_action_done(p2p->cfg->cb_ctx); in p2p_process_invitation_resp()
482 * do that for pre-association frames. We did not use to verify dialog in p2p_process_invitation_resp()
485 * Request in case the suggested operating channel was changed. This in p2p_process_invitation_resp()
490 p2p->retry_invite_req_sent && in p2p_process_invitation_resp()
491 msg.dialog_token != dev->dialog_token) { in p2p_process_invitation_resp()
493 msg.dialog_token, dev->dialog_token); in p2p_process_invitation_resp()
499 p2p->retry_invite_req && in p2p_process_invitation_resp()
500 p2p_channel_random_social(&p2p->cfg->channels, &p2p->op_reg_class, in p2p_process_invitation_resp()
501 &p2p->op_channel, NULL, NULL) == 0) { in p2p_process_invitation_resp()
502 p2p->retry_invite_req = 0; in p2p_process_invitation_resp()
503 p2p->cfg->send_action_done(p2p->cfg->cb_ctx); in p2p_process_invitation_resp()
504 p2p->cfg->stop_listen(p2p->cfg->cb_ctx); in p2p_process_invitation_resp()
506 p2p_dbg(p2p, "Resend Invitation Request setting op_class %u channel %u as operating channel", in p2p_process_invitation_resp()
507 p2p->op_reg_class, p2p->op_channel); in p2p_process_invitation_resp()
508 p2p->retry_invite_req_sent = 1; in p2p_process_invitation_resp()
509 p2p_invite_send(p2p, p2p->invite_peer, p2p->invite_go_dev_addr, in p2p_process_invitation_resp()
510 p2p->invite_dev_pw_id); in p2p_process_invitation_resp()
514 p2p->cfg->send_action_done(p2p->cfg->cb_ctx); in p2p_process_invitation_resp()
515 p2p->retry_invite_req = 0; in p2p_process_invitation_resp()
518 p2p_dbg(p2p, "Mandatory Channel List attribute missing in Invitation Response from " in p2p_process_invitation_resp()
524 /* Try to survive without peer channel list */ in p2p_process_invitation_resp()
525 channels = &p2p->channels; in p2p_process_invitation_resp()
527 /* Non-success cases are not required to include Channel List */ in p2p_process_invitation_resp()
528 channels = &p2p->channels; in p2p_process_invitation_resp()
529 } else if (p2p_peer_channels_check(p2p, &p2p->channels, dev, in p2p_process_invitation_resp()
536 p2p_channels_intersect(&p2p->channels, &dev->channels, in p2p_process_invitation_resp()
541 if (p2p->cfg->invitation_result) { in p2p_process_invitation_resp()
543 int freq = p2p_channel_to_freq(p2p->op_reg_class, in p2p_process_invitation_resp()
544 p2p->op_channel); in p2p_process_invitation_resp()
557 * Use the driver preferred frequency list extension if in p2p_process_invitation_resp()
562 p2p->cfg->invitation_result(p2p->cfg->cb_ctx, *msg.status, in p2p_process_invitation_resp()
571 p2p->invite_peer = NULL; in p2p_process_invitation_resp()
581 freq = dev->listen_freq > 0 ? dev->listen_freq : dev->oper_freq; in p2p_invite_send()
583 freq = dev->oob_go_neg_freq; in p2p_invite_send()
587 MAC2STR(dev->info.p2p_device_addr)); in p2p_invite_send()
588 return -1; in p2p_invite_send()
593 return -1; in p2p_invite_send()
594 if (p2p->state != P2P_IDLE) in p2p_invite_send()
598 p2p->pending_action_state = P2P_PENDING_INVITATION_REQUEST; in p2p_invite_send()
599 p2p->invite_peer = dev; in p2p_invite_send()
600 dev->invitation_reqs++; in p2p_invite_send()
602 /* In case of an active P2P GO use a shorter wait time to avoid in p2p_invite_send()
604 if (p2p_send_action(p2p, freq, dev->info.p2p_device_addr, in p2p_invite_send()
605 p2p->cfg->dev_addr, dev->info.p2p_device_addr, in p2p_invite_send()
607 p2p->inv_role == P2P_INVITE_ROLE_ACTIVE_GO ? in p2p_invite_send()
610 /* Use P2P find to recover and retry */ in p2p_invite_send()
613 dev->flags |= P2P_DEV_WAIT_INV_REQ_ACK; in p2p_invite_send()
626 if (p2p->invite_peer == NULL) { in p2p_invitation_req_cb()
632 p2p->invite_peer->flags &= ~P2P_DEV_WAIT_INV_REQ_ACK; in p2p_invitation_req_cb()
635 * Use P2P find, if needed, to find the other device from its listen in p2p_invitation_req_cb()
636 * channel. in p2p_invitation_req_cb()
646 p2p->cfg->send_action_done(p2p->cfg->cb_ctx); in p2p_invitation_resp_cb()
651 if (p2p->cfg->invitation_received) { in p2p_invitation_resp_cb()
652 p2p->cfg->invitation_received(p2p->cfg->cb_ctx, in p2p_invitation_resp_cb()
653 p2p->inv_sa, in p2p_invitation_resp_cb()
654 p2p->inv_group_bssid_ptr, in p2p_invitation_resp_cb()
655 p2p->inv_ssid, p2p->inv_ssid_len, in p2p_invitation_resp_cb()
656 p2p->inv_go_dev_addr, in p2p_invitation_resp_cb()
657 p2p->inv_status, in p2p_invitation_resp_cb()
658 p2p->inv_op_freq); in p2p_invitation_resp_cb()
673 p2p->allow_6ghz); in p2p_invite()
679 os_memcpy(p2p->invite_go_dev_addr_buf, go_dev_addr, ETH_ALEN); in p2p_invite()
680 p2p->invite_go_dev_addr = p2p->invite_go_dev_addr_buf; in p2p_invite()
682 p2p->invite_go_dev_addr = NULL; in p2p_invite()
686 p2p_dbg(p2p, "Invitation to use Device Password ID %d", in p2p_invite()
689 p2p->invite_dev_pw_id = dev_pw_id; in p2p_invite()
690 p2p->retry_invite_req = role == P2P_INVITE_ROLE_GO && in p2p_invite()
692 p2p->retry_invite_req_sent = 0; in p2p_invite()
695 if (dev == NULL || (dev->listen_freq <= 0 && dev->oper_freq <= 0 && in p2p_invite()
696 dev->oob_go_neg_freq <= 0)) { in p2p_invite()
699 return -1; in p2p_invite()
704 return -1; in p2p_invite()
708 dev->flags |= P2P_DEV_NO_PREF_CHAN; in p2p_invite()
710 dev->flags &= ~P2P_DEV_NO_PREF_CHAN; in p2p_invite()
712 if (dev->flags & P2P_DEV_GROUP_CLIENT_ONLY) { in p2p_invite()
713 if (!(dev->info.dev_capab & in p2p_invite()
719 /* TODO: use device discoverability request through GO */ in p2p_invite()
722 dev->invitation_reqs = 0; in p2p_invite()
724 if (p2p->state != P2P_IDLE) in p2p_invite()
727 p2p->inv_role = role; in p2p_invite()
728 p2p->inv_bssid_set = bssid != NULL; in p2p_invite()
730 os_memcpy(p2p->inv_bssid, bssid, ETH_ALEN); in p2p_invite()
731 os_memcpy(p2p->inv_ssid, ssid, ssid_len); in p2p_invite()
732 p2p->inv_ssid_len = ssid_len; in p2p_invite()
733 p2p->inv_persistent = persistent_group; in p2p_invite()