Lines Matching refs:reg
194 static int wps_set_ie(struct wps_registrar *reg);
198 static void wps_registrar_remove_pin(struct wps_registrar *reg,
202 static void wps_registrar_add_authorized_mac(struct wps_registrar *reg, in wps_registrar_add_authorized_mac() argument
209 if (os_memcmp(reg->authorized_macs[i], addr, ETH_ALEN) == 0) { in wps_registrar_add_authorized_mac()
215 os_memcpy(reg->authorized_macs[i], reg->authorized_macs[i - 1], in wps_registrar_add_authorized_mac()
217 os_memcpy(reg->authorized_macs[0], addr, ETH_ALEN); in wps_registrar_add_authorized_mac()
219 (u8 *) reg->authorized_macs, sizeof(reg->authorized_macs)); in wps_registrar_add_authorized_mac()
223 static void wps_registrar_remove_authorized_mac(struct wps_registrar *reg, in wps_registrar_remove_authorized_mac() argument
230 if (os_memcmp(reg->authorized_macs, addr, ETH_ALEN) == 0) in wps_registrar_remove_authorized_mac()
239 os_memcpy(reg->authorized_macs[i], reg->authorized_macs[i + 1], in wps_registrar_remove_authorized_mac()
241 os_memset(reg->authorized_macs[WPS_MAX_AUTHORIZED_MACS - 1], 0, in wps_registrar_remove_authorized_mac()
244 (u8 *) reg->authorized_macs, sizeof(reg->authorized_macs)); in wps_registrar_remove_authorized_mac()
261 static struct wps_registrar_device * wps_device_get(struct wps_registrar *reg, in wps_device_get() argument
266 for (dev = reg->devices; dev; dev = dev->next) { in wps_device_get()
293 int wps_device_store(struct wps_registrar *reg, in wps_device_store() argument
298 d = wps_device_get(reg, dev->mac_addr); in wps_device_store()
303 d->next = reg->devices; in wps_device_store()
304 reg->devices = d; in wps_device_store()
314 static void wps_registrar_add_pbc_session(struct wps_registrar *reg, in wps_registrar_add_pbc_session() argument
322 pbc = reg->pbc_sessions; in wps_registrar_add_pbc_session()
329 reg->pbc_sessions = pbc->next; in wps_registrar_add_pbc_session()
345 pbc->next = reg->pbc_sessions; in wps_registrar_add_pbc_session()
346 reg->pbc_sessions = pbc; in wps_registrar_add_pbc_session()
366 static void wps_registrar_remove_pbc_session(struct wps_registrar *reg, in wps_registrar_remove_pbc_session() argument
372 pbc = reg->pbc_sessions; in wps_registrar_remove_pbc_session()
375 (p2p_dev_addr && !is_zero_ether_addr(reg->p2p_dev_addr) && in wps_registrar_remove_pbc_session()
376 os_memcmp(reg->p2p_dev_addr, p2p_dev_addr, ETH_ALEN) == in wps_registrar_remove_pbc_session()
381 reg->pbc_sessions = pbc->next; in wps_registrar_remove_pbc_session()
397 int wps_registrar_pbc_overlap(struct wps_registrar *reg, in wps_registrar_pbc_overlap() argument
416 for (pbc = reg->pbc_sessions; pbc; pbc = pbc->next) { in wps_registrar_pbc_overlap()
495 static int wps_build_selected_registrar(struct wps_registrar *reg, in wps_build_selected_registrar() argument
498 if (!reg->sel_reg_union) in wps_build_selected_registrar()
508 static int wps_build_sel_reg_dev_password_id(struct wps_registrar *reg, in wps_build_sel_reg_dev_password_id() argument
511 u16 id = reg->pbc ? DEV_PW_PUSHBUTTON : DEV_PW_DEFAULT; in wps_build_sel_reg_dev_password_id()
512 if (!reg->sel_reg_union) in wps_build_sel_reg_dev_password_id()
514 if (reg->sel_reg_dev_password_id_override >= 0) in wps_build_sel_reg_dev_password_id()
515 id = reg->sel_reg_dev_password_id_override; in wps_build_sel_reg_dev_password_id()
524 static int wps_build_sel_pbc_reg_uuid_e(struct wps_registrar *reg, in wps_build_sel_pbc_reg_uuid_e() argument
527 u16 id = reg->pbc ? DEV_PW_PUSHBUTTON : DEV_PW_DEFAULT; in wps_build_sel_pbc_reg_uuid_e()
528 if (!reg->sel_reg_union) in wps_build_sel_pbc_reg_uuid_e()
530 if (reg->sel_reg_dev_password_id_override >= 0) in wps_build_sel_pbc_reg_uuid_e()
531 id = reg->sel_reg_dev_password_id_override; in wps_build_sel_pbc_reg_uuid_e()
532 if (id != DEV_PW_PUSHBUTTON || !reg->dualband) in wps_build_sel_pbc_reg_uuid_e()
534 return wps_build_uuid_e(msg, reg->wps->uuid); in wps_build_sel_pbc_reg_uuid_e()
561 static int wps_build_sel_reg_config_methods(struct wps_registrar *reg, in wps_build_sel_reg_config_methods() argument
565 if (!reg->sel_reg_union) in wps_build_sel_reg_config_methods()
567 methods = reg->wps->config_methods; in wps_build_sel_reg_config_methods()
571 if (reg->pbc) in wps_build_sel_reg_config_methods()
572 wps_set_pushbutton(&methods, reg->wps->config_methods); in wps_build_sel_reg_config_methods()
573 if (reg->sel_reg_config_methods_override >= 0) in wps_build_sel_reg_config_methods()
574 methods = reg->sel_reg_config_methods_override; in wps_build_sel_reg_config_methods()
584 static int wps_build_probe_config_methods(struct wps_registrar *reg, in wps_build_probe_config_methods() argument
592 methods = reg->wps->config_methods & ~WPS_CONFIG_PUSHBUTTON; in wps_build_probe_config_methods()
603 static int wps_build_config_methods_r(struct wps_registrar *reg, in wps_build_config_methods_r() argument
606 return wps_build_config_methods(msg, reg->wps->config_methods); in wps_build_config_methods_r()
610 const u8 * wps_authorized_macs(struct wps_registrar *reg, size_t *count) in wps_authorized_macs() argument
615 if (is_zero_ether_addr(reg->authorized_macs_union[*count])) in wps_authorized_macs()
620 return (const u8 *) reg->authorized_macs_union; in wps_authorized_macs()
640 struct wps_registrar *reg = os_zalloc(sizeof(*reg)); in wps_registrar_init() local
641 if (reg == NULL) in wps_registrar_init()
644 dl_list_init(®->pins); in wps_registrar_init()
645 dl_list_init(®->nfc_pw_tokens); in wps_registrar_init()
646 reg->wps = wps; in wps_registrar_init()
647 reg->new_psk_cb = cfg->new_psk_cb; in wps_registrar_init()
648 reg->set_ie_cb = cfg->set_ie_cb; in wps_registrar_init()
649 reg->pin_needed_cb = cfg->pin_needed_cb; in wps_registrar_init()
650 reg->reg_success_cb = cfg->reg_success_cb; in wps_registrar_init()
651 reg->set_sel_reg_cb = cfg->set_sel_reg_cb; in wps_registrar_init()
652 reg->enrollee_seen_cb = cfg->enrollee_seen_cb; in wps_registrar_init()
653 reg->cb_ctx = cfg->cb_ctx; in wps_registrar_init()
654 reg->skip_cred_build = cfg->skip_cred_build; in wps_registrar_init()
656 reg->extra_cred = wpabuf_alloc_copy(cfg->extra_cred, in wps_registrar_init()
658 if (reg->extra_cred == NULL) { in wps_registrar_init()
659 os_free(reg); in wps_registrar_init()
663 reg->disable_auto_conf = cfg->disable_auto_conf; in wps_registrar_init()
664 reg->sel_reg_dev_password_id_override = -1; in wps_registrar_init()
665 reg->sel_reg_config_methods_override = -1; in wps_registrar_init()
666 reg->static_wep_only = cfg->static_wep_only; in wps_registrar_init()
667 reg->dualband = cfg->dualband; in wps_registrar_init()
668 reg->force_per_enrollee_psk = cfg->force_per_enrollee_psk; in wps_registrar_init()
670 if (wps_set_ie(reg)) { in wps_registrar_init()
671 wps_registrar_deinit(reg); in wps_registrar_init()
675 return reg; in wps_registrar_init()
679 void wps_registrar_flush(struct wps_registrar *reg) in wps_registrar_flush() argument
681 if (reg == NULL) in wps_registrar_flush()
683 wps_free_pins(®->pins); in wps_registrar_flush()
684 wps_free_nfc_pw_tokens(®->nfc_pw_tokens, 0); in wps_registrar_flush()
685 wps_free_pbc_sessions(reg->pbc_sessions); in wps_registrar_flush()
686 reg->pbc_sessions = NULL; in wps_registrar_flush()
687 wps_free_devices(reg->devices); in wps_registrar_flush()
688 reg->devices = NULL; in wps_registrar_flush()
690 reg->pbc_ignore_start.sec = 0; in wps_registrar_flush()
699 void wps_registrar_deinit(struct wps_registrar *reg) in wps_registrar_deinit() argument
701 if (reg == NULL) in wps_registrar_deinit()
703 eloop_cancel_timeout(wps_registrar_pbc_timeout, reg, NULL); in wps_registrar_deinit()
704 eloop_cancel_timeout(wps_registrar_set_selected_timeout, reg, NULL); in wps_registrar_deinit()
705 wps_registrar_flush(reg); in wps_registrar_deinit()
706 wpabuf_free(reg->extra_cred); in wps_registrar_deinit()
707 os_free(reg); in wps_registrar_deinit()
711 static void wps_registrar_invalidate_unused(struct wps_registrar *reg) in wps_registrar_invalidate_unused() argument
715 dl_list_for_each(pin, ®->pins, struct wps_uuid_pin, list) { in wps_registrar_invalidate_unused()
719 wps_registrar_remove_pin(reg, pin); in wps_registrar_invalidate_unused()
736 int wps_registrar_add_pin(struct wps_registrar *reg, const u8 *addr, in wps_registrar_add_pin() argument
766 wps_registrar_invalidate_unused(reg); in wps_registrar_add_pin()
768 dl_list_add(®->pins, &p->list); in wps_registrar_add_pin()
774 reg->selected_registrar = 1; in wps_registrar_add_pin()
775 reg->pbc = 0; in wps_registrar_add_pin()
777 wps_registrar_add_authorized_mac(reg, addr); in wps_registrar_add_pin()
780 reg, (u8 *) "\xff\xff\xff\xff\xff\xff"); in wps_registrar_add_pin()
781 wps_registrar_selected_registrar_changed(reg, 0); in wps_registrar_add_pin()
782 eloop_cancel_timeout(wps_registrar_set_selected_timeout, reg, NULL); in wps_registrar_add_pin()
785 reg, NULL); in wps_registrar_add_pin()
791 static void wps_registrar_remove_pin(struct wps_registrar *reg, in wps_registrar_remove_pin() argument
801 wps_registrar_remove_authorized_mac(reg, addr); in wps_registrar_remove_pin()
803 wps_registrar_selected_registrar_changed(reg, 0); in wps_registrar_remove_pin()
807 static void wps_registrar_expire_pins(struct wps_registrar *reg) in wps_registrar_expire_pins() argument
813 dl_list_for_each_safe(pin, prev, ®->pins, struct wps_uuid_pin, list) in wps_registrar_expire_pins()
819 wps_registrar_remove_pin(reg, pin); in wps_registrar_expire_pins()
832 static int wps_registrar_invalidate_wildcard_pin(struct wps_registrar *reg, in wps_registrar_invalidate_wildcard_pin() argument
838 dl_list_for_each_safe(pin, prev, ®->pins, struct wps_uuid_pin, list) in wps_registrar_invalidate_wildcard_pin()
847 wps_registrar_remove_pin(reg, pin); in wps_registrar_invalidate_wildcard_pin()
862 int wps_registrar_invalidate_pin(struct wps_registrar *reg, const u8 *uuid) in wps_registrar_invalidate_pin() argument
866 dl_list_for_each_safe(pin, prev, ®->pins, struct wps_uuid_pin, list) in wps_registrar_invalidate_pin()
871 wps_registrar_remove_pin(reg, pin); in wps_registrar_invalidate_pin()
880 static const u8 * wps_registrar_get_pin(struct wps_registrar *reg, in wps_registrar_get_pin() argument
885 wps_registrar_expire_pins(reg); in wps_registrar_get_pin()
887 dl_list_for_each(pin, ®->pins, struct wps_uuid_pin, list) { in wps_registrar_get_pin()
898 dl_list_for_each(pin, ®->pins, struct wps_uuid_pin, list) { in wps_registrar_get_pin()
939 int wps_registrar_unlock_pin(struct wps_registrar *reg, const u8 *uuid) in wps_registrar_unlock_pin() argument
943 dl_list_for_each(pin, ®->pins, struct wps_uuid_pin, list) { in wps_registrar_unlock_pin()
948 return wps_registrar_invalidate_pin(reg, uuid); in wps_registrar_unlock_pin()
959 static void wps_registrar_stop_pbc(struct wps_registrar *reg) in wps_registrar_stop_pbc() argument
961 reg->selected_registrar = 0; in wps_registrar_stop_pbc()
962 reg->pbc = 0; in wps_registrar_stop_pbc()
963 os_memset(reg->p2p_dev_addr, 0, ETH_ALEN); in wps_registrar_stop_pbc()
964 wps_registrar_remove_authorized_mac(reg, in wps_registrar_stop_pbc()
966 wps_registrar_selected_registrar_changed(reg, 0); in wps_registrar_stop_pbc()
972 struct wps_registrar *reg = eloop_ctx; in wps_registrar_pbc_timeout() local
975 wps_pbc_timeout_event(reg->wps); in wps_registrar_pbc_timeout()
976 wps_registrar_stop_pbc(reg); in wps_registrar_pbc_timeout()
994 int wps_registrar_button_pushed(struct wps_registrar *reg, in wps_registrar_button_pushed() argument
998 wps_registrar_pbc_overlap(reg, NULL, NULL)) { in wps_registrar_button_pushed()
1001 wps_pbc_overlap_event(reg->wps); in wps_registrar_button_pushed()
1005 reg->force_pbc_overlap = 0; in wps_registrar_button_pushed()
1006 reg->selected_registrar = 1; in wps_registrar_button_pushed()
1007 reg->pbc = 1; in wps_registrar_button_pushed()
1009 os_memcpy(reg->p2p_dev_addr, p2p_dev_addr, ETH_ALEN); in wps_registrar_button_pushed()
1011 os_memset(reg->p2p_dev_addr, 0, ETH_ALEN); in wps_registrar_button_pushed()
1012 wps_registrar_add_authorized_mac(reg, in wps_registrar_button_pushed()
1014 wps_registrar_selected_registrar_changed(reg, 0); in wps_registrar_button_pushed()
1016 wps_pbc_active_event(reg->wps); in wps_registrar_button_pushed()
1017 eloop_cancel_timeout(wps_registrar_set_selected_timeout, reg, NULL); in wps_registrar_button_pushed()
1018 eloop_cancel_timeout(wps_registrar_pbc_timeout, reg, NULL); in wps_registrar_button_pushed()
1020 reg, NULL); in wps_registrar_button_pushed()
1025 static void wps_registrar_pbc_completed(struct wps_registrar *reg) in wps_registrar_pbc_completed() argument
1028 eloop_cancel_timeout(wps_registrar_pbc_timeout, reg, NULL); in wps_registrar_pbc_completed()
1029 wps_registrar_stop_pbc(reg); in wps_registrar_pbc_completed()
1030 wps_pbc_disable_event(reg->wps); in wps_registrar_pbc_completed()
1034 static void wps_registrar_pin_completed(struct wps_registrar *reg) in wps_registrar_pin_completed() argument
1037 eloop_cancel_timeout(wps_registrar_set_selected_timeout, reg, NULL); in wps_registrar_pin_completed()
1038 reg->selected_registrar = 0; in wps_registrar_pin_completed()
1039 wps_registrar_selected_registrar_changed(reg, 0); in wps_registrar_pin_completed()
1067 int wps_registrar_wps_cancel(struct wps_registrar *reg) in wps_registrar_wps_cancel() argument
1069 if (reg->pbc) { in wps_registrar_wps_cancel()
1071 wps_registrar_pbc_timeout(reg, NULL); in wps_registrar_wps_cancel()
1072 eloop_cancel_timeout(wps_registrar_pbc_timeout, reg, NULL); in wps_registrar_wps_cancel()
1074 } else if (reg->selected_registrar) { in wps_registrar_wps_cancel()
1077 wps_registrar_pin_completed(reg); in wps_registrar_wps_cancel()
1078 wps_registrar_invalidate_wildcard_pin(reg, NULL, 0); in wps_registrar_wps_cancel()
1095 void wps_registrar_probe_req_rx(struct wps_registrar *reg, const u8 *addr, in wps_registrar_probe_req_rx() argument
1121 if (reg->enrollee_seen_cb && attr.uuid_e && in wps_registrar_probe_req_rx()
1131 reg->enrollee_seen_cb(reg->cb_ctx, addr, attr.uuid_e, in wps_registrar_probe_req_rx()
1153 if (reg->pbc_ignore_start.sec && in wps_registrar_probe_req_rx()
1154 os_memcmp(attr.uuid_e, reg->pbc_ignore_uuid, WPS_UUID_LEN) == 0) { in wps_registrar_probe_req_rx()
1157 os_reltime_sub(&now, ®->pbc_ignore_start, &dur); in wps_registrar_probe_req_rx()
1164 reg->pbc_ignore_start.sec = 0; in wps_registrar_probe_req_rx()
1169 wps_registrar_add_pbc_session(reg, addr, attr.uuid_e); in wps_registrar_probe_req_rx()
1170 if (wps_registrar_pbc_overlap(reg, addr, attr.uuid_e)) { in wps_registrar_probe_req_rx()
1172 reg->force_pbc_overlap = 1; in wps_registrar_probe_req_rx()
1173 wps_pbc_overlap_event(reg->wps); in wps_registrar_probe_req_rx()
1178 int wps_cb_new_psk(struct wps_registrar *reg, const u8 *mac_addr, in wps_cb_new_psk() argument
1181 if (reg->new_psk_cb == NULL) in wps_cb_new_psk()
1184 return reg->new_psk_cb(reg->cb_ctx, mac_addr, p2p_dev_addr, psk, in wps_cb_new_psk()
1189 static void wps_cb_pin_needed(struct wps_registrar *reg, const u8 *uuid_e, in wps_cb_pin_needed() argument
1192 if (reg->pin_needed_cb == NULL) in wps_cb_pin_needed()
1195 reg->pin_needed_cb(reg->cb_ctx, uuid_e, dev); in wps_cb_pin_needed()
1199 static void wps_cb_reg_success(struct wps_registrar *reg, const u8 *mac_addr, in wps_cb_reg_success() argument
1203 if (reg->reg_success_cb == NULL) in wps_cb_reg_success()
1206 reg->reg_success_cb(reg->cb_ctx, mac_addr, uuid_e, dev_pw, dev_pw_len); in wps_cb_reg_success()
1210 static int wps_cb_set_ie(struct wps_registrar *reg, struct wpabuf *beacon_ie, in wps_cb_set_ie() argument
1213 return reg->set_ie_cb(reg->cb_ctx, beacon_ie, probe_resp_ie); in wps_cb_set_ie()
1217 static void wps_cb_set_sel_reg(struct wps_registrar *reg) in wps_cb_set_sel_reg() argument
1220 if (reg->set_sel_reg_cb == NULL) in wps_cb_set_sel_reg()
1223 if (reg->selected_registrar) { in wps_cb_set_sel_reg()
1224 methods = reg->wps->config_methods & ~WPS_CONFIG_PUSHBUTTON; in wps_cb_set_sel_reg()
1227 if (reg->pbc) in wps_cb_set_sel_reg()
1228 wps_set_pushbutton(&methods, reg->wps->config_methods); in wps_cb_set_sel_reg()
1233 reg->selected_registrar, reg->wps->config_methods, in wps_cb_set_sel_reg()
1234 reg->pbc, methods); in wps_cb_set_sel_reg()
1236 reg->set_sel_reg_cb(reg->cb_ctx, reg->selected_registrar, in wps_cb_set_sel_reg()
1237 reg->pbc ? DEV_PW_PUSHBUTTON : DEV_PW_DEFAULT, in wps_cb_set_sel_reg()
1242 static int wps_set_ie(struct wps_registrar *reg) in wps_set_ie() argument
1251 if (reg->set_ie_cb == NULL) in wps_set_ie()
1255 if (reg->wps->dev.vendor_ext[i]) { in wps_set_ie()
1257 vendor_len += wpabuf_len(reg->wps->dev.vendor_ext[i]); in wps_set_ie()
1270 auth_macs = wps_authorized_macs(reg, &count); in wps_set_ie()
1275 wps_build_wps_state(reg->wps, beacon) || in wps_set_ie()
1276 wps_build_ap_setup_locked(reg->wps, beacon) || in wps_set_ie()
1277 wps_build_selected_registrar(reg, beacon) || in wps_set_ie()
1278 wps_build_sel_reg_dev_password_id(reg, beacon) || in wps_set_ie()
1279 wps_build_sel_reg_config_methods(reg, beacon) || in wps_set_ie()
1280 wps_build_sel_pbc_reg_uuid_e(reg, beacon) || in wps_set_ie()
1281 (reg->dualband && wps_build_rf_bands(®->wps->dev, beacon, 0)) || in wps_set_ie()
1283 wps_build_vendor_ext(®->wps->dev, beacon)) { in wps_set_ie()
1290 if (wps_build_dev_name(®->wps->dev, beacon) || in wps_set_ie()
1291 wps_build_primary_dev_type(®->wps->dev, beacon)) { in wps_set_ie()
1301 wps_build_wps_state(reg->wps, probe) || in wps_set_ie()
1302 wps_build_ap_setup_locked(reg->wps, probe) || in wps_set_ie()
1303 wps_build_selected_registrar(reg, probe) || in wps_set_ie()
1304 wps_build_sel_reg_dev_password_id(reg, probe) || in wps_set_ie()
1305 wps_build_sel_reg_config_methods(reg, probe) || in wps_set_ie()
1306 wps_build_resp_type(probe, reg->wps->ap ? WPS_RESP_AP : in wps_set_ie()
1308 wps_build_uuid_e(probe, reg->wps->uuid) || in wps_set_ie()
1309 wps_build_device_attrs(®->wps->dev, probe) || in wps_set_ie()
1310 wps_build_probe_config_methods(reg, probe) || in wps_set_ie()
1311 (reg->dualband && wps_build_rf_bands(®->wps->dev, probe, 0)) || in wps_set_ie()
1313 wps_build_vendor_ext(®->wps->dev, probe)) { in wps_set_ie()
1328 if (reg->static_wep_only) { in wps_set_ie()
1350 return wps_cb_set_ie(reg, beacon, probe); in wps_set_ie()
2543 struct wps_registrar *reg = wps->wps->registrar; in wps_registrar_p2p_dev_addr_match() local
2545 if (is_zero_ether_addr(reg->p2p_dev_addr)) in wps_registrar_p2p_dev_addr_match()
2548 if (os_memcmp(reg->p2p_dev_addr, wps->p2p_dev_addr, ETH_ALEN) != 0) { in wps_registrar_p2p_dev_addr_match()
2552 MAC2STR(reg->p2p_dev_addr), in wps_registrar_p2p_dev_addr_match()
2564 struct wps_registrar *reg = wps->wps->registrar; in wps_registrar_skip_overlap() local
2566 if (is_zero_ether_addr(reg->p2p_dev_addr)) in wps_registrar_skip_overlap()
2569 if (os_memcmp(reg->p2p_dev_addr, wps->p2p_dev_addr, ETH_ALEN) == 0) { in wps_registrar_skip_overlap()
3393 int wps_registrar_update_ie(struct wps_registrar *reg) in wps_registrar_update_ie() argument
3395 return wps_set_ie(reg); in wps_registrar_update_ie()
3402 struct wps_registrar *reg = eloop_ctx; in wps_registrar_set_selected_timeout() local
3406 reg->selected_registrar = 0; in wps_registrar_set_selected_timeout()
3407 reg->pbc = 0; in wps_registrar_set_selected_timeout()
3408 wps_registrar_selected_registrar_changed(reg, 0); in wps_registrar_set_selected_timeout()
3413 static void wps_registrar_sel_reg_add(struct wps_registrar *reg, in wps_registrar_sel_reg_add() argument
3420 reg->sel_reg_union = 1; in wps_registrar_sel_reg_add()
3421 if (reg->sel_reg_dev_password_id_override != DEV_PW_PUSHBUTTON) in wps_registrar_sel_reg_add()
3422 reg->sel_reg_dev_password_id_override = s->dev_password_id; in wps_registrar_sel_reg_add()
3423 if (reg->sel_reg_config_methods_override == -1) in wps_registrar_sel_reg_add()
3424 reg->sel_reg_config_methods_override = 0; in wps_registrar_sel_reg_add()
3425 reg->sel_reg_config_methods_override |= s->config_methods; in wps_registrar_sel_reg_add()
3427 if (is_zero_ether_addr(reg->authorized_macs_union[i])) in wps_registrar_sel_reg_add()
3435 os_memcpy(reg->authorized_macs_union[i], in wps_registrar_sel_reg_add()
3440 (u8 *) reg->authorized_macs_union, in wps_registrar_sel_reg_add()
3441 sizeof(reg->authorized_macs_union)); in wps_registrar_sel_reg_add()
3446 static void wps_registrar_sel_reg_union(struct wps_registrar *reg) in wps_registrar_sel_reg_union() argument
3451 if (reg->wps->wps_upnp == NULL) in wps_registrar_sel_reg_union()
3454 dl_list_for_each(s, ®->wps->wps_upnp->subscriptions, in wps_registrar_sel_reg_union()
3464 wps_registrar_sel_reg_add(reg, s); in wps_registrar_sel_reg_union()
3480 void wps_registrar_selected_registrar_changed(struct wps_registrar *reg, in wps_registrar_selected_registrar_changed() argument
3485 reg->sel_reg_union = reg->selected_registrar; in wps_registrar_selected_registrar_changed()
3486 reg->sel_reg_dev_password_id_override = -1; in wps_registrar_selected_registrar_changed()
3487 reg->sel_reg_config_methods_override = -1; in wps_registrar_selected_registrar_changed()
3488 os_memcpy(reg->authorized_macs_union, reg->authorized_macs, in wps_registrar_selected_registrar_changed()
3491 (u8 *) reg->authorized_macs_union, in wps_registrar_selected_registrar_changed()
3492 sizeof(reg->authorized_macs_union)); in wps_registrar_selected_registrar_changed()
3493 if (reg->selected_registrar) { in wps_registrar_selected_registrar_changed()
3496 methods = reg->wps->config_methods & ~WPS_CONFIG_PUSHBUTTON; in wps_registrar_selected_registrar_changed()
3499 if (reg->pbc) { in wps_registrar_selected_registrar_changed()
3500 reg->sel_reg_dev_password_id_override = in wps_registrar_selected_registrar_changed()
3502 wps_set_pushbutton(&methods, reg->wps->config_methods); in wps_registrar_selected_registrar_changed()
3504 reg->sel_reg_dev_password_id_override = dev_pw_id; in wps_registrar_selected_registrar_changed()
3506 "(pbc=%d)", reg->pbc); in wps_registrar_selected_registrar_changed()
3507 reg->sel_reg_config_methods_override = methods; in wps_registrar_selected_registrar_changed()
3511 wps_registrar_sel_reg_union(reg); in wps_registrar_selected_registrar_changed()
3513 wps_set_ie(reg); in wps_registrar_selected_registrar_changed()
3514 wps_cb_set_sel_reg(reg); in wps_registrar_selected_registrar_changed()
3518 int wps_registrar_get_info(struct wps_registrar *reg, const u8 *addr, in wps_registrar_get_info() argument
3526 d = wps_device_get(reg, addr); in wps_registrar_get_info()
3556 int wps_registrar_config_ap(struct wps_registrar *reg, in wps_registrar_config_ap() argument
3587 if (reg->wps->cred_cb) in wps_registrar_config_ap()
3588 return reg->wps->cred_cb(reg->wps->cb_ctx, cred); in wps_registrar_config_ap()
3596 int wps_registrar_add_nfc_pw_token(struct wps_registrar *reg, in wps_registrar_add_nfc_pw_token() argument
3613 wps_free_nfc_pw_tokens(®->nfc_pw_tokens, pw_id); in wps_registrar_add_nfc_pw_token()
3632 dl_list_add(®->nfc_pw_tokens, &token->list); in wps_registrar_add_nfc_pw_token()
3634 reg->selected_registrar = 1; in wps_registrar_add_nfc_pw_token()
3635 reg->pbc = 0; in wps_registrar_add_nfc_pw_token()
3636 wps_registrar_add_authorized_mac(reg, in wps_registrar_add_nfc_pw_token()
3638 wps_registrar_selected_registrar_changed(reg, pw_id); in wps_registrar_add_nfc_pw_token()
3639 eloop_cancel_timeout(wps_registrar_set_selected_timeout, reg, NULL); in wps_registrar_add_nfc_pw_token()
3642 reg, NULL); in wps_registrar_add_nfc_pw_token()
3651 int wps_registrar_add_nfc_password_token(struct wps_registrar *reg, in wps_registrar_add_nfc_password_token() argument
3677 return wps_registrar_add_nfc_pw_token(reg, hash, id, dev_pw, in wps_registrar_add_nfc_password_token()
3682 void wps_registrar_remove_nfc_pw_token(struct wps_registrar *reg, in wps_registrar_remove_nfc_pw_token() argument
3685 wps_registrar_remove_authorized_mac(reg, in wps_registrar_remove_nfc_pw_token()
3687 wps_registrar_selected_registrar_changed(reg, 0); in wps_registrar_remove_nfc_pw_token()