static void hostapd_wps_pin_needed_cb(void *ctx, const u8 *uuid_e, const struct wps_device_data *dev) { struct hostapd_data *hapd = ctx; char uuid[40], txt[400]; int len; if (uuid_bin2str(uuid_e, uuid, sizeof(uuid))) return; wpa_printf(MSG_DEBUG, "WPS: PIN needed for E-UUID %s", uuid); len = os_snprintf(txt, sizeof(txt), WPS_EVENT_PIN_NEEDED "%s " MACSTR " [%s|%s|%s|%s|%s|%d-%08X-%d]", uuid, MAC2STR(dev->mac_addr), dev->device_name, dev->manufacturer, dev->model_name, dev->model_number, dev->serial_number, dev->categ, dev->oui, dev->sub_categ); if (len > 0 && len < (int) sizeof(txt)) wpa_msg(hapd, MSG_INFO, "%s", txt); if (hapd->conf->wps_pin_requests) { FILE *f; struct os_time t; f = fopen(hapd->conf->wps_pin_requests, "a"); if (f == NULL) return; os_get_time(&t); fprintf(f, "%ld\t%s\t" MACSTR "\t%s\t%s\t%s\t%s\t%s" "\t%d-%08X-%d\n", t.sec, uuid, MAC2STR(dev->mac_addr), dev->device_name, dev->manufacturer, dev->model_name, dev->model_number, dev->serial_number, dev->categ, dev->oui, dev->sub_categ); fclose(f); } }
static int wps_er_get_sid(struct wps_er_ap *ap, char *sid) { char *pos; char txt[100]; if (!sid) { wpa_printf(MSG_DEBUG, "WPS ER: No SID received from %s (%s)", inet_ntoa(ap->addr), ap->location); return -1; } pos = os_strstr(sid, "uuid:"); if (!pos) { wpa_printf(MSG_DEBUG, "WPS ER: Invalid SID received from " "%s (%s): '%s'", inet_ntoa(ap->addr), ap->location, sid); return -1; } pos += 5; if (uuid_str2bin(pos, ap->sid) < 0) { wpa_printf(MSG_DEBUG, "WPS ER: Invalid SID received from " "%s (%s): '%s'", inet_ntoa(ap->addr), ap->location, sid); return -1; } uuid_bin2str(ap->sid, txt, sizeof(txt)); wpa_printf(MSG_DEBUG, "WPS ER: SID for subscription with %s (%s): %s", inet_ntoa(ap->addr), ap->location, txt); return 0; }
static void wpa_supplicant_wps_event_er_ap_remove(struct wpa_supplicant *wpa_s, struct wps_event_er_ap *ap) { char uuid_str[100]; uuid_bin2str(ap->uuid, uuid_str, sizeof(uuid_str)); wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_ER_AP_REMOVE "%s", uuid_str); }
static struct wpabuf * event_build_message(struct wps_event_ *e) { struct wpabuf *buf; char *b; buf = wpabuf_alloc(1000 + wpabuf_len(e->data)); if (buf == NULL) return NULL; wpabuf_printf(buf, "NOTIFY %s HTTP/1.1\r\n", e->addr->path); wpabuf_put_str(buf, "SERVER: Unspecified, UPnP/1.0, Unspecified\r\n"); wpabuf_printf(buf, "HOST: %s\r\n", e->addr->domain_and_port); wpabuf_put_str(buf, "CONTENT-TYPE: text/xml; charset=\"utf-8\"\r\n" "NT: upnp:event\r\n" "NTS: upnp:propchange\r\n"); wpabuf_put_str(buf, "SID: uuid:"); b = wpabuf_put(buf, 0); uuid_bin2str(e->s->uuid, b, 80); wpabuf_put(buf, os_strlen(b)); wpabuf_put_str(buf, "\r\n"); wpabuf_printf(buf, "SEQ: %u\r\n", e->subscriber_sequence); wpabuf_printf(buf, "CONTENT-LENGTH: %d\r\n", (int) wpabuf_len(e->data)); wpabuf_put_str(buf, "\r\n"); /* terminating empty line */ wpabuf_put_buf(buf, e->data); return buf; }
static void wpa_supplicant_wps_event_er_set_sel_reg( struct wpa_supplicant *wpa_s, struct wps_event_er_set_selected_registrar *ev) { char uuid_str[100]; uuid_bin2str(ev->uuid, uuid_str, sizeof(uuid_str)); switch (ev->state) { case WPS_ER_SET_SEL_REG_START: wpa_msg(wpa_s, MSG_DEBUG, WPS_EVENT_ER_SET_SEL_REG "uuid=%s state=START sel_reg=%d dev_passwd_id=%u " "sel_reg_config_methods=0x%x", uuid_str, ev->sel_reg, ev->dev_passwd_id, ev->sel_reg_config_methods); break; case WPS_ER_SET_SEL_REG_DONE: wpa_msg(wpa_s, MSG_DEBUG, WPS_EVENT_ER_SET_SEL_REG "uuid=%s state=DONE", uuid_str); break; case WPS_ER_SET_SEL_REG_FAILED: wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_ER_SET_SEL_REG "uuid=%s state=FAILED", uuid_str); break; } }
static void wpa_supplicant_wps_event_er_enrollee_remove( struct wpa_supplicant *wpa_s, struct wps_event_er_enrollee *enrollee) { char uuid_str[100]; uuid_bin2str(enrollee->uuid, uuid_str, sizeof(uuid_str)); wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_ER_ENROLLEE_REMOVE "%s " MACSTR, uuid_str, MAC2STR(enrollee->mac_addr)); }
static int wpa_config_write_global(struct wpa_config *config, HKEY hk) { #ifdef CONFIG_CTRL_IFACE wpa_config_write_reg_string(hk, "ctrl_interface", config->ctrl_interface); #endif /* CONFIG_CTRL_IFACE */ wpa_config_write_reg_dword(hk, TEXT("eapol_version"), config->eapol_version, DEFAULT_EAPOL_VERSION); wpa_config_write_reg_dword(hk, TEXT("ap_scan"), config->ap_scan, DEFAULT_AP_SCAN); wpa_config_write_reg_dword(hk, TEXT("fast_reauth"), config->fast_reauth, DEFAULT_FAST_REAUTH); wpa_config_write_reg_dword(hk, TEXT("dot11RSNAConfigPMKLifetime"), config->dot11RSNAConfigPMKLifetime, 0); wpa_config_write_reg_dword(hk, TEXT("dot11RSNAConfigPMKReauthThreshold"), config->dot11RSNAConfigPMKReauthThreshold, 0); wpa_config_write_reg_dword(hk, TEXT("dot11RSNAConfigSATimeout"), config->dot11RSNAConfigSATimeout, 0); wpa_config_write_reg_dword(hk, TEXT("update_config"), config->update_config, 0); #ifdef CONFIG_WPS if (!is_nil_uuid(config->uuid)) { char buf[40]; uuid_bin2str(config->uuid, buf, sizeof(buf)); wpa_config_write_reg_string(hk, "uuid", buf); } wpa_config_write_reg_string(hk, "device_name", config->device_name); wpa_config_write_reg_string(hk, "manufacturer", config->manufacturer); wpa_config_write_reg_string(hk, "model_name", config->model_name); wpa_config_write_reg_string(hk, "model_number", config->model_number); wpa_config_write_reg_string(hk, "serial_number", config->serial_number); wpa_config_write_reg_string(hk, "device_type", config->device_type); wpa_config_write_reg_string(hk, "config_methods", config->config_methods); if (WPA_GET_BE32(config->os_version)) { char vbuf[10]; os_snprintf(vbuf, sizeof(vbuf), "%08x", WPA_GET_BE32(config->os_version)); wpa_config_write_reg_string(hk, "os_version", vbuf); } wpa_config_write_reg_dword(hk, TEXT("wps_cred_processing"), config->wps_cred_processing, 0); #endif /* CONFIG_WPS */ wpa_config_write_reg_dword(hk, TEXT("bss_max_count"), config->bss_max_count, DEFAULT_BSS_MAX_COUNT); wpa_config_write_reg_dword(hk, TEXT("filter_ssids"), config->filter_ssids, 0); return 0; }
/* format_wps_device_xml -- produce content of "file" wps_device.xml * (UPNP_WPS_DEVICE_XML_FILE) */ static void format_wps_device_xml(struct upnp_wps_device_interface *iface, struct upnp_wps_device_sm *sm, struct wpabuf *buf) { const char *s; char uuid_string[80]; wpabuf_put_str(buf, wps_device_xml_prefix); /* * Add required fields with default values if not configured. Add * optional and recommended fields only if configured. */ s = iface->wps->friendly_name; s = ((s && *s) ? s : "WPS Access Point"); xml_add_tagged_data(buf, "friendlyName", s); s = iface->wps->dev.manufacturer; s = ((s && *s) ? s : ""); xml_add_tagged_data(buf, "manufacturer", s); if (iface->wps->manufacturer_url) xml_add_tagged_data(buf, "manufacturerURL", iface->wps->manufacturer_url); if (iface->wps->model_description) xml_add_tagged_data(buf, "modelDescription", iface->wps->model_description); s = iface->wps->dev.model_name; s = ((s && *s) ? s : ""); xml_add_tagged_data(buf, "modelName", s); if (iface->wps->dev.model_number) xml_add_tagged_data(buf, "modelNumber", iface->wps->dev.model_number); if (iface->wps->model_url) xml_add_tagged_data(buf, "modelURL", iface->wps->model_url); if (iface->wps->dev.serial_number) xml_add_tagged_data(buf, "serialNumber", iface->wps->dev.serial_number); uuid_bin2str(iface->wps->uuid, uuid_string, sizeof(uuid_string)); s = uuid_string; /* Need "uuid:" prefix, thus we can't use xml_add_tagged_data() * easily... */ wpabuf_put_str(buf, "<UDN>uuid:"); xml_data_encode(buf, s, os_strlen(s)); wpabuf_put_str(buf, "</UDN>\n"); if (iface->wps->upc) xml_add_tagged_data(buf, "UPC", iface->wps->upc); wpabuf_put_str(buf, wps_device_xml_postfix); }
static void hostapd_wps_reg_success_cb(void *ctx, const u8 *mac_addr, const u8 *uuid_e) { struct hostapd_data *hapd = ctx; char uuid[40]; if (uuid_bin2str(uuid_e, uuid, sizeof(uuid))) return; wpa_msg(hapd, MSG_INFO, WPS_EVENT_REG_SUCCESS MACSTR " %s", MAC2STR(mac_addr), uuid); }
static void wps_er_ap_unsubscribe(struct wps_er *er, struct wps_er_ap *ap) { struct wpabuf *req; struct sockaddr_in dst; char *url, *path; char sid[100]; if (ap->event_sub_url == NULL) { wpa_printf(MSG_DEBUG, "WPS ER: No eventSubURL - cannot " "subscribe"); goto fail; } if (ap->http) { wpa_printf(MSG_DEBUG, "WPS ER: Pending HTTP request - cannot " "send subscribe request"); goto fail; } url = http_client_url_parse(ap->event_sub_url, &dst, &path); if (url == NULL) { wpa_printf(MSG_DEBUG, "WPS ER: Failed to parse eventSubURL"); goto fail; } req = wpabuf_alloc(os_strlen(ap->event_sub_url) + 1000); if (req == NULL) { os_free(url); goto fail; } uuid_bin2str(ap->sid, sid, sizeof(sid)); wpabuf_printf(req, "UNSUBSCRIBE %s HTTP/1.1\r\n" "HOST: %s:%d\r\n" "SID: uuid:%s\r\n" "\r\n", path, inet_ntoa(dst.sin_addr), ntohs(dst.sin_port), sid); os_free(url); wpa_hexdump_ascii(MSG_MSGDUMP, "WPS ER: Unsubscription request", wpabuf_head(req), wpabuf_len(req)); ap->http = http_client_addr(&dst, req, 1000, wps_er_http_unsubscribe_cb, ap); if (ap->http == NULL) { wpabuf_free(req); goto fail; } return; fail: /* * Need to get rid of the AP entry even when we fail to unsubscribe * cleanly. */ wps_er_ap_unsubscribed(ap->er, ap); }
static int wpa_config_process_uuid(const struct global_parse_data *data, struct wpa_config *config, int line, const char *pos) { char buf[40]; if (uuid_str2bin(pos, config->uuid)) { wpa_printf(MSG_ERROR, "Line %d: invalid UUID", line); return -1; } uuid_bin2str(config->uuid, buf, sizeof(buf)); wpa_printf(MSG_DEBUG, "uuid=%s", buf); return 0; }
static void hostapd_wps_reg_success_cb(void *ctx, const u8 *mac_addr, const u8 *uuid_e) { struct hostapd_data *hapd = ctx; char uuid[40]; struct wps_stop_reg_data data; if (uuid_bin2str(uuid_e, uuid, sizeof(uuid))) return; wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_REG_SUCCESS MACSTR " %s", MAC2STR(mac_addr), uuid); if (hapd->wps_reg_success_cb) hapd->wps_reg_success_cb(hapd->wps_reg_success_cb_ctx, mac_addr, uuid_e); data.current_hapd = hapd; data.uuid_e = uuid_e; hostapd_wps_for_each(hapd, wps_stop_registrar, &data); }
static void wpas_wps_pin_needed_cb(void *ctx, const u8 *uuid_e, const struct wps_device_data *dev) { char uuid[40], txt[400]; int len; if (uuid_bin2str(uuid_e, uuid, sizeof(uuid))) return; wpa_printf(MSG_DEBUG, "WPS: PIN needed for UUID-E %s", uuid); len = os_snprintf(txt, sizeof(txt), "WPS-EVENT-PIN-NEEDED %s " MACSTR " [%s|%s|%s|%s|%s|%d-%08X-%d]", uuid, MAC2STR(dev->mac_addr), dev->device_name, dev->manufacturer, dev->model_name, dev->model_number, dev->serial_number, dev->categ, dev->oui, dev->sub_categ); if (len > 0 && len < (int) sizeof(txt)) wpa_printf(MSG_INFO, "%s", txt); }
static int gen_uuid(const char *txt_addr) { u8 addr[ETH_ALEN]; u8 uuid[UUID_LEN]; char buf[100]; if (hwaddr_aton(txt_addr, addr) < 0) return -1; uuid_gen_mac_addr(addr, uuid); if (uuid_bin2str(uuid, buf, sizeof(buf)) < 0) return -1; printf("%s\n", buf); return 0; }
static void wpas_wps_pin_needed_cb(void *ctx, const u8 *uuid_e, const struct wps_device_data *dev) { char uuid[40], txt[400]; int len; char devtype[WPS_DEV_TYPE_BUFSIZE]; if (uuid_bin2str(uuid_e, uuid, sizeof(uuid))) return; wpa_printf(MSG_DEBUG, "WPS: PIN needed for UUID-E %s", uuid); len = os_snprintf(txt, sizeof(txt), "WPS-EVENT-PIN-NEEDED %s " MACSTR " [%s|%s|%s|%s|%s|%s]", uuid, MAC2STR(dev->mac_addr), dev->device_name, dev->manufacturer, dev->model_name, dev->model_number, dev->serial_number, wps_dev_type_bin2str(dev->pri_dev_type, devtype, sizeof(devtype))); if (len > 0 && len < (int) sizeof(txt)) wpa_printf(MSG_INFO, "%s", txt); }
static void hostapd_wps_enrollee_seen_cb(void *ctx, const u8 *addr, const u8 *uuid_e, const u8 *pri_dev_type, u16 config_methods, u16 dev_password_id, u8 request_type, const char *dev_name) { struct hostapd_data *hapd = ctx; char uuid[40]; char devtype[WPS_DEV_TYPE_BUFSIZE]; if (uuid_bin2str(uuid_e, uuid, sizeof(uuid))) return; if (dev_name == NULL) dev_name = ""; wpa_msg_ctrl(hapd->msg_ctx, MSG_INFO, WPS_EVENT_ENROLLEE_SEEN MACSTR " %s %s 0x%x %u %u [%s]", MAC2STR(addr), uuid, wps_dev_type_bin2str(pri_dev_type, devtype, sizeof(devtype)), config_methods, dev_password_id, request_type, dev_name); }
static void wpa_supplicant_wps_event_er_ap_add(struct wpa_supplicant *wpa_s, struct wps_event_er_ap *ap) { char uuid_str[100]; char dev_type[WPS_DEV_TYPE_BUFSIZE]; uuid_bin2str(ap->uuid, uuid_str, sizeof(uuid_str)); if (ap->pri_dev_type) wps_dev_type_bin2str(ap->pri_dev_type, dev_type, sizeof(dev_type)); else dev_type[0] = '\0'; wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_ER_AP_ADD "%s " MACSTR " pri_dev_type=%s wps_state=%d |%s|%s|%s|%s|%s|%s|", uuid_str, MAC2STR(ap->mac_addr), dev_type, ap->wps_state, ap->friendly_name ? ap->friendly_name : "", ap->manufacturer ? ap->manufacturer : "", ap->model_description ? ap->model_description : "", ap->model_name ? ap->model_name : "", ap->manufacturer_url ? ap->manufacturer_url : "", ap->model_url ? ap->model_url : ""); }
static void wpa_supplicant_wps_event_er_ap_settings( struct wpa_supplicant *wpa_s, struct wps_event_er_ap_settings *ap_settings) { char uuid_str[100]; char key_str[65]; const struct wps_credential *cred = ap_settings->cred; key_str[0] = '\0'; if (cred->auth_type & (WPS_AUTH_WPAPSK | WPS_AUTH_WPA2PSK)) { if (cred->key_len >= 8 && cred->key_len <= 64) { os_memcpy(key_str, cred->key, cred->key_len); key_str[cred->key_len] = '\0'; } } uuid_bin2str(ap_settings->uuid, uuid_str, sizeof(uuid_str)); /* Use wpa_msg_ctrl to avoid showing the key in debug log */ wpa_msg_ctrl(wpa_s, MSG_INFO, WPS_EVENT_ER_AP_SETTINGS "uuid=%s ssid=%s auth_type=0x%04x encr_type=0x%04x " "key=%s", uuid_str, wpa_ssid_txt(cred->ssid, cred->ssid_len), cred->auth_type, cred->encr_type, key_str); }
static void wpa_supplicant_wps_event_er_enrollee_add( struct wpa_supplicant *wpa_s, struct wps_event_er_enrollee *enrollee) { char uuid_str[100]; char dev_type[WPS_DEV_TYPE_BUFSIZE]; uuid_bin2str(enrollee->uuid, uuid_str, sizeof(uuid_str)); if (enrollee->pri_dev_type) wps_dev_type_bin2str(enrollee->pri_dev_type, dev_type, sizeof(dev_type)); else dev_type[0] = '\0'; wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_ER_ENROLLEE_ADD "%s " MACSTR " M1=%d config_methods=0x%x dev_passwd_id=%d pri_dev_type=%s " "|%s|%s|%s|%s|%s|", uuid_str, MAC2STR(enrollee->mac_addr), enrollee->m1_received, enrollee->config_methods, enrollee->dev_passwd_id, dev_type, enrollee->dev_name ? enrollee->dev_name : "", enrollee->manufacturer ? enrollee->manufacturer : "", enrollee->model_name ? enrollee->model_name : "", enrollee->model_number ? enrollee->model_number : "", enrollee->serial_number ? enrollee->serial_number : ""); }
static void wpa_config_write_global(FILE *f, struct wpa_config *config) { #ifdef CONFIG_CTRL_IFACE if (config->ctrl_interface) fprintf(f, "ctrl_interface=%s\n", config->ctrl_interface); if (config->ctrl_interface_group) fprintf(f, "ctrl_interface_group=%s\n", config->ctrl_interface_group); #endif /* CONFIG_CTRL_IFACE */ if (config->eapol_version != DEFAULT_EAPOL_VERSION) fprintf(f, "eapol_version=%d\n", config->eapol_version); if (config->ap_scan != DEFAULT_AP_SCAN) fprintf(f, "ap_scan=%d\n", config->ap_scan); if (config->disable_scan_offload) fprintf(f, "disable_scan_offload=%d\n", config->disable_scan_offload); if (config->fast_reauth != DEFAULT_FAST_REAUTH) fprintf(f, "fast_reauth=%d\n", config->fast_reauth); if (config->opensc_engine_path) fprintf(f, "opensc_engine_path=%s\n", config->opensc_engine_path); if (config->pkcs11_engine_path) fprintf(f, "pkcs11_engine_path=%s\n", config->pkcs11_engine_path); if (config->pkcs11_module_path) fprintf(f, "pkcs11_module_path=%s\n", config->pkcs11_module_path); if (config->openssl_ciphers) fprintf(f, "openssl_ciphers=%s\n", config->openssl_ciphers); if (config->pcsc_reader) fprintf(f, "pcsc_reader=%s\n", config->pcsc_reader); if (config->pcsc_pin) fprintf(f, "pcsc_pin=%s\n", config->pcsc_pin); if (config->driver_param) fprintf(f, "driver_param=%s\n", config->driver_param); if (config->dot11RSNAConfigPMKLifetime) fprintf(f, "dot11RSNAConfigPMKLifetime=%u\n", config->dot11RSNAConfigPMKLifetime); if (config->dot11RSNAConfigPMKReauthThreshold) fprintf(f, "dot11RSNAConfigPMKReauthThreshold=%u\n", config->dot11RSNAConfigPMKReauthThreshold); if (config->dot11RSNAConfigSATimeout) fprintf(f, "dot11RSNAConfigSATimeout=%u\n", config->dot11RSNAConfigSATimeout); if (config->update_config) fprintf(f, "update_config=%d\n", config->update_config); #ifdef CONFIG_WPS if (!is_nil_uuid(config->uuid)) { char buf[40]; uuid_bin2str(config->uuid, buf, sizeof(buf)); fprintf(f, "uuid=%s\n", buf); } if (config->device_name) fprintf(f, "device_name=%s\n", config->device_name); if (config->manufacturer) fprintf(f, "manufacturer=%s\n", config->manufacturer); if (config->model_name) fprintf(f, "model_name=%s\n", config->model_name); if (config->model_number) fprintf(f, "model_number=%s\n", config->model_number); if (config->serial_number) fprintf(f, "serial_number=%s\n", config->serial_number); { char _buf[WPS_DEV_TYPE_BUFSIZE], *buf; buf = wps_dev_type_bin2str(config->device_type, _buf, sizeof(_buf)); if (os_strcmp(buf, "0-00000000-0") != 0) fprintf(f, "device_type=%s\n", buf); } if (WPA_GET_BE32(config->os_version)) fprintf(f, "os_version=%08x\n", WPA_GET_BE32(config->os_version)); if (config->config_methods) fprintf(f, "config_methods=%s\n", config->config_methods); if (config->wps_cred_processing) fprintf(f, "wps_cred_processing=%d\n", config->wps_cred_processing); if (config->wps_vendor_ext_m1) { int i, len = wpabuf_len(config->wps_vendor_ext_m1); const u8 *p = wpabuf_head_u8(config->wps_vendor_ext_m1); if (len > 0) { fprintf(f, "wps_vendor_ext_m1="); for (i = 0; i < len; i++) fprintf(f, "%02x", *p++); fprintf(f, "\n"); } } #endif /* CONFIG_WPS */ #ifdef CONFIG_P2P if (config->p2p_listen_reg_class) fprintf(f, "p2p_listen_reg_class=%d\n", config->p2p_listen_reg_class); if (config->p2p_listen_channel) fprintf(f, "p2p_listen_channel=%d\n", config->p2p_listen_channel); if (config->p2p_oper_reg_class) fprintf(f, "p2p_oper_reg_class=%d\n", config->p2p_oper_reg_class); if (config->p2p_oper_channel) fprintf(f, "p2p_oper_channel=%d\n", config->p2p_oper_channel); if (config->p2p_go_intent != DEFAULT_P2P_GO_INTENT) fprintf(f, "p2p_go_intent=%d\n", config->p2p_go_intent); if (config->p2p_ssid_postfix) fprintf(f, "p2p_ssid_postfix=%s\n", config->p2p_ssid_postfix); if (config->persistent_reconnect) fprintf(f, "persistent_reconnect=%d\n", config->persistent_reconnect); if (config->p2p_intra_bss != DEFAULT_P2P_INTRA_BSS) fprintf(f, "p2p_intra_bss=%d\n", config->p2p_intra_bss); if (config->p2p_group_idle) fprintf(f, "p2p_group_idle=%d\n", config->p2p_group_idle); if (config->p2p_passphrase_len) fprintf(f, "p2p_passphrase_len=%u\n", config->p2p_passphrase_len); if (config->p2p_pref_chan) { unsigned int i; fprintf(f, "p2p_pref_chan="); for (i = 0; i < config->num_p2p_pref_chan; i++) { fprintf(f, "%s%u:%u", i > 0 ? "," : "", config->p2p_pref_chan[i].op_class, config->p2p_pref_chan[i].chan); } fprintf(f, "\n"); } if (config->p2p_no_go_freq.num) { char *val = freq_range_list_str(&config->p2p_no_go_freq); if (val) { fprintf(f, "p2p_no_go_freq=%s\n", val); os_free(val); } } if (config->p2p_add_cli_chan) fprintf(f, "p2p_add_cli_chan=%d\n", config->p2p_add_cli_chan); if (config->p2p_optimize_listen_chan != DEFAULT_P2P_OPTIMIZE_LISTEN_CHAN) fprintf(f, "p2p_optimize_listen_chan=%d\n", config->p2p_optimize_listen_chan); if (config->p2p_go_ht40) fprintf(f, "p2p_go_ht40=%d\n", config->p2p_go_ht40); if (config->p2p_go_vht) fprintf(f, "p2p_go_vht=%d\n", config->p2p_go_vht); if (config->p2p_go_ctwindow != DEFAULT_P2P_GO_CTWINDOW) fprintf(f, "p2p_go_ctwindow=%d\n", config->p2p_go_ctwindow); if (config->p2p_disabled) fprintf(f, "p2p_disabled=%d\n", config->p2p_disabled); if (config->p2p_no_group_iface) fprintf(f, "p2p_no_group_iface=%d\n", config->p2p_no_group_iface); if (config->p2p_ignore_shared_freq) fprintf(f, "p2p_ignore_shared_freq=%d\n", config->p2p_ignore_shared_freq); if (config->p2p_cli_probe) fprintf(f, "p2p_cli_probe=%d\n", config->p2p_cli_probe); if (config->p2p_go_freq_change_policy != DEFAULT_P2P_GO_FREQ_MOVE) fprintf(f, "p2p_go_freq_change_policy=%u\n", config->p2p_go_freq_change_policy); if (WPA_GET_BE32(config->ip_addr_go)) fprintf(f, "ip_addr_go=%u.%u.%u.%u\n", config->ip_addr_go[0], config->ip_addr_go[1], config->ip_addr_go[2], config->ip_addr_go[3]); if (WPA_GET_BE32(config->ip_addr_mask)) fprintf(f, "ip_addr_mask=%u.%u.%u.%u\n", config->ip_addr_mask[0], config->ip_addr_mask[1], config->ip_addr_mask[2], config->ip_addr_mask[3]); if (WPA_GET_BE32(config->ip_addr_start)) fprintf(f, "ip_addr_start=%u.%u.%u.%u\n", config->ip_addr_start[0], config->ip_addr_start[1], config->ip_addr_start[2], config->ip_addr_start[3]); if (WPA_GET_BE32(config->ip_addr_end)) fprintf(f, "ip_addr_end=%u.%u.%u.%u\n", config->ip_addr_end[0], config->ip_addr_end[1], config->ip_addr_end[2], config->ip_addr_end[3]); #endif /* CONFIG_P2P */ if (config->country[0] && config->country[1]) { fprintf(f, "country=%c%c\n", config->country[0], config->country[1]); } if (config->bss_max_count != DEFAULT_BSS_MAX_COUNT) fprintf(f, "bss_max_count=%u\n", config->bss_max_count); if (config->bss_expiration_age != DEFAULT_BSS_EXPIRATION_AGE) fprintf(f, "bss_expiration_age=%u\n", config->bss_expiration_age); if (config->bss_expiration_scan_count != DEFAULT_BSS_EXPIRATION_SCAN_COUNT) fprintf(f, "bss_expiration_scan_count=%u\n", config->bss_expiration_scan_count); if (config->filter_ssids) fprintf(f, "filter_ssids=%d\n", config->filter_ssids); if (config->max_num_sta != DEFAULT_MAX_NUM_STA) fprintf(f, "max_num_sta=%u\n", config->max_num_sta); if (config->disassoc_low_ack) fprintf(f, "disassoc_low_ack=%d\n", config->disassoc_low_ack); #ifdef CONFIG_HS20 if (config->hs20) fprintf(f, "hs20=1\n"); #endif /* CONFIG_HS20 */ #ifdef CONFIG_INTERWORKING if (config->interworking) fprintf(f, "interworking=%d\n", config->interworking); if (!is_zero_ether_addr(config->hessid)) fprintf(f, "hessid=" MACSTR "\n", MAC2STR(config->hessid)); if (config->access_network_type != DEFAULT_ACCESS_NETWORK_TYPE) fprintf(f, "access_network_type=%d\n", config->access_network_type); #endif /* CONFIG_INTERWORKING */ if (config->pbc_in_m1) fprintf(f, "pbc_in_m1=%d\n", config->pbc_in_m1); if (config->wps_nfc_pw_from_config) { if (config->wps_nfc_dev_pw_id) fprintf(f, "wps_nfc_dev_pw_id=%d\n", config->wps_nfc_dev_pw_id); write_global_bin(f, "wps_nfc_dh_pubkey", config->wps_nfc_dh_pubkey); write_global_bin(f, "wps_nfc_dh_privkey", config->wps_nfc_dh_privkey); write_global_bin(f, "wps_nfc_dev_pw", config->wps_nfc_dev_pw); } if (config->ext_password_backend) fprintf(f, "ext_password_backend=%s\n", config->ext_password_backend); if (config->p2p_go_max_inactivity != DEFAULT_P2P_GO_MAX_INACTIVITY) fprintf(f, "p2p_go_max_inactivity=%d\n", config->p2p_go_max_inactivity); if (config->auto_interworking) fprintf(f, "auto_interworking=%d\n", config->auto_interworking); if (config->okc) fprintf(f, "okc=%d\n", config->okc); if (config->pmf) fprintf(f, "pmf=%d\n", config->pmf); if (config->dtim_period) fprintf(f, "dtim_period=%d\n", config->dtim_period); if (config->beacon_int) fprintf(f, "beacon_int=%d\n", config->beacon_int); if (config->sae_groups) { int i; fprintf(f, "sae_groups="); for (i = 0; config->sae_groups[i] >= 0; i++) { fprintf(f, "%s%d", i > 0 ? " " : "", config->sae_groups[i]); } fprintf(f, "\n"); } if (config->ap_vendor_elements) { int i, len = wpabuf_len(config->ap_vendor_elements); const u8 *p = wpabuf_head_u8(config->ap_vendor_elements); if (len > 0) { fprintf(f, "ap_vendor_elements="); for (i = 0; i < len; i++) fprintf(f, "%02x", *p++); fprintf(f, "\n"); } } if (config->probe_req_ie) { int i, len = wpabuf_len(config->probe_req_ie); const u8 *p = wpabuf_head_u8(config->probe_req_ie); if (len > 0) { fprintf(f, "probe_req_ie="); for (i = 0; i < len; i++) fprintf(f, "%02x", *p++); fprintf(f, "\n"); } } if (config->assoc_req_ie) { int i, len = wpabuf_len(config->assoc_req_ie); const u8 *p = wpabuf_head_u8(config->assoc_req_ie); if (len > 0) { fprintf(f, "assoc_req_ie="); for (i = 0; i < len; i++) fprintf(f, "%02x", *p++); fprintf(f, "\n"); } } if (config->ignore_old_scan_res) fprintf(f, "ignore_old_scan_res=%d\n", config->ignore_old_scan_res); if (config->freq_list && config->freq_list[0]) { int i; fprintf(f, "freq_list="); for (i = 0; config->freq_list[i]; i++) { fprintf(f, "%s%d", i > 0 ? " " : "", config->freq_list[i]); } fprintf(f, "\n"); } if (config->scan_cur_freq != DEFAULT_SCAN_CUR_FREQ) fprintf(f, "scan_cur_freq=%d\n", config->scan_cur_freq); if (config->chan_width != DEFAULT_CHAN_WIDTH) fprintf(f, "chan_width=%d\n", config->chan_width); if (config->sched_scan_interval) fprintf(f, "sched_scan_interval=%u\n", config->sched_scan_interval); if (config->external_sim) fprintf(f, "external_sim=%d\n", config->external_sim); if (config->tdls_external_control) fprintf(f, "tdls_external_control=%d\n", config->tdls_external_control); if (config->wowlan_triggers) fprintf(f, "wowlan_triggers=%s\n", config->wowlan_triggers); if (config->bgscan) fprintf(f, "bgscan=\"%s\"\n", config->bgscan); if (config->p2p_search_delay != DEFAULT_P2P_SEARCH_DELAY) fprintf(f, "p2p_search_delay=%u\n", config->p2p_search_delay); if (config->mac_addr) fprintf(f, "mac_addr=%d\n", config->mac_addr); if (config->rand_addr_lifetime != DEFAULT_RAND_ADDR_LIFETIME) fprintf(f, "rand_addr_lifetime=%u\n", config->rand_addr_lifetime); if (config->preassoc_mac_addr) fprintf(f, "preassoc_mac_addr=%d\n", config->preassoc_mac_addr); if (config->key_mgmt_offload != DEFAULT_KEY_MGMT_OFFLOAD) fprintf(f, "key_mgmt_offload=%d\n", config->key_mgmt_offload); if (config->user_mpm != DEFAULT_USER_MPM) fprintf(f, "user_mpm=%d\n", config->user_mpm); if (config->max_peer_links != DEFAULT_MAX_PEER_LINKS) fprintf(f, "max_peer_links=%d\n", config->max_peer_links); if (config->cert_in_cb != DEFAULT_CERT_IN_CB) fprintf(f, "cert_in_cb=%d\n", config->cert_in_cb); if (config->mesh_max_inactivity != DEFAULT_MESH_MAX_INACTIVITY) fprintf(f, "mesh_max_inactivity=%d\n", config->mesh_max_inactivity); if (config->dot11RSNASAERetransPeriod != DEFAULT_DOT11_RSNA_SAE_RETRANS_PERIOD) fprintf(f, "dot11RSNASAERetransPeriod=%d\n", config->dot11RSNASAERetransPeriod); if (config->passive_scan) fprintf(f, "passive_scan=%d\n", config->passive_scan); if (config->reassoc_same_bss_optim) fprintf(f, "reassoc_same_bss_optim=%d\n", config->reassoc_same_bss_optim); if (config->wps_priority) fprintf(f, "wps_priority=%d\n", config->wps_priority); if (config->wpa_rsc_relaxation != DEFAULT_WPA_RSC_RELAXATION) fprintf(f, "wpa_rsc_relaxation=%d\n", config->wpa_rsc_relaxation); if (config->sched_scan_plans) fprintf(f, "sched_scan_plans=%s\n", config->sched_scan_plans); #ifdef CONFIG_MBO if (config->non_pref_chan) fprintf(f, "non_pref_chan=%s\n", config->non_pref_chan); if (config->mbo_cell_capa != DEFAULT_MBO_CELL_CAPA) fprintf(f, "mbo_cell_capa=%u\n", config->mbo_cell_capa); #endif /* CONFIG_MBO */ }
static int wpa_config_write_global(struct wpa_config *config, HKEY hk) { #ifdef CONFIG_CTRL_IFACE wpa_config_write_reg_string(hk, "ctrl_interface", config->ctrl_interface); #endif /* CONFIG_CTRL_IFACE */ wpa_config_write_reg_dword(hk, TEXT("eapol_version"), config->eapol_version, DEFAULT_EAPOL_VERSION); wpa_config_write_reg_dword(hk, TEXT("ap_scan"), config->ap_scan, DEFAULT_AP_SCAN); wpa_config_write_reg_dword(hk, TEXT("fast_reauth"), config->fast_reauth, DEFAULT_FAST_REAUTH); wpa_config_write_reg_dword(hk, TEXT("dot11RSNAConfigPMKLifetime"), config->dot11RSNAConfigPMKLifetime, 0); wpa_config_write_reg_dword(hk, TEXT("dot11RSNAConfigPMKReauthThreshold"), config->dot11RSNAConfigPMKReauthThreshold, 0); wpa_config_write_reg_dword(hk, TEXT("dot11RSNAConfigSATimeout"), config->dot11RSNAConfigSATimeout, 0); wpa_config_write_reg_dword(hk, TEXT("update_config"), config->update_config, 0); #ifdef CONFIG_WPS if (!is_nil_uuid(config->uuid)) { char buf[40]; uuid_bin2str(config->uuid, buf, sizeof(buf)); wpa_config_write_reg_string(hk, "uuid", buf); } wpa_config_write_reg_string(hk, "device_name", config->device_name); wpa_config_write_reg_string(hk, "manufacturer", config->manufacturer); wpa_config_write_reg_string(hk, "model_name", config->model_name); wpa_config_write_reg_string(hk, "model_number", config->model_number); wpa_config_write_reg_string(hk, "serial_number", config->serial_number); { char _buf[WPS_DEV_TYPE_BUFSIZE], *buf; buf = wps_dev_type_bin2str(config->device_type, _buf, sizeof(_buf)); wpa_config_write_reg_string(hk, "device_type", buf); } wpa_config_write_reg_string(hk, "config_methods", config->config_methods); if (WPA_GET_BE32(config->os_version)) { char vbuf[10]; os_snprintf(vbuf, sizeof(vbuf), "%08x", WPA_GET_BE32(config->os_version)); wpa_config_write_reg_string(hk, "os_version", vbuf); } wpa_config_write_reg_dword(hk, TEXT("wps_cred_processing"), config->wps_cred_processing, 0); #endif /* CONFIG_WPS */ #ifdef CONFIG_P2P wpa_config_write_reg_string(hk, "p2p_ssid_postfix", config->p2p_ssid_postfix); wpa_config_write_reg_dword(hk, TEXT("p2p_group_idle"), config->p2p_group_idle, 0); #endif /* CONFIG_P2P */ wpa_config_write_reg_dword(hk, TEXT("bss_max_count"), config->bss_max_count, DEFAULT_BSS_MAX_COUNT); wpa_config_write_reg_dword(hk, TEXT("filter_ssids"), config->filter_ssids, 0); wpa_config_write_reg_dword(hk, TEXT("max_num_sta"), config->max_num_sta, DEFAULT_MAX_NUM_STA); wpa_config_write_reg_dword(hk, TEXT("disassoc_low_ack"), config->disassoc_low_ack, 0); wpa_config_write_reg_dword(hk, TEXT("sched_scan_num_short_intervals"), config->sched_scan_num_short_intervals, DEFAULT_SCHED_SCAN_NUM_SHORT_INTERVALS); wpa_config_write_reg_dword(hk, TEXT("sched_scan_short_interval"), config->sched_scan_short_interval, DEFAULT_SCHED_SCAN_SHORT_INTERVAL); wpa_config_write_reg_dword(hk, TEXT("sched_scan_long_interval"), config->sched_scan_long_interval, DEFAULT_SCHED_SCAN_LONG_INTERVAL); wpa_config_write_reg_dword(hk, TEXT("okc"), config->okc, 0); wpa_config_write_reg_dword(hk, TEXT("pmf"), config->pmf, 0); return 0; }
static void wpa_config_write_global(FILE *f, struct wpa_config *config) { #ifdef CONFIG_CTRL_IFACE if (config->ctrl_interface) fprintf(f, "ctrl_interface=%s\n", config->ctrl_interface); if (config->ctrl_interface_group) fprintf(f, "ctrl_interface_group=%s\n", config->ctrl_interface_group); #endif /* CONFIG_CTRL_IFACE */ if (config->eapol_version != DEFAULT_EAPOL_VERSION) fprintf(f, "eapol_version=%d\n", config->eapol_version); if (config->ap_scan != DEFAULT_AP_SCAN) fprintf(f, "ap_scan=%d\n", config->ap_scan); if (config->disable_scan_offload) fprintf(f, "disable_scan_offload=%d\n", config->disable_scan_offload); if (config->fast_reauth != DEFAULT_FAST_REAUTH) fprintf(f, "fast_reauth=%d\n", config->fast_reauth); if (config->opensc_engine_path) fprintf(f, "opensc_engine_path=%s\n", config->opensc_engine_path); if (config->pkcs11_engine_path) fprintf(f, "pkcs11_engine_path=%s\n", config->pkcs11_engine_path); if (config->pkcs11_module_path) fprintf(f, "pkcs11_module_path=%s\n", config->pkcs11_module_path); if (config->pcsc_reader) fprintf(f, "pcsc_reader=%s\n", config->pcsc_reader); if (config->pcsc_pin) fprintf(f, "pcsc_pin=%s\n", config->pcsc_pin); if (config->driver_param) fprintf(f, "driver_param=%s\n", config->driver_param); if (config->dot11RSNAConfigPMKLifetime) fprintf(f, "dot11RSNAConfigPMKLifetime=%d\n", config->dot11RSNAConfigPMKLifetime); if (config->dot11RSNAConfigPMKReauthThreshold) fprintf(f, "dot11RSNAConfigPMKReauthThreshold=%d\n", config->dot11RSNAConfigPMKReauthThreshold); if (config->dot11RSNAConfigSATimeout) fprintf(f, "dot11RSNAConfigSATimeout=%d\n", config->dot11RSNAConfigSATimeout); if (config->update_config) fprintf(f, "update_config=%d\n", config->update_config); #ifdef CONFIG_WPS if (!is_nil_uuid(config->uuid)) { char buf[40]; uuid_bin2str(config->uuid, buf, sizeof(buf)); fprintf(f, "uuid=%s\n", buf); } if (config->device_name) fprintf(f, "device_name=%s\n", config->device_name); if (config->manufacturer) fprintf(f, "manufacturer=%s\n", config->manufacturer); if (config->model_name) fprintf(f, "model_name=%s\n", config->model_name); if (config->model_number) fprintf(f, "model_number=%s\n", config->model_number); if (config->serial_number) fprintf(f, "serial_number=%s\n", config->serial_number); { char _buf[WPS_DEV_TYPE_BUFSIZE], *buf; buf = wps_dev_type_bin2str(config->device_type, _buf, sizeof(_buf)); if (os_strcmp(buf, "0-00000000-0") != 0) fprintf(f, "device_type=%s\n", buf); } if (WPA_GET_BE32(config->os_version)) fprintf(f, "os_version=%08x\n", WPA_GET_BE32(config->os_version)); if (config->config_methods) fprintf(f, "config_methods=%s\n", config->config_methods); if (config->wps_cred_processing) fprintf(f, "wps_cred_processing=%d\n", config->wps_cred_processing); if (config->wps_vendor_ext_m1) { int i, len = wpabuf_len(config->wps_vendor_ext_m1); const u8 *p = wpabuf_head_u8(config->wps_vendor_ext_m1); if (len > 0) { fprintf(f, "wps_vendor_ext_m1="); for (i = 0; i < len; i++) fprintf(f, "%02x", *p++); fprintf(f, "\n"); } } #endif /* CONFIG_WPS */ #ifdef CONFIG_P2P if (config->p2p_listen_reg_class) fprintf(f, "p2p_listen_reg_class=%u\n", config->p2p_listen_reg_class); if (config->p2p_listen_channel) fprintf(f, "p2p_listen_channel=%u\n", config->p2p_listen_channel); if (config->p2p_oper_reg_class) fprintf(f, "p2p_oper_reg_class=%u\n", config->p2p_oper_reg_class); if (config->p2p_oper_channel) fprintf(f, "p2p_oper_channel=%u\n", config->p2p_oper_channel); if (config->p2p_go_intent != DEFAULT_P2P_GO_INTENT) fprintf(f, "p2p_go_intent=%u\n", config->p2p_go_intent); if (config->p2p_ssid_postfix) fprintf(f, "p2p_ssid_postfix=%s\n", config->p2p_ssid_postfix); if (config->persistent_reconnect) fprintf(f, "persistent_reconnect=%u\n", config->persistent_reconnect); if (config->p2p_intra_bss != DEFAULT_P2P_INTRA_BSS) fprintf(f, "p2p_intra_bss=%u\n", config->p2p_intra_bss); if (config->p2p_group_idle) fprintf(f, "p2p_group_idle=%u\n", config->p2p_group_idle); if (config->p2p_pref_chan) { unsigned int i; fprintf(f, "p2p_pref_chan="); for (i = 0; i < config->num_p2p_pref_chan; i++) { fprintf(f, "%s%u:%u", i > 0 ? "," : "", config->p2p_pref_chan[i].op_class, config->p2p_pref_chan[i].chan); } fprintf(f, "\n"); } if (config->p2p_no_go_freq.num) { char *val = freq_range_list_str(&config->p2p_no_go_freq); if (val) { fprintf(f, "p2p_no_go_freq=%s\n", val); os_free(val); } } if (config->p2p_add_cli_chan) fprintf(f, "p2p_add_cli_chan=%d\n", config->p2p_add_cli_chan); if (config->p2p_go_ht40) fprintf(f, "p2p_go_ht40=%u\n", config->p2p_go_ht40); if (config->p2p_go_vht) fprintf(f, "p2p_go_vht=%u\n", config->p2p_go_vht); if (config->p2p_disabled) fprintf(f, "p2p_disabled=%u\n", config->p2p_disabled); if (config->p2p_no_group_iface) fprintf(f, "p2p_no_group_iface=%u\n", config->p2p_no_group_iface); if (config->p2p_ignore_shared_freq) fprintf(f, "p2p_ignore_shared_freq=%u\n", config->p2p_ignore_shared_freq); #endif /* CONFIG_P2P */ if (config->country[0] && config->country[1]) { fprintf(f, "country=%c%c\n", config->country[0], config->country[1]); } if (config->bss_max_count != DEFAULT_BSS_MAX_COUNT) fprintf(f, "bss_max_count=%u\n", config->bss_max_count); if (config->bss_expiration_age != DEFAULT_BSS_EXPIRATION_AGE) fprintf(f, "bss_expiration_age=%u\n", config->bss_expiration_age); if (config->bss_expiration_scan_count != DEFAULT_BSS_EXPIRATION_SCAN_COUNT) fprintf(f, "bss_expiration_scan_count=%u\n", config->bss_expiration_scan_count); if (config->filter_ssids) fprintf(f, "filter_ssids=%d\n", config->filter_ssids); if (config->max_num_sta != DEFAULT_MAX_NUM_STA) fprintf(f, "max_num_sta=%u\n", config->max_num_sta); if (config->disassoc_low_ack) fprintf(f, "disassoc_low_ack=%u\n", config->disassoc_low_ack); #ifdef CONFIG_HS20 if (config->hs20) fprintf(f, "hs20=1\n"); #endif /* CONFIG_HS20 */ #ifdef CONFIG_INTERWORKING if (config->interworking) fprintf(f, "interworking=%u\n", config->interworking); if (!is_zero_ether_addr(config->hessid)) fprintf(f, "hessid=" MACSTR "\n", MAC2STR(config->hessid)); if (config->access_network_type != DEFAULT_ACCESS_NETWORK_TYPE) fprintf(f, "access_network_type=%d\n", config->access_network_type); #endif /* CONFIG_INTERWORKING */ if (config->pbc_in_m1) fprintf(f, "pbc_in_m1=%u\n", config->pbc_in_m1); if (config->wps_nfc_pw_from_config) { if (config->wps_nfc_dev_pw_id) fprintf(f, "wps_nfc_dev_pw_id=%d\n", config->wps_nfc_dev_pw_id); write_global_bin(f, "wps_nfc_dh_pubkey", config->wps_nfc_dh_pubkey); write_global_bin(f, "wps_nfc_dh_privkey", config->wps_nfc_dh_privkey); write_global_bin(f, "wps_nfc_dev_pw", config->wps_nfc_dev_pw); } if (config->ext_password_backend) fprintf(f, "ext_password_backend=%s\n", config->ext_password_backend); if (config->p2p_go_max_inactivity != DEFAULT_P2P_GO_MAX_INACTIVITY) fprintf(f, "p2p_go_max_inactivity=%d\n", config->p2p_go_max_inactivity); if (config->auto_interworking) fprintf(f, "auto_interworking=%d\n", config->auto_interworking); if (config->okc) fprintf(f, "okc=%d\n", config->okc); if (config->pmf) fprintf(f, "pmf=%d\n", config->pmf); if (config->dtim_period) fprintf(f, "dtim_period=%d\n", config->dtim_period); if (config->beacon_int) fprintf(f, "beacon_int=%d\n", config->beacon_int); if (config->sae_groups) { int i; fprintf(f, "sae_groups="); for (i = 0; config->sae_groups[i] >= 0; i++) { fprintf(f, "%s%d", i > 0 ? " " : "", config->sae_groups[i]); } fprintf(f, "\n"); } if (config->ap_vendor_elements) { int i, len = wpabuf_len(config->ap_vendor_elements); const u8 *p = wpabuf_head_u8(config->ap_vendor_elements); if (len > 0) { fprintf(f, "ap_vendor_elements="); for (i = 0; i < len; i++) fprintf(f, "%02x", *p++); fprintf(f, "\n"); } } if (config->ignore_old_scan_res) fprintf(f, "ignore_old_scan_res=%d\n", config->ignore_old_scan_res); if (config->freq_list && config->freq_list[0]) { int i; fprintf(f, "freq_list="); for (i = 0; config->freq_list[i]; i++) { fprintf(f, "%s%u", i > 0 ? " " : "", config->freq_list[i]); } fprintf(f, "\n"); } if (config->scan_cur_freq != DEFAULT_SCAN_CUR_FREQ) fprintf(f, "scan_cur_freq=%d\n", config->scan_cur_freq); if (config->sched_scan_interval) fprintf(f, "sched_scan_interval=%u\n", config->sched_scan_interval); if (config->external_sim) fprintf(f, "external_sim=%d\n", config->external_sim); if (config->tdls_external_control) fprintf(f, "tdls_external_control=%d\n", config->tdls_external_control); }
int main(int argc, char **argv) { uint8_t anuuid[16]; uint8_t anuuid2[16]; uuid_str2bin(NOT_NIL_UUID_STR, anuuid); fprintf(stderr, "%s cmp %02x%02x%02x%02x-%02x%02x-%02x%02x-" "%02x%02x-%02x%02x%02x%02x%02x%02x\n", NOT_NIL_UUID_STR, anuuid[0], anuuid[1], anuuid[2], anuuid[3], anuuid[4], anuuid[5], anuuid[6], anuuid[7], anuuid[8], anuuid[9], anuuid[10], anuuid[11], anuuid[12], anuuid[13], anuuid[14], anuuid[15]); uuid_str2bin(NOT_NIL_UUID_STR2, anuuid2); fprintf(stderr, "%s cmp %02x%02x%02x%02x-%02x%02x-%02x%02x-" "%02x%02x-%02x%02x%02x%02x%02x%02x\n", NOT_NIL_UUID_STR2, anuuid2[0], anuuid2[1], anuuid2[2], anuuid2[3], anuuid2[4], anuuid2[5], anuuid2[6], anuuid2[7], anuuid2[8], anuuid2[9], anuuid2[10], anuuid2[11], anuuid2[12], anuuid2[13], anuuid2[14], anuuid2[15]); /* * uuid_is_nil with nil UUID */ uint8_t nilUUID[16] = NIL_UUID; char nilUUIDstr[40]; n_tests++; if (uuid_bin2str(nilUUID, nilUUIDstr, 40) < 0) { fprintf(stderr, "Failure\n"); goto skip1; } char isnil = uuid_is_nil(nilUUID); if (isnil) n_tests_passed++; else n_tests_failed++; printf("%s is nil? %s <%s>\n", nilUUIDstr, isnil ? "YES" : "NO", isnil ? "passed" : "failed" ); skip1: { /* * uuid_is_nil with not nil UUID */ uint8_t notNilUUID[16] = NOT_NIL_UUID; char notNilUUIDstr[40]; n_tests++; if (uuid_bin2str(notNilUUID, notNilUUIDstr, 40) < 0) { fprintf(stderr, "Failure\n"); goto skip2; } char isnil = uuid_is_nil(notNilUUID); if (!isnil) n_tests_passed++; else n_tests_failed++; printf("%s is nil? %s <%s>\n", notNilUUIDstr, isnil ? "YES" : "NO", isnil ? "failed" : "passed" ); } skip2: { /* * uuid_cmp with one nil UUID */ uint8_t nilUUID[16] = NIL_UUID; char nilUUIDstr[40]; uint8_t notNilUUID[16] = NOT_NIL_UUID; char notNilUUIDstr[40]; n_tests++; if (uuid_bin2str(nilUUID, nilUUIDstr, 40) < 0) { fprintf(stderr, "Failure\n"); goto skip3; } n_tests++; if (uuid_bin2str(notNilUUID, notNilUUIDstr, 40) < 0) { fprintf(stderr, "Failure\n"); goto skip3; } int8_t cmpval1 = uuid_cmp(notNilUUID, nilUUID); int8_t cmpval2 = uuid_cmp(nilUUID, notNilUUID); if (cmpval1 + cmpval2 == 0 && cmpval1 != 0) n_tests_passed+=2; else n_tests_failed+=2; printf("%s cmp %s = %d <%s>\n", notNilUUIDstr, nilUUIDstr, cmpval1, cmpval1 ? "passed" : "failed" ); printf("%s cmp %s = %d <%s>\n", nilUUIDstr, notNilUUIDstr, cmpval2, cmpval2 ? "passed" : "failed" ); } skip3: { /* * uuid_cmp with both nil UUID */ uint8_t nilUUID1[16] = NIL_UUID; char nilUUID1str[40]; uint8_t nilUUID2[16] = NIL_UUID; char nilUUID2str[40]; n_tests++; if (uuid_bin2str(nilUUID1, nilUUID1str, 40) < 0) { fprintf(stderr, "Failure\n"); goto skip4; } n_tests++; if (uuid_bin2str(nilUUID2, nilUUID2str, 40) < 0) { fprintf(stderr, "Failure\n"); goto skip4; } int8_t cmpval1 = uuid_cmp(nilUUID1, nilUUID2); int8_t cmpval2 = uuid_cmp(nilUUID2, nilUUID1); if (cmpval1 == cmpval2 && cmpval1 == 0) n_tests_passed+=2; else n_tests_failed+=2; printf("%s cmp %s = %d <%s>\n", nilUUID1str, nilUUID2str, cmpval1, cmpval1 ? "failed" : "passed" ); printf("%s cmp %s = %d <%s>\n", nilUUID2str, nilUUID1str, cmpval2, cmpval2 ? "failed" : "passed" ); } skip4: { /* * uuid_cmp with both not nil UUID */ uint8_t notNilUUID1[16] = NOT_NIL_UUID; char notNilUUID1str[40]; uint8_t notNilUUID2[16] = NOT_NIL_UUID; char notNilUUID2str[40]; n_tests++; if (uuid_bin2str(notNilUUID1, notNilUUID1str, 40) < 0) { fprintf(stderr, "Failure\n"); goto skip5; } n_tests++; if (uuid_bin2str(notNilUUID2, notNilUUID2str, 40) < 0) { fprintf(stderr, "Failure\n"); goto skip5; } int8_t cmpval1 = uuid_cmp(notNilUUID1, notNilUUID2); int8_t cmpval2 = uuid_cmp(notNilUUID2, notNilUUID1); if (cmpval1 == cmpval2 && cmpval1 == 0) n_tests_passed+=2; else n_tests_failed+=2; printf("%s cmp %s = %d <%s>\n", notNilUUID1str, notNilUUID2str, cmpval1, cmpval1 ? "failed" : "passed" ); printf("%s cmp %s = %d <%s>\n", notNilUUID2str, notNilUUID1str, cmpval2, cmpval2 ? "failed" : "passed" ); } skip5: { /* * uuid_cmp with both not nil UUID */ uint8_t notNilUUID1[16] = NOT_NIL_UUID; char notNilUUID1str[40]; uint8_t notNilUUID2[16] = NOT_NIL_UUID2; char notNilUUID2str[40]; n_tests++; if (uuid_bin2str(notNilUUID1, notNilUUID1str, 40) < 0) { fprintf(stderr, "Failure\n"); goto skip6; } n_tests++; if (uuid_bin2str(notNilUUID2, notNilUUID2str, 40) < 0) { fprintf(stderr, "Failure\n"); goto skip6; } int8_t cmpval1 = uuid_cmp(notNilUUID1, notNilUUID2); int8_t cmpval2 = uuid_cmp(notNilUUID2, notNilUUID1); if (cmpval1 + cmpval2 == 0 && cmpval1 != 0) n_tests_passed+=2; else n_tests_failed+=2; printf("%s cmp %s = %d <%s>\n", notNilUUID1str, notNilUUID2str, cmpval1, cmpval1 ? "passed" : "failed" ); printf("%s cmp %s = %d <%s>\n", notNilUUID2str, notNilUUID1str, cmpval2, cmpval2 ? "passed" : "failed" ); } skip6: { /* * uuid_cmp with one nil UUID */ uint8_t nilUUID[16]; char nilUUIDstr[40] = NIL_UUID_STR; uint8_t notNilUUID[16]; char notNilUUIDstr[40] = NOT_NIL_UUID_STR; n_tests++; if (uuid_str2bin(nilUUIDstr, nilUUID) < 0) { fprintf(stderr, "Failure\n"); goto skip7; } n_tests++; if (uuid_str2bin(notNilUUIDstr, notNilUUID) < 0) { fprintf(stderr, "Failure\n"); goto skip7; } int8_t cmpval1 = uuid_cmp(notNilUUID, nilUUID); int8_t cmpval2 = uuid_cmp(nilUUID, notNilUUID); if (cmpval1 + cmpval2 == 0 && cmpval1 != 0) n_tests_passed+=2; else n_tests_failed+=2; printf("%s cmp %s = %d <%s>\n", notNilUUIDstr, nilUUIDstr, cmpval1, cmpval1 ? "passed" : "failed" ); printf("%s cmp %s = %d <%s>\n", nilUUIDstr, notNilUUIDstr, cmpval2, cmpval2 ? "passed" : "failed" ); } skip7: { /* * uuid_cmp with both nil UUID */ uint8_t nilUUID1[16]; char nilUUID1str[40] = NIL_UUID_STR; uint8_t nilUUID2[16]; char nilUUID2str[40] = NIL_UUID_STR; n_tests++; if (uuid_str2bin(nilUUID1str, nilUUID1) < 0) { fprintf(stderr, "Failure\n"); goto skip8; } n_tests++; if (uuid_str2bin(nilUUID2str, nilUUID2) < 0) { fprintf(stderr, "Failure\n"); goto skip8; } int8_t cmpval1 = uuid_cmp(nilUUID1, nilUUID2); int8_t cmpval2 = uuid_cmp(nilUUID2, nilUUID1); if (cmpval1 == cmpval2 && cmpval1 == 0) n_tests_passed+=2; else n_tests_failed+=2; printf("%s cmp %s = %d <%s>\n", nilUUID1str, nilUUID2str, cmpval1, cmpval1 ? "failed" : "passed" ); printf("%s cmp %s = %d <%s>\n", nilUUID2str, nilUUID1str, cmpval2, cmpval2 ? "failed" : "passed" ); } skip8: { /* * uuid_cmp with both not nil UUID */ uint8_t notNilUUID1[16]; char notNilUUID1str[40] = NOT_NIL_UUID_STR; uint8_t notNilUUID2[16]; char notNilUUID2str[40] = NOT_NIL_UUID_STR; n_tests++; if (uuid_str2bin(notNilUUID1str, notNilUUID1) < 0) { fprintf(stderr, "Failure\n"); goto skip9; } n_tests++; if (uuid_str2bin(notNilUUID2str, notNilUUID2) < 0) { fprintf(stderr, "Failure\n"); goto skip9; } int8_t cmpval1 = uuid_cmp(notNilUUID1, notNilUUID2); int8_t cmpval2 = uuid_cmp(notNilUUID2, notNilUUID1); if (cmpval1 == cmpval2 && cmpval1 == 0) n_tests_passed+=2; else n_tests_failed+=2; printf("%s cmp %s = %d <%s>\n", notNilUUID1str, notNilUUID2str, cmpval1, cmpval1 ? "failed" : "passed" ); printf("%s cmp %s = %d <%s>\n", notNilUUID2str, notNilUUID1str, cmpval2, cmpval2 ? "failed" : "passed" ); } skip9: { /* * uuid_cmp with both not nil UUID */ uint8_t notNilUUID1[16]; char notNilUUID1str[40] = NOT_NIL_UUID_STR; uint8_t notNilUUID2[16]; char notNilUUID2str[40] = NOT_NIL_UUID_STR2; n_tests++; if (uuid_str2bin(notNilUUID1str, notNilUUID1) < 0) { fprintf(stderr, "Failure\n"); goto skip10; } n_tests++; if (uuid_str2bin(notNilUUID2str, notNilUUID2) < 0) { fprintf(stderr, "Failure\n"); goto skip10; } int8_t cmpval1 = uuid_cmp(notNilUUID1, notNilUUID2); int8_t cmpval2 = uuid_cmp(notNilUUID2, notNilUUID1); if (cmpval1 + cmpval2 == 0 && cmpval1 != 0) n_tests_passed+=2; else n_tests_failed+=2; printf("%s cmp %s = %d <%s>\n", notNilUUID1str, notNilUUID2str, cmpval1, cmpval1 ? "passed" : "failed" ); printf("%s cmp %s = %d <%s>\n", notNilUUID2str, notNilUUID1str, cmpval2, cmpval2 ? "passed" : "failed" ); } skip10: summary: { fprintf(stderr, "\n\n********************************************************\n" "Number of tests: %d / passed: %d / failed: %d / skipped: %d\n", n_tests, n_tests_passed, n_tests_failed, n_tests - (n_tests_passed+n_tests_failed)); } return 0; }
static void wpa_config_write_global(FILE *f, struct wpa_config *config) { #ifdef CONFIG_CTRL_IFACE if (config->ctrl_interface) fprintf(f, "ctrl_interface=%s\n", config->ctrl_interface); if (config->ctrl_interface_group) fprintf(f, "ctrl_interface_group=%s\n", config->ctrl_interface_group); #endif /* CONFIG_CTRL_IFACE */ if (config->eapol_version != DEFAULT_EAPOL_VERSION) fprintf(f, "eapol_version=%d\n", config->eapol_version); if (config->ap_scan != DEFAULT_AP_SCAN) fprintf(f, "ap_scan=%d\n", config->ap_scan); if (config->fast_reauth != DEFAULT_FAST_REAUTH) fprintf(f, "fast_reauth=%d\n", config->fast_reauth); if (config->opensc_engine_path) fprintf(f, "opensc_engine_path=%s\n", config->opensc_engine_path); if (config->pkcs11_engine_path) fprintf(f, "pkcs11_engine_path=%s\n", config->pkcs11_engine_path); if (config->pkcs11_module_path) fprintf(f, "pkcs11_module_path=%s\n", config->pkcs11_module_path); if (config->driver_param) fprintf(f, "driver_param=%s\n", config->driver_param); if (config->dot11RSNAConfigPMKLifetime) fprintf(f, "dot11RSNAConfigPMKLifetime=%d\n", config->dot11RSNAConfigPMKLifetime); if (config->dot11RSNAConfigPMKReauthThreshold) fprintf(f, "dot11RSNAConfigPMKReauthThreshold=%d\n", config->dot11RSNAConfigPMKReauthThreshold); if (config->dot11RSNAConfigSATimeout) fprintf(f, "dot11RSNAConfigSATimeout=%d\n", config->dot11RSNAConfigSATimeout); if (config->update_config) fprintf(f, "update_config=%d\n", config->update_config); #ifdef CONFIG_WPS if (!is_nil_uuid(config->uuid)) { char buf[40]; uuid_bin2str(config->uuid, buf, sizeof(buf)); fprintf(f, "uuid=%s\n", buf); } if (config->device_name) fprintf(f, "device_name=%s\n", config->device_name); if (config->manufacturer) fprintf(f, "manufacturer=%s\n", config->manufacturer); if (config->model_name) fprintf(f, "model_name=%s\n", config->model_name); if (config->model_number) fprintf(f, "model_number=%s\n", config->model_number); if (config->serial_number) fprintf(f, "serial_number=%s\n", config->serial_number); { char _buf[WPS_DEV_TYPE_BUFSIZE], *buf; buf = wps_dev_type_bin2str(config->device_type, _buf, sizeof(_buf)); if (os_strcmp(buf, "0-00000000-0") != 0) fprintf(f, "device_type=%s\n", buf); } if (WPA_GET_BE32(config->os_version)) fprintf(f, "os_version=%08x\n", WPA_GET_BE32(config->os_version)); if (config->config_methods) fprintf(f, "config_methods=%s\n", config->config_methods); if (config->wps_cred_processing) fprintf(f, "wps_cred_processing=%d\n", config->wps_cred_processing); #endif /* CONFIG_WPS */ #ifdef CONFIG_P2P if (config->p2p_listen_reg_class) fprintf(f, "p2p_listen_reg_class=%u\n", config->p2p_listen_reg_class); if (config->p2p_listen_channel) fprintf(f, "p2p_listen_channel=%u\n", config->p2p_listen_channel); if (config->p2p_oper_reg_class) fprintf(f, "p2p_oper_reg_class=%u\n", config->p2p_oper_reg_class); if (config->p2p_oper_channel) fprintf(f, "p2p_oper_channel=%u\n", config->p2p_oper_channel); if (config->p2p_go_intent != DEFAULT_P2P_GO_INTENT) fprintf(f, "p2p_go_intent=%u\n", config->p2p_go_intent); if (config->p2p_ssid_postfix) fprintf(f, "p2p_ssid_postfix=%s\n", config->p2p_ssid_postfix); if (config->persistent_reconnect) fprintf(f, "persistent_reconnect=%u\n", config->persistent_reconnect); if (config->p2p_intra_bss != DEFAULT_P2P_INTRA_BSS) fprintf(f, "p2p_intra_bss=%u\n", config->p2p_intra_bss); if (config->p2p_group_idle) fprintf(f, "p2p_group_idle=%u\n", config->p2p_group_idle); #endif /* CONFIG_P2P */ if (config->country[0] && config->country[1]) { fprintf(f, "country=%c%c\n", config->country[0], config->country[1]); } #ifdef CONFIG_EAP_SIM_AKA if (config->software_sim) fprintf(f, "software_sim=%d\n", config->software_sim); #endif if (config->bss_max_count != DEFAULT_BSS_MAX_COUNT) fprintf(f, "bss_max_count=%u\n", config->bss_max_count); if (config->bss_expiration_age != DEFAULT_BSS_EXPIRATION_AGE) fprintf(f, "bss_expiration_age=%u\n", config->bss_expiration_age); if (config->bss_expiration_scan_count != DEFAULT_BSS_EXPIRATION_SCAN_COUNT) fprintf(f, "bss_expiration_scan_count=%u\n", config->bss_expiration_scan_count); if (config->filter_ssids) fprintf(f, "filter_ssids=%d\n", config->filter_ssids); if (config->max_num_sta != DEFAULT_MAX_NUM_STA) fprintf(f, "max_num_sta=%u\n", config->max_num_sta); if (config->disassoc_low_ack) fprintf(f, "disassoc_low_ack=%u\n", config->disassoc_low_ack); #ifdef CONFIG_INTERWORKING if (config->home_realm) fprintf(f, "home_realm=%s\n", config->home_realm); if (config->home_username) fprintf(f, "home_username=%s\n", config->home_username); if (config->home_password) fprintf(f, "home_password=%s\n", config->home_password); if (config->home_ca_cert) fprintf(f, "home_ca_cert=%s\n", config->home_ca_cert); if (config->home_imsi) fprintf(f, "home_imsi=%s\n", config->home_imsi); if (config->home_milenage) fprintf(f, "home_milenage=%s\n", config->home_milenage); if (config->interworking) fprintf(f, "interworking=%u\n", config->interworking); if (!is_zero_ether_addr(config->hessid)) fprintf(f, "hessid=" MACSTR "\n", MAC2STR(config->hessid)); if (config->access_network_type != DEFAULT_ACCESS_NETWORK_TYPE) fprintf(f, "access_network_type=%d\n", config->access_network_type); #endif /* CONFIG_INTERWORKING */ }
static void wpa_config_write_global(FILE *f, struct wpa_config *config) { #ifdef CONFIG_CTRL_IFACE if (config->ctrl_interface) fprintf(f, "ctrl_interface=%s\n", config->ctrl_interface); if (config->ctrl_interface_group) fprintf(f, "ctrl_interface_group=%s\n", config->ctrl_interface_group); #endif /* CONFIG_CTRL_IFACE */ if (config->eapol_version != DEFAULT_EAPOL_VERSION) fprintf(f, "eapol_version=%d\n", config->eapol_version); #ifndef ANDROID if (config->ap_scan != DEFAULT_AP_SCAN) fprintf(f, "ap_scan=%d\n", config->ap_scan); #endif if (config->fast_reauth != DEFAULT_FAST_REAUTH) fprintf(f, "fast_reauth=%d\n", config->fast_reauth); #ifdef EAP_TLS_OPENSSL if (config->opensc_engine_path) fprintf(f, "opensc_engine_path=%s\n", config->opensc_engine_path); if (config->pkcs11_engine_path) fprintf(f, "pkcs11_engine_path=%s\n", config->pkcs11_engine_path); if (config->pkcs11_module_path) fprintf(f, "pkcs11_module_path=%s\n", config->pkcs11_module_path); #endif /* EAP_TLS_OPENSSL */ if (config->driver_param) fprintf(f, "driver_param=%s\n", config->driver_param); if (config->dot11RSNAConfigPMKLifetime) fprintf(f, "dot11RSNAConfigPMKLifetime=%d\n", config->dot11RSNAConfigPMKLifetime); if (config->dot11RSNAConfigPMKReauthThreshold) fprintf(f, "dot11RSNAConfigPMKReauthThreshold=%d\n", config->dot11RSNAConfigPMKReauthThreshold); if (config->dot11RSNAConfigSATimeout) fprintf(f, "dot11RSNAConfigSATimeout=%d\n", config->dot11RSNAConfigSATimeout); if (config->update_config) fprintf(f, "update_config=%d\n", config->update_config); #ifdef CONFIG_WPS if (!is_nil_uuid(config->uuid)) { char buf[40]; uuid_bin2str(config->uuid, buf, sizeof(buf)); fprintf(f, "uuid=%s\n", buf); } if (config->device_name) fprintf(f, "device_name=%s\n", config->device_name); if (config->manufacturer) fprintf(f, "manufacturer=%s\n", config->manufacturer); if (config->model_name) fprintf(f, "model_name=%s\n", config->model_name); if (config->model_number) fprintf(f, "model_number=%s\n", config->model_number); if (config->serial_number) fprintf(f, "serial_number=%s\n", config->serial_number); if (config->device_type) fprintf(f, "device_type=%s\n", config->device_type); if (WPA_GET_BE32(config->os_version)) fprintf(f, "os_version=%08x\n", WPA_GET_BE32(config->os_version)); if (config->wps_cred_processing) fprintf(f, "wps_cred_processing=%d\n", config->wps_cred_processing); #endif /* CONFIG_WPS */ if (config->country[0] && config->country[1]) { fprintf(f, "country=%c%c\n", config->country[0], config->country[1]); } }
/* event_send_tx_ready -- actually write event message * * Prequisite: subscription socket descriptor has become ready to * write (because connection to subscriber has been made). * * It is also possible that we are called because the connect has failed; * it is possible to test for this, or we can just go ahead and then * the write will fail. */ static void event_send_tx_ready(int sock, void *eloop_ctx, void *sock_ctx) { struct wps_event_ *e = sock_ctx; struct subscription *s = e->s; struct wpabuf *buf; char *b; assert(e == s->current_event); assert(e->sd == sock); buf = wpabuf_alloc(1000 + wpabuf_len(e->data)); if (buf == NULL) { event_retry(e, 0); goto bad; } wpabuf_printf(buf, "NOTIFY %s HTTP/1.1\r\n", e->addr->path); wpabuf_put_str(buf, "SERVER: Unspecified, UPnP/1.0, Unspecified\r\n"); wpabuf_printf(buf, "HOST: %s\r\n", e->addr->domain_and_port); wpabuf_put_str(buf, "CONTENT-TYPE: text/xml; charset=\"utf-8\"\r\n" "NT: upnp:event\r\n" "NTS: upnp:propchange\r\n"); wpabuf_put_str(buf, "SID: uuid:"); b = wpabuf_put(buf, 0); uuid_bin2str(s->uuid, b, 80); wpabuf_put(buf, os_strlen(b)); wpabuf_put_str(buf, "\r\n"); wpabuf_printf(buf, "SEQ: %u\r\n", e->subscriber_sequence); wpabuf_printf(buf, "CONTENT-LENGTH: %d\r\n", (int) wpabuf_len(e->data)); wpabuf_put_str(buf, "\r\n"); /* terminating empty line */ wpabuf_put_buf(buf, e->data); /* Since the message size is pretty small, we should be * able to get the operating system to buffer what we give it * and not have to come back again later to write more... */ #if 0 /* we could: Turn blocking back on? */ fcntl(e->sd, F_SETFL, 0); #endif wpa_printf(MSG_DEBUG, "WPS UPnP: Sending event to %s", e->addr->domain_and_port); if (send_wpabuf(e->sd, buf) < 0) { event_retry(e, 1); goto bad; } wpabuf_free(buf); buf = NULL; if (e->sd_registered) { e->sd_registered = 0; eloop_unregister_sock(e->sd, EVENT_TYPE_WRITE); } /* Set up to read the reply */ e->hread = httpread_create(e->sd, event_got_response_handler, e /* cookie */, 0 /* no data expected */, EVENT_TIMEOUT_SEC); if (e->hread == NULL) { wpa_printf(MSG_ERROR, "WPS UPnP: httpread_create failed"); event_retry(e, 0); goto bad; } return; bad: /* Schedule sending more if there is more to send */ if (s->event_queue) event_send_all_later(s->sm); wpabuf_free(buf); }
static void wpa_config_write_global(FILE *f, struct wpa_config *config) { #ifdef CONFIG_CTRL_IFACE if (config->ctrl_interface) fprintf(f, "ctrl_interface=%s\n", config->ctrl_interface); if (config->ctrl_interface_group) fprintf(f, "ctrl_interface_group=%s\n", config->ctrl_interface_group); #endif /* CONFIG_CTRL_IFACE */ if (config->eapol_version != DEFAULT_EAPOL_VERSION) fprintf(f, "eapol_version=%d\n", config->eapol_version); if (config->ap_scan != DEFAULT_AP_SCAN) fprintf(f, "ap_scan=%d\n", config->ap_scan); if (config->fast_reauth != DEFAULT_FAST_REAUTH) fprintf(f, "fast_reauth=%d\n", config->fast_reauth); if (config->opensc_engine_path) fprintf(f, "opensc_engine_path=%s\n", config->opensc_engine_path); if (config->pkcs11_engine_path) fprintf(f, "pkcs11_engine_path=%s\n", config->pkcs11_engine_path); if (config->pkcs11_module_path) fprintf(f, "pkcs11_module_path=%s\n", config->pkcs11_module_path); if (config->driver_param) fprintf(f, "driver_param=%s\n", config->driver_param); if (config->dot11RSNAConfigPMKLifetime) fprintf(f, "dot11RSNAConfigPMKLifetime=%d\n", config->dot11RSNAConfigPMKLifetime); if (config->dot11RSNAConfigPMKReauthThreshold) fprintf(f, "dot11RSNAConfigPMKReauthThreshold=%d\n", config->dot11RSNAConfigPMKReauthThreshold); if (config->dot11RSNAConfigSATimeout) fprintf(f, "dot11RSNAConfigSATimeout=%d\n", config->dot11RSNAConfigSATimeout); if (config->update_config) fprintf(f, "update_config=%d\n", config->update_config); #ifdef CONFIG_WPS if (!is_nil_uuid(config->uuid)) { char buf[40]; uuid_bin2str(config->uuid, buf, sizeof(buf)); fprintf(f, "uuid=%s\n", buf); } if (config->device_name) fprintf(f, "device_name=%s\n", config->device_name); if (config->manufacturer) fprintf(f, "manufacturer=%s\n", config->manufacturer); if (config->model_name) fprintf(f, "model_name=%s\n", config->model_name); if (config->model_number) fprintf(f, "model_number=%s\n", config->model_number); if (config->serial_number) fprintf(f, "serial_number=%s\n", config->serial_number); if (config->device_type) fprintf(f, "device_type=%s\n", config->device_type); if (WPA_GET_BE32(config->os_version)) fprintf(f, "os_version=%08x\n", WPA_GET_BE32(config->os_version)); if (config->config_methods) fprintf(f, "config_methods=%s\n", config->config_methods); if (config->wps_cred_processing) fprintf(f, "wps_cred_processing=%d\n", config->wps_cred_processing); #endif /* CONFIG_WPS */ #ifdef CONFIG_P2P if (config->p2p_listen_reg_class) fprintf(f, "p2p_listen_reg_class=%u\n", config->p2p_listen_reg_class); if (config->p2p_listen_channel) fprintf(f, "p2p_listen_channel=%u\n", config->p2p_listen_channel); if (config->p2p_oper_reg_class) fprintf(f, "p2p_oper_reg_class=%u\n", config->p2p_oper_reg_class); if (config->p2p_oper_channel) fprintf(f, "p2p_oper_channel=%u\n", config->p2p_oper_channel); if (config->p2p_go_intent != DEFAULT_P2P_GO_INTENT) fprintf(f, "p2p_go_intent=%u\n", config->p2p_go_intent); if (config->p2p_ssid_postfix) fprintf(f, "p2p_ssid_postfix=%s\n", config->p2p_ssid_postfix); if (config->persistent_reconnect) fprintf(f, "persistent_reconnect=%u\n", config->persistent_reconnect); if (config->p2p_intra_bss != DEFAULT_P2P_INTRA_BSS) fprintf(f, "p2p_intra_bss=%u\n", config->p2p_intra_bss); #endif /* CONFIG_P2P */ if (config->country[0] && config->country[1]) { fprintf(f, "country=%c%c\n", config->country[0], config->country[1]); } if (config->bss_max_count != DEFAULT_BSS_MAX_COUNT) fprintf(f, "bss_max_count=%u\n", config->bss_max_count); if (config->filter_ssids) fprintf(f, "filter_ssids=%d\n", config->filter_ssids); }