Lines Matching refs:p2p
43 static void p2ps_add_new_group_info(struct p2p_data *p2p, in p2ps_add_new_group_info() argument
54 if (!p2p->cfg->get_go_info) in p2ps_add_new_group_info()
57 found = p2p->cfg->get_go_info( in p2ps_add_new_group_info()
58 p2p->cfg->cb_ctx, intended_addr, ssid, in p2ps_add_new_group_info()
62 p2p->p2ps_prov->force_freq = force_freq; in p2ps_add_new_group_info()
63 p2p->p2ps_prov->pref_freq = 0; in p2ps_add_new_group_info()
66 p2p_prepare_channel(p2p, dev, force_freq, 0, 0); in p2ps_add_new_group_info()
68 p2p_buf_add_group_id(buf, p2p->cfg->dev_addr, in p2ps_add_new_group_info()
72 p2p_buf_add_intended_addr(buf, p2p->intended_addr); in p2ps_add_new_group_info()
76 if (!p2p->ssid_set) { in p2ps_add_new_group_info()
77 p2p_build_ssid(p2p, p2p->ssid, &p2p->ssid_len); in p2ps_add_new_group_info()
78 p2p->ssid_set = 1; in p2ps_add_new_group_info()
82 p2p_buf_add_group_id(buf, p2p->cfg->dev_addr, in p2ps_add_new_group_info()
83 p2p->ssid, p2p->ssid_len); in p2ps_add_new_group_info()
87 buf, p2p->intended_addr); in p2ps_add_new_group_info()
90 buf, p2p->cfg->dev_addr); in p2ps_add_new_group_info()
95 static void p2ps_add_pd_req_attrs(struct p2p_data *p2p, struct p2p_device *dev, in p2ps_add_pd_req_attrs() argument
98 struct p2ps_provision *prov = p2p->p2ps_prov; in p2ps_add_pd_req_attrs()
111 p2ps_add_new_group_info(p2p, dev, buf); in p2ps_add_pd_req_attrs()
119 if (p2p->cfg->get_persistent_group) { in p2ps_add_pd_req_attrs()
120 shared_group = p2p->cfg->get_persistent_group( in p2ps_add_pd_req_attrs()
121 p2p->cfg->cb_ctx, dev->info.p2p_device_addr, in p2ps_add_pd_req_attrs()
128 p2p_buf_add_channel_list(buf, p2p->cfg->country, in p2ps_add_pd_req_attrs()
129 &p2p->channels); in p2ps_add_pd_req_attrs()
133 p2p_buf_add_operating_channel(buf, p2p->cfg->country, in p2ps_add_pd_req_attrs()
134 p2p->op_reg_class, in p2ps_add_pd_req_attrs()
135 p2p->op_channel); in p2ps_add_pd_req_attrs()
153 p2p_buf_add_config_timeout(buf, p2p->go_timeout, in p2ps_add_pd_req_attrs()
154 p2p->client_timeout); in p2ps_add_pd_req_attrs()
157 p2p_buf_add_listen_channel(buf, p2p->cfg->country, in p2ps_add_pd_req_attrs()
158 p2p->cfg->reg_class, in p2ps_add_pd_req_attrs()
159 p2p->cfg->channel); in p2ps_add_pd_req_attrs()
178 static struct wpabuf * p2p_build_prov_disc_req(struct p2p_data *p2p, in p2p_build_prov_disc_req() argument
191 if (p2p->wfd_ie_prov_disc_req) in p2p_build_prov_disc_req()
192 extra = wpabuf_len(p2p->wfd_ie_prov_disc_req); in p2p_build_prov_disc_req()
195 if (p2p->vendor_elem && p2p->vendor_elem[VENDOR_ELEM_P2P_PD_REQ]) in p2p_build_prov_disc_req()
196 extra += wpabuf_len(p2p->vendor_elem[VENDOR_ELEM_P2P_PD_REQ]); in p2p_build_prov_disc_req()
198 if (p2p->p2ps_prov) in p2p_build_prov_disc_req()
199 extra += os_strlen(p2p->p2ps_prov->info) + 1 + in p2p_build_prov_disc_req()
211 if (p2p->p2ps_prov) { in p2p_build_prov_disc_req()
214 if (p2p->cross_connect) in p2p_build_prov_disc_req()
216 if (p2p->cfg->p2p_intra_bss) in p2p_build_prov_disc_req()
219 p2p_buf_add_capability(buf, p2p->dev_capab & in p2p_build_prov_disc_req()
222 p2p_buf_add_device_info(buf, p2p, NULL); in p2p_build_prov_disc_req()
223 if (p2p->p2ps_prov) { in p2p_build_prov_disc_req()
224 p2ps_add_pd_req_attrs(p2p, dev, buf, config_methods); in p2p_build_prov_disc_req()
235 if (p2p->wfd_ie_prov_disc_req) in p2p_build_prov_disc_req()
236 wpabuf_put_buf(buf, p2p->wfd_ie_prov_disc_req); in p2p_build_prov_disc_req()
239 if (p2p->vendor_elem && p2p->vendor_elem[VENDOR_ELEM_P2P_PD_REQ]) in p2p_build_prov_disc_req()
240 wpabuf_put_buf(buf, p2p->vendor_elem[VENDOR_ELEM_P2P_PD_REQ]); in p2p_build_prov_disc_req()
246 static struct wpabuf * p2p_build_prov_disc_resp(struct p2p_data *p2p, in p2p_build_prov_disc_resp() argument
264 struct wpabuf *wfd_ie = p2p->wfd_ie_prov_disc_resp; in p2p_build_prov_disc_resp()
267 for (i = 0; i < p2p->num_groups; i++) { in p2p_build_prov_disc_resp()
268 struct p2p_group *g = p2p->groups[i]; in p2p_build_prov_disc_resp()
284 if (p2p->vendor_elem && p2p->vendor_elem[VENDOR_ELEM_P2P_PD_RESP]) in p2p_build_prov_disc_resp()
285 extra += wpabuf_len(p2p->vendor_elem[VENDOR_ELEM_P2P_PD_RESP]); in p2p_build_prov_disc_resp()
294 if (p2p->p2ps_prov && p2p->p2ps_prov->adv_id == adv_id) { in p2p_build_prov_disc_resp()
296 struct p2ps_provision *prov = p2p->p2ps_prov; in p2p_build_prov_disc_resp()
310 if (p2p->cross_connect) in p2p_build_prov_disc_resp()
312 if (p2p->cfg->p2p_intra_bss) in p2p_build_prov_disc_resp()
314 p2p_buf_add_capability(buf, p2p->dev_capab & in p2p_build_prov_disc_resp()
317 p2p_buf_add_device_info(buf, p2p, NULL); in p2p_build_prov_disc_resp()
319 if (persist_ssid && p2p->cfg->get_persistent_group && dev && in p2p_build_prov_disc_resp()
327 persist = p2p->cfg->get_persistent_group( in p2p_build_prov_disc_resp()
328 p2p->cfg->cb_ctx, in p2p_build_prov_disc_resp()
342 p2ps_add_new_group_info(p2p, dev, buf); in p2p_build_prov_disc_resp()
346 if (p2p->op_reg_class && p2p->op_channel) in p2p_build_prov_disc_resp()
348 buf, p2p->cfg->country, in p2p_build_prov_disc_resp()
349 p2p->op_reg_class, in p2p_build_prov_disc_resp()
350 p2p->op_channel); in p2p_build_prov_disc_resp()
353 buf, p2p->cfg->country, in p2p_build_prov_disc_resp()
354 p2p->cfg->op_reg_class, in p2p_build_prov_disc_resp()
355 p2p->cfg->op_channel); in p2p_build_prov_disc_resp()
360 p2p_buf_add_channel_list(buf, p2p->cfg->country, in p2p_build_prov_disc_resp()
361 &p2p->channels); in p2p_build_prov_disc_resp()
370 p2p_buf_add_config_timeout(buf, p2p->go_timeout, in p2p_build_prov_disc_resp()
371 p2p->client_timeout); in p2p_build_prov_disc_resp()
383 if (p2p->p2ps_prov) in p2p_build_prov_disc_resp()
385 p2p->p2ps_prov->adv_mac); in p2p_build_prov_disc_resp()
398 if (p2p->vendor_elem && p2p->vendor_elem[VENDOR_ELEM_P2P_PD_RESP]) in p2p_build_prov_disc_resp()
399 wpabuf_put_buf(buf, p2p->vendor_elem[VENDOR_ELEM_P2P_PD_RESP]); in p2p_build_prov_disc_resp()
405 static int p2ps_setup_p2ps_prov(struct p2p_data *p2p, u32 adv_id, in p2ps_setup_p2ps_prov() argument
411 if (!p2p->p2ps_prov) { in p2ps_setup_p2ps_prov()
412 p2p->p2ps_prov = os_zalloc(sizeof(struct p2ps_provision) + 1); in p2ps_setup_p2ps_prov()
413 if (!p2p->p2ps_prov) in p2ps_setup_p2ps_prov()
416 os_memset(p2p->p2ps_prov, 0, sizeof(struct p2ps_provision) + 1); in p2ps_setup_p2ps_prov()
419 tmp = p2p->p2ps_prov; in p2ps_setup_p2ps_prov()
444 static int p2ps_validate_pd_req(struct p2p_data *p2p, struct p2p_message *msg, in p2ps_validate_pd_req() argument
457 p2p_dbg(p2p, "Not P2PS PD Request. Missing %s", #_attr); \ in p2ps_validate_pd_req()
491 p2p_dbg(p2p, "P2PS: Invalid feature capability len"); in p2ps_validate_pd_req()
528 p2p_dbg(p2p, "Invalid P2PS PD connection capability"); in p2ps_validate_pd_req()
554 void p2p_process_prov_disc_req(struct p2p_data *p2p, const u8 *sa, in p2p_process_prov_disc_req() argument
581 p2p_dbg(p2p, "Received Provision Discovery Request from " MACSTR in p2p_process_prov_disc_req()
586 dev = p2p_get_device(p2p, sa); in p2p_process_prov_disc_req()
588 p2p_dbg(p2p, "Provision Discovery Request from unknown peer " in p2p_process_prov_disc_req()
591 if (p2p_add_device(p2p, sa, rx_freq, NULL, 0, data + 1, len - 1, in p2p_process_prov_disc_req()
593 p2p_dbg(p2p, "Provision Discovery Request add device failed " in p2p_process_prov_disc_req()
599 dev = p2p_get_device(p2p, sa); in p2p_process_prov_disc_req()
601 p2p_dbg(p2p, in p2p_process_prov_disc_req()
615 p2p_dbg(p2p, in p2p_process_prov_disc_req()
624 for (i = 0; i < p2p->num_groups; i++) { in p2p_process_prov_disc_req()
626 p2p->groups[i], in p2p_process_prov_disc_req()
630 if (i == p2p->num_groups) { in p2p_process_prov_disc_req()
631 p2p_dbg(p2p, in p2p_process_prov_disc_req()
644 if (p2ps_validate_pd_req(p2p, &msg, sa) < 0) { in p2p_process_prov_disc_req()
666 p2p_dbg(p2p, in p2p_process_prov_disc_req()
682 p2p_dbg(p2p, "Peer " MACSTR in p2p_process_prov_disc_req()
687 p2p_dbg(p2p, "Peer " MACSTR in p2p_process_prov_disc_req()
693 p2p_dbg(p2p, "Peer " MACSTR " requesting P2PS PIN", in p2p_process_prov_disc_req()
700 if (p2p->cfg->remove_stale_groups) { in p2p_process_prov_disc_req()
701 p2p->cfg->remove_stale_groups( in p2p_process_prov_disc_req()
702 p2p->cfg->cb_ctx, dev->info.p2p_device_addr, in p2p_process_prov_disc_req()
721 if (os_memcmp(p2p->cfg->dev_addr, msg.adv_mac, ETH_ALEN)) { in p2p_process_prov_disc_req()
722 p2p_dbg(p2p, in p2p_process_prov_disc_req()
728 p2ps_adv = p2p_service_p2ps_id(p2p, adv_id); in p2p_process_prov_disc_req()
730 p2p_dbg(p2p, "P2PS PD invalid adv_id=0x%X", adv_id); in p2p_process_prov_disc_req()
734 p2p_dbg(p2p, "adv_id: 0x%X, p2ps_adv: %p", adv_id, p2ps_adv); in p2p_process_prov_disc_req()
737 conncap = p2p->cfg->p2ps_group_capability(p2p->cfg->cb_ctx, in p2p_process_prov_disc_req()
742 p2p_dbg(p2p, "Conncap: local:%d remote:%d result:%d", in p2p_process_prov_disc_req()
745 p2p_prepare_channel(p2p, dev, forced_freq, pref_freq, 0); in p2p_process_prov_disc_req()
750 p2p_dbg(p2p, "cpt: service:0x%x remote:0x%x result:0x%x", in p2p_process_prov_disc_req()
754 p2p_dbg(p2p, in p2p_process_prov_disc_req()
760 p2p_dbg(p2p, in p2p_process_prov_disc_req()
766 p2p_dbg(p2p, "P2PS state unavailable"); in p2p_process_prov_disc_req()
769 p2p_dbg(p2p, "Conncap resolution failed"); in p2p_process_prov_disc_req()
774 p2p_dbg(p2p, "Keypad - always defer"); in p2p_process_prov_disc_req()
781 p2p_peer_channels_check(p2p, &p2p->channels, dev, in p2p_process_prov_disc_req()
784 p2p_dbg(p2p, in p2p_process_prov_disc_req()
814 p2p_channels_intersect(&p2p->channels, &dev->channels, in p2p_process_prov_disc_req()
818 p2p_dbg(p2p, in p2p_process_prov_disc_req()
827 if (p2ps_setup_p2ps_prov(p2p, adv_id, session_id, in p2p_process_prov_disc_req()
834 tmp = p2p->p2ps_prov; in p2p_process_prov_disc_req()
851 (!p2p->p2ps_prov || p2p->p2ps_prov->adv_id != adv_id)) { in p2p_process_prov_disc_req()
859 if (p2ps_setup_p2ps_prov(p2p, adv_id, session_id, in p2p_process_prov_disc_req()
865 tmp = p2p->p2ps_prov; in p2p_process_prov_disc_req()
879 if (*msg.status != P2P_SC_SUCCESS_DEFERRED || !p2p->p2ps_prov) in p2p_process_prov_disc_req()
882 if (p2p->p2ps_prov->adv_id != adv_id || in p2p_process_prov_disc_req()
883 os_memcmp(p2p->p2ps_prov->adv_mac, msg.adv_mac, ETH_ALEN)) { in p2p_process_prov_disc_req()
884 p2p_dbg(p2p, in p2p_process_prov_disc_req()
889 if (p2p->p2ps_prov->session_id != session_id || in p2p_process_prov_disc_req()
890 os_memcmp(p2p->p2ps_prov->session_mac, msg.session_mac, ETH_ALEN)) { in p2p_process_prov_disc_req()
891 p2p_dbg(p2p, "P2PS Follow-on PD with mismatch Session ID/MAC"); in p2p_process_prov_disc_req()
895 method = p2p->p2ps_prov->method; in p2p_process_prov_disc_req()
897 conncap = p2p->cfg->p2ps_group_capability(p2p->cfg->cb_ctx, in p2p_process_prov_disc_req()
899 p2p->p2ps_prov->conncap, in p2p_process_prov_disc_req()
900 &p2p->p2ps_prov->force_freq, in p2p_process_prov_disc_req()
901 &p2p->p2ps_prov->pref_freq); in p2p_process_prov_disc_req()
903 resp_fcap.cpt = p2ps_own_preferred_cpt(p2p->p2ps_prov->cpt_priority, in p2p_process_prov_disc_req()
906 p2p_dbg(p2p, "cpt: local:0x%x remote:0x%x result:0x%x", in p2p_process_prov_disc_req()
907 p2p->p2ps_prov->cpt_mask, req_fcap->cpt, resp_fcap.cpt); in p2p_process_prov_disc_req()
909 p2p_prepare_channel(p2p, dev, p2p->p2ps_prov->force_freq, in p2p_process_prov_disc_req()
910 p2p->p2ps_prov->pref_freq, 0); in p2p_process_prov_disc_req()
928 p2p_dbg(p2p, in p2p_process_prov_disc_req()
934 p2p_peer_channels_check(p2p, &p2p->channels, dev, in p2p_process_prov_disc_req()
937 p2p_dbg(p2p, in p2p_process_prov_disc_req()
954 p2p_go_select_channel(p2p, dev, &tmp) < 0) in p2p_process_prov_disc_req()
958 p2p->p2ps_prov->status = reject; in p2p_process_prov_disc_req()
959 p2p->p2ps_prov->conncap = conncap; in p2p_process_prov_disc_req()
973 resp = p2p_build_prov_disc_resp(p2p, dev, msg.dialog_token, in p2p_process_prov_disc_req()
984 p2p_dbg(p2p, "Sending Provision Discovery Response"); in p2p_process_prov_disc_req()
988 freq = p2p_channel_to_freq(p2p->cfg->reg_class, in p2p_process_prov_disc_req()
989 p2p->cfg->channel); in p2p_process_prov_disc_req()
991 p2p_dbg(p2p, "Unknown regulatory class/channel"); in p2p_process_prov_disc_req()
996 p2p->pending_action_state = P2P_PENDING_PD_RESPONSE; in p2p_process_prov_disc_req()
997 if (p2p_send_action(p2p, freq, sa, p2p->cfg->dev_addr, in p2p_process_prov_disc_req()
998 p2p->cfg->dev_addr, in p2p_process_prov_disc_req()
1001 p2p_dbg(p2p, "Failed to send Action frame"); in p2p_process_prov_disc_req()
1003 p2p->send_action_in_progress = 1; in p2p_process_prov_disc_req()
1015 freq = p2p_channel_to_freq(p2p->op_reg_class, in p2p_process_prov_disc_req()
1016 p2p->op_channel); in p2p_process_prov_disc_req()
1021 if (!p2p->cfg->p2ps_prov_complete) { in p2p_process_prov_disc_req()
1026 p2p->cfg->p2ps_prov_complete(p2p->cfg->cb_ctx, reject, in p2p_process_prov_disc_req()
1034 p2p->p2ps_prov) { in p2p_process_prov_disc_req()
1035 p2p->p2ps_prov->status = reject; in p2p_process_prov_disc_req()
1036 p2p->p2ps_prov->conncap = conncap; in p2p_process_prov_disc_req()
1039 p2p->cfg->p2ps_prov_complete(p2p->cfg->cb_ctx, reject, in p2p_process_prov_disc_req()
1048 p2p->cfg->p2ps_prov_complete(p2p->cfg->cb_ctx, in p2p_process_prov_disc_req()
1060 } else if (msg.status && p2p->p2ps_prov) { in p2p_process_prov_disc_req()
1061 p2p->p2ps_prov->status = P2P_SC_SUCCESS; in p2p_process_prov_disc_req()
1062 p2p->cfg->p2ps_prov_complete(p2p->cfg->cb_ctx, *msg.status, sa, in p2p_process_prov_disc_req()
1073 p2p->cfg->p2ps_prov_complete(p2p->cfg->cb_ctx, P2P_SC_SUCCESS, in p2p_process_prov_disc_req()
1088 p2p->p2ps_prov->method = msg.wps_config_methods; in p2p_process_prov_disc_req()
1090 p2p->cfg->p2ps_prov_complete(p2p->cfg->cb_ctx, P2P_SC_SUCCESS, in p2p_process_prov_disc_req()
1104 p2p->p2ps_prov->method = msg.wps_config_methods; in p2p_process_prov_disc_req()
1109 p2p->cfg->p2ps_prov_complete( in p2p_process_prov_disc_req()
1110 p2p->cfg->cb_ctx, P2P_SC_SUCCESS, sa, in p2p_process_prov_disc_req()
1140 if (p2p->cfg->prov_disc_req && in p2p_process_prov_disc_req()
1156 p2p->cfg->prov_disc_req(p2p->cfg->cb_ctx, sa, in p2p_process_prov_disc_req()
1167 p2ps_prov_free(p2p); in p2p_process_prov_disc_req()
1196 static int p2p_validate_p2ps_pd_resp(struct p2p_data *p2p, in p2p_validate_p2ps_pd_resp() argument
1207 p2p_dbg(p2p, "P2PS PD Response missing " #_attr); \ in p2p_validate_p2ps_pd_resp()
1224 if (p2p->p2ps_prov->session_id != session_id) { in p2p_validate_p2ps_pd_resp()
1225 p2p_dbg(p2p, in p2p_validate_p2ps_pd_resp()
1230 if (os_memcmp(p2p->p2ps_prov->session_mac, msg->session_mac, in p2p_validate_p2ps_pd_resp()
1232 p2p_dbg(p2p, in p2p_validate_p2ps_pd_resp()
1237 if (p2p->p2ps_prov->adv_id != adv_id) { in p2p_validate_p2ps_pd_resp()
1238 p2p_dbg(p2p, in p2p_validate_p2ps_pd_resp()
1243 if (os_memcmp(p2p->p2ps_prov->adv_mac, msg->adv_mac, ETH_ALEN) != 0) { in p2p_validate_p2ps_pd_resp()
1244 p2p_dbg(p2p, in p2p_validate_p2ps_pd_resp()
1250 p2p_dbg(p2p, in p2p_validate_p2ps_pd_resp()
1257 p2p_dbg(p2p, in p2p_validate_p2ps_pd_resp()
1263 p2p_dbg(p2p, in p2p_validate_p2ps_pd_resp()
1295 void p2p_process_prov_disc_resp(struct p2p_data *p2p, const u8 *sa, in p2p_process_prov_disc_resp() argument
1312 if (p2p->p2ps_prov && p2p_validate_p2ps_pd_resp(p2p, &msg)) { in p2p_process_prov_disc_resp()
1345 p2p_dbg(p2p, "Received Provision Discovery Response from " MACSTR in p2p_process_prov_disc_resp()
1349 dev = p2p_get_device(p2p, sa); in p2p_process_prov_disc_resp()
1351 p2p_dbg(p2p, "Ignore Provision Discovery Response from " MACSTR in p2p_process_prov_disc_resp()
1361 p2p_dbg(p2p, "Ignore Provision Discovery Response with unexpected Dialog Token %u (expected %u)", in p2p_process_prov_disc_resp()
1367 if (p2p->pending_action_state == P2P_PENDING_PD) { in p2p_process_prov_disc_resp()
1368 os_memset(p2p->pending_pd_devaddr, 0, ETH_ALEN); in p2p_process_prov_disc_resp()
1369 p2p->pending_action_state = P2P_NO_PENDING_ACTION; in p2p_process_prov_disc_resp()
1372 p2ps_seeker = p2p->p2ps_prov && p2p->p2ps_prov->pd_seeker; in p2p_process_prov_disc_resp()
1384 if (p2p->user_initiated_pd && in p2p_process_prov_disc_resp()
1385 os_memcmp(p2p->pending_pd_devaddr, sa, ETH_ALEN) == 0) in p2p_process_prov_disc_resp()
1386 p2p_reset_pending_pd(p2p); in p2p_process_prov_disc_resp()
1389 …p2p_dbg(p2p, "Peer rejected our Provision Discovery Request (received config_methods 0x%x expected… in p2p_process_prov_disc_resp()
1391 if (p2p->cfg->prov_disc_fail) in p2p_process_prov_disc_resp()
1392 p2p->cfg->prov_disc_fail(p2p->cfg->cb_ctx, sa, in p2p_process_prov_disc_resp()
1396 p2ps_prov_free(p2p); in p2p_process_prov_disc_resp()
1405 p2p_dbg(p2p, "Peer " MACSTR in p2p_process_prov_disc_resp()
1410 p2p_dbg(p2p, "Peer " MACSTR in p2p_process_prov_disc_resp()
1416 p2p_dbg(p2p, "Peer " MACSTR " accepted P2PS PIN", in p2p_process_prov_disc_resp()
1423 p2p->p2ps_prov) { in p2p_process_prov_disc_resp()
1435 p2p_peer_channels_check(p2p, &p2p->channels, dev, in p2p_process_prov_disc_resp()
1438 p2p_dbg(p2p, "P2PS PD Response - no common channels"); in p2p_process_prov_disc_resp()
1441 if (p2p_channels_includes(&p2p->channels, in p2p_process_prov_disc_resp()
1452 p2p_dbg(p2p, in p2p_process_prov_disc_resp()
1457 if (p2p->cfg->p2ps_prov_complete) { in p2p_process_prov_disc_resp()
1468 if (p2p_go_select_channel(p2p, dev, &tmp) < 0) in p2p_process_prov_disc_resp()
1469 p2p_dbg(p2p, in p2p_process_prov_disc_resp()
1472 freq = p2p_channel_to_freq(p2p->op_reg_class, in p2p_process_prov_disc_resp()
1473 p2p->op_channel); in p2p_process_prov_disc_resp()
1478 p2p->cfg->p2ps_prov_complete( in p2p_process_prov_disc_resp()
1479 p2p->cfg->cb_ctx, status, sa, adv_mac, in p2p_process_prov_disc_resp()
1480 p2p->p2ps_prov->session_mac, in p2p_process_prov_disc_resp()
1481 group_mac, adv_id, p2p->p2ps_prov->session_id, in p2p_process_prov_disc_resp()
1488 p2ps_prov_free(p2p); in p2p_process_prov_disc_resp()
1491 status != P2P_SC_SUCCESS_DEFERRED && p2p->p2ps_prov) { in p2p_process_prov_disc_resp()
1492 if (p2p->cfg->p2ps_prov_complete) in p2p_process_prov_disc_resp()
1493 p2p->cfg->p2ps_prov_complete( in p2p_process_prov_disc_resp()
1494 p2p->cfg->cb_ctx, status, sa, adv_mac, in p2p_process_prov_disc_resp()
1495 p2p->p2ps_prov->session_mac, in p2p_process_prov_disc_resp()
1496 group_mac, adv_id, p2p->p2ps_prov->session_id, in p2p_process_prov_disc_resp()
1498 p2ps_prov_free(p2p); in p2p_process_prov_disc_resp()
1502 if (p2p->cfg->remove_stale_groups) { in p2p_process_prov_disc_resp()
1503 p2p->cfg->remove_stale_groups(p2p->cfg->cb_ctx, in p2p_process_prov_disc_resp()
1514 p2ps_prov_free(p2p); in p2p_process_prov_disc_resp()
1520 if (p2p->cfg->prov_disc_fail) in p2p_process_prov_disc_resp()
1521 p2p->cfg->prov_disc_fail( in p2p_process_prov_disc_resp()
1522 p2p->cfg->cb_ctx, sa, in p2p_process_prov_disc_resp()
1528 if (p2p->cfg->prov_disc_fail) in p2p_process_prov_disc_resp()
1529 p2p->cfg->prov_disc_fail( in p2p_process_prov_disc_resp()
1530 p2p->cfg->cb_ctx, sa, in p2p_process_prov_disc_resp()
1534 p2p_dbg(p2p, "Peer rejected our Provision Discovery Request"); in p2p_process_prov_disc_resp()
1535 if (p2p->cfg->prov_disc_fail) in p2p_process_prov_disc_resp()
1536 p2p->cfg->prov_disc_fail(p2p->cfg->cb_ctx, sa, in p2p_process_prov_disc_resp()
1540 p2ps_prov_free(p2p); in p2p_process_prov_disc_resp()
1553 p2p->cfg->send_action_done(p2p->cfg->cb_ctx); in p2p_process_prov_disc_resp()
1555 p2p_dbg(p2p, "Start GO Neg after the PD-before-GO-Neg workaround with " in p2p_process_prov_disc_resp()
1558 p2p_connect_send(p2p, dev); in p2p_process_prov_disc_resp()
1576 if (p2p->cfg->prov_disc_resp && in p2p_process_prov_disc_resp()
1583 p2p->cfg->prov_disc_resp(p2p->cfg->cb_ctx, sa, in p2p_process_prov_disc_resp()
1586 if (p2p->state == P2P_PD_DURING_FIND) { in p2p_process_prov_disc_resp()
1587 p2p_stop_listen_for_freq(p2p, 0); in p2p_process_prov_disc_resp()
1588 p2p_continue_find(p2p); in p2p_process_prov_disc_resp()
1593 int p2p_send_prov_disc_req(struct p2p_data *p2p, struct p2p_device *dev, in p2p_send_prov_disc_req() argument
1605 p2p_dbg(p2p, "No Listen/Operating frequency known for the peer " in p2p_send_prov_disc_req()
1614 p2p_dbg(p2p, "Cannot use PD with P2P Device " MACSTR in p2p_send_prov_disc_req()
1622 if (p2p->p2ps_prov) { in p2p_send_prov_disc_req()
1623 if (p2p->p2ps_prov->status == P2P_SC_SUCCESS_DEFERRED) { in p2p_send_prov_disc_req()
1624 if (p2p->p2ps_prov->method == WPS_CONFIG_DISPLAY) in p2p_send_prov_disc_req()
1626 else if (p2p->p2ps_prov->method == WPS_CONFIG_KEYPAD) in p2p_send_prov_disc_req()
1632 if (p2p->p2ps_prov->method) in p2p_send_prov_disc_req()
1634 p2p->p2ps_prov->method; in p2p_send_prov_disc_req()
1642 p2p_dbg(p2p, in p2p_send_prov_disc_req()
1644 p2p->p2ps_prov->method, p2p->p2ps_prov->status, in p2p_send_prov_disc_req()
1647 if (p2p_prepare_channel(p2p, dev, p2p->p2ps_prov->force_freq, in p2p_send_prov_disc_req()
1648 p2p->p2ps_prov->pref_freq, 1) < 0) in p2p_send_prov_disc_req()
1652 req = p2p_build_prov_disc_req(p2p, dev, join); in p2p_send_prov_disc_req()
1656 if (p2p->state != P2P_IDLE) in p2p_send_prov_disc_req()
1657 p2p_stop_listen_for_freq(p2p, freq); in p2p_send_prov_disc_req()
1658 p2p->pending_action_state = P2P_PENDING_PD; in p2p_send_prov_disc_req()
1659 if (p2p_send_action(p2p, freq, dev->info.p2p_device_addr, in p2p_send_prov_disc_req()
1660 p2p->cfg->dev_addr, dev->info.p2p_device_addr, in p2p_send_prov_disc_req()
1662 p2p_dbg(p2p, "Failed to send Action frame"); in p2p_send_prov_disc_req()
1667 os_memcpy(p2p->pending_pd_devaddr, dev->info.p2p_device_addr, ETH_ALEN); in p2p_send_prov_disc_req()
1674 int p2p_prov_disc_req(struct p2p_data *p2p, const u8 *peer_addr, in p2p_prov_disc_req() argument
1681 dev = p2p_get_device(p2p, peer_addr); in p2p_prov_disc_req()
1683 dev = p2p_get_device_interface(p2p, peer_addr); in p2p_prov_disc_req()
1685 p2p_dbg(p2p, "Provision Discovery Request destination " MACSTR in p2p_prov_disc_req()
1691 p2p_dbg(p2p, "Provision Discovery Request with " MACSTR in p2p_prov_disc_req()
1700 p2p->p2ps_prov) { in p2p_prov_disc_req()
1702 p2ps_prov->method = p2p->p2ps_prov->method; in p2p_prov_disc_req()
1707 p2ps_prov_free(p2p); in p2p_prov_disc_req()
1708 p2p->p2ps_prov = p2ps_prov; in p2p_prov_disc_req()
1716 if (p2p->state != P2P_IDLE && p2p->state != P2P_SEARCH && in p2p_prov_disc_req()
1717 p2p->state != P2P_LISTEN_ONLY) { in p2p_prov_disc_req()
1718 p2p_dbg(p2p, "Busy with other operations; postpone Provision Discovery Request with " in p2p_prov_disc_req()
1724 p2p->user_initiated_pd = user_initiated_pd; in p2p_prov_disc_req()
1725 p2p->pd_force_freq = force_freq; in p2p_prov_disc_req()
1727 if (p2p->user_initiated_pd) in p2p_prov_disc_req()
1728 p2p->pd_retries = MAX_PROV_DISC_REQ_RETRIES; in p2p_prov_disc_req()
1738 return p2p_send_prov_disc_req(p2p, dev, join, force_freq); in p2p_prov_disc_req()
1742 void p2p_reset_pending_pd(struct p2p_data *p2p) in p2p_reset_pending_pd() argument
1746 dl_list_for_each(dev, &p2p->devices, struct p2p_device, list) { in p2p_reset_pending_pd()
1747 if (os_memcmp(p2p->pending_pd_devaddr, in p2p_reset_pending_pd()
1758 p2p->user_initiated_pd = 0; in p2p_reset_pending_pd()
1759 os_memset(p2p->pending_pd_devaddr, 0, ETH_ALEN); in p2p_reset_pending_pd()
1760 p2p->pd_retries = 0; in p2p_reset_pending_pd()
1761 p2p->pd_force_freq = 0; in p2p_reset_pending_pd()
1765 void p2ps_prov_free(struct p2p_data *p2p) in p2ps_prov_free() argument
1767 os_free(p2p->p2ps_prov); in p2ps_prov_free()
1768 p2p->p2ps_prov = NULL; in p2ps_prov_free()