|
@@ -1839,1384 +1839,1330 @@ static int hostapd_config_fill(struct hostapd_config *conf,
|
|
|
{
|
|
|
int errors = 0;
|
|
|
|
|
|
- {
|
|
|
- if (os_strcmp(buf, "interface") == 0) {
|
|
|
- os_strlcpy(conf->bss[0]->iface, pos,
|
|
|
- sizeof(conf->bss[0]->iface));
|
|
|
- } else if (os_strcmp(buf, "bridge") == 0) {
|
|
|
- os_strlcpy(bss->bridge, pos, sizeof(bss->bridge));
|
|
|
- } else if (os_strcmp(buf, "vlan_bridge") == 0) {
|
|
|
- os_strlcpy(bss->vlan_bridge, pos,
|
|
|
- sizeof(bss->vlan_bridge));
|
|
|
- } else if (os_strcmp(buf, "wds_bridge") == 0) {
|
|
|
- os_strlcpy(bss->wds_bridge, pos,
|
|
|
- sizeof(bss->wds_bridge));
|
|
|
- } else if (os_strcmp(buf, "driver") == 0) {
|
|
|
- int j;
|
|
|
- /* clear to get error below if setting is invalid */
|
|
|
- conf->driver = NULL;
|
|
|
- for (j = 0; wpa_drivers[j]; j++) {
|
|
|
- if (os_strcmp(pos, wpa_drivers[j]->name) == 0)
|
|
|
- {
|
|
|
- conf->driver = wpa_drivers[j];
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if (conf->driver == NULL) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid/"
|
|
|
- "unknown driver '%s'", line, pos);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "debug") == 0) {
|
|
|
- wpa_printf(MSG_DEBUG, "Line %d: DEPRECATED: 'debug' "
|
|
|
- "configuration variable is not used "
|
|
|
- "anymore", line);
|
|
|
- } else if (os_strcmp(buf, "logger_syslog_level") == 0) {
|
|
|
- bss->logger_syslog_level = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "logger_stdout_level") == 0) {
|
|
|
- bss->logger_stdout_level = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "logger_syslog") == 0) {
|
|
|
- bss->logger_syslog = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "logger_stdout") == 0) {
|
|
|
- bss->logger_stdout = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "dump_file") == 0) {
|
|
|
- wpa_printf(MSG_INFO, "Line %d: DEPRECATED: 'dump_file' configuration variable is not used anymore",
|
|
|
- line);
|
|
|
- } else if (os_strcmp(buf, "ssid") == 0) {
|
|
|
- bss->ssid.ssid_len = os_strlen(pos);
|
|
|
- if (bss->ssid.ssid_len > HOSTAPD_MAX_SSID_LEN ||
|
|
|
- bss->ssid.ssid_len < 1) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid SSID "
|
|
|
- "'%s'", line, pos);
|
|
|
- errors++;
|
|
|
- } else {
|
|
|
- os_memcpy(bss->ssid.ssid, pos,
|
|
|
- bss->ssid.ssid_len);
|
|
|
- bss->ssid.ssid_set = 1;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "ssid2") == 0) {
|
|
|
- size_t slen;
|
|
|
- char *str = wpa_config_parse_string(pos, &slen);
|
|
|
- if (str == NULL || slen < 1 ||
|
|
|
- slen > HOSTAPD_MAX_SSID_LEN) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid SSID "
|
|
|
- "'%s'", line, pos);
|
|
|
- errors++;
|
|
|
- } else {
|
|
|
- os_memcpy(bss->ssid.ssid, str, slen);
|
|
|
- bss->ssid.ssid_len = slen;
|
|
|
- bss->ssid.ssid_set = 1;
|
|
|
- }
|
|
|
- os_free(str);
|
|
|
- } else if (os_strcmp(buf, "utf8_ssid") == 0) {
|
|
|
- bss->ssid.utf8_ssid = atoi(pos) > 0;
|
|
|
- } else if (os_strcmp(buf, "macaddr_acl") == 0) {
|
|
|
- bss->macaddr_acl = atoi(pos);
|
|
|
- if (bss->macaddr_acl != ACCEPT_UNLESS_DENIED &&
|
|
|
- bss->macaddr_acl != DENY_UNLESS_ACCEPTED &&
|
|
|
- bss->macaddr_acl != USE_EXTERNAL_RADIUS_AUTH) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: unknown "
|
|
|
- "macaddr_acl %d",
|
|
|
- line, bss->macaddr_acl);
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "accept_mac_file") == 0) {
|
|
|
- if (hostapd_config_read_maclist(pos, &bss->accept_mac,
|
|
|
- &bss->num_accept_mac))
|
|
|
- {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: Failed to "
|
|
|
- "read accept_mac_file '%s'",
|
|
|
- line, pos);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "deny_mac_file") == 0) {
|
|
|
- if (hostapd_config_read_maclist(pos, &bss->deny_mac,
|
|
|
- &bss->num_deny_mac)) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: Failed to "
|
|
|
- "read deny_mac_file '%s'",
|
|
|
- line, pos);
|
|
|
- errors++;
|
|
|
+ if (os_strcmp(buf, "interface") == 0) {
|
|
|
+ os_strlcpy(conf->bss[0]->iface, pos,
|
|
|
+ sizeof(conf->bss[0]->iface));
|
|
|
+ } else if (os_strcmp(buf, "bridge") == 0) {
|
|
|
+ os_strlcpy(bss->bridge, pos, sizeof(bss->bridge));
|
|
|
+ } else if (os_strcmp(buf, "vlan_bridge") == 0) {
|
|
|
+ os_strlcpy(bss->vlan_bridge, pos, sizeof(bss->vlan_bridge));
|
|
|
+ } else if (os_strcmp(buf, "wds_bridge") == 0) {
|
|
|
+ os_strlcpy(bss->wds_bridge, pos, sizeof(bss->wds_bridge));
|
|
|
+ } else if (os_strcmp(buf, "driver") == 0) {
|
|
|
+ int j;
|
|
|
+ /* clear to get error below if setting is invalid */
|
|
|
+ conf->driver = NULL;
|
|
|
+ for (j = 0; wpa_drivers[j]; j++) {
|
|
|
+ if (os_strcmp(pos, wpa_drivers[j]->name) == 0) {
|
|
|
+ conf->driver = wpa_drivers[j];
|
|
|
+ break;
|
|
|
}
|
|
|
- } else if (os_strcmp(buf, "wds_sta") == 0) {
|
|
|
- bss->wds_sta = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "start_disabled") == 0) {
|
|
|
- bss->start_disabled = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "ap_isolate") == 0) {
|
|
|
- bss->isolate = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "ap_max_inactivity") == 0) {
|
|
|
- bss->ap_max_inactivity = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "skip_inactivity_poll") == 0) {
|
|
|
- bss->skip_inactivity_poll = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "country_code") == 0) {
|
|
|
- os_memcpy(conf->country, pos, 2);
|
|
|
- /* FIX: make this configurable */
|
|
|
- conf->country[2] = ' ';
|
|
|
- } else if (os_strcmp(buf, "ieee80211d") == 0) {
|
|
|
- conf->ieee80211d = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "ieee80211h") == 0) {
|
|
|
- conf->ieee80211h = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "ieee8021x") == 0) {
|
|
|
- bss->ieee802_1x = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "eapol_version") == 0) {
|
|
|
- bss->eapol_version = atoi(pos);
|
|
|
- if (bss->eapol_version < 1 ||
|
|
|
- bss->eapol_version > 2) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid EAPOL "
|
|
|
- "version (%d): '%s'.",
|
|
|
- line, bss->eapol_version, pos);
|
|
|
- errors++;
|
|
|
- } else
|
|
|
- wpa_printf(MSG_DEBUG, "eapol_version=%d",
|
|
|
- bss->eapol_version);
|
|
|
+ }
|
|
|
+ if (conf->driver == NULL) {
|
|
|
+ wpa_printf(MSG_ERROR,
|
|
|
+ "Line %d: invalid/unknown driver '%s'",
|
|
|
+ line, pos);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "debug") == 0) {
|
|
|
+ wpa_printf(MSG_DEBUG, "Line %d: DEPRECATED: 'debug' configuration variable is not used anymore",
|
|
|
+ line);
|
|
|
+ } else if (os_strcmp(buf, "logger_syslog_level") == 0) {
|
|
|
+ bss->logger_syslog_level = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "logger_stdout_level") == 0) {
|
|
|
+ bss->logger_stdout_level = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "logger_syslog") == 0) {
|
|
|
+ bss->logger_syslog = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "logger_stdout") == 0) {
|
|
|
+ bss->logger_stdout = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "dump_file") == 0) {
|
|
|
+ wpa_printf(MSG_INFO, "Line %d: DEPRECATED: 'dump_file' configuration variable is not used anymore",
|
|
|
+ line);
|
|
|
+ } else if (os_strcmp(buf, "ssid") == 0) {
|
|
|
+ bss->ssid.ssid_len = os_strlen(pos);
|
|
|
+ if (bss->ssid.ssid_len > HOSTAPD_MAX_SSID_LEN ||
|
|
|
+ bss->ssid.ssid_len < 1) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: invalid SSID '%s'",
|
|
|
+ line, pos);
|
|
|
+ errors++;
|
|
|
+ } else {
|
|
|
+ os_memcpy(bss->ssid.ssid, pos, bss->ssid.ssid_len);
|
|
|
+ bss->ssid.ssid_set = 1;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "ssid2") == 0) {
|
|
|
+ size_t slen;
|
|
|
+ char *str = wpa_config_parse_string(pos, &slen);
|
|
|
+ if (str == NULL || slen < 1 || slen > HOSTAPD_MAX_SSID_LEN) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: invalid SSID '%s'",
|
|
|
+ line, pos);
|
|
|
+ errors++;
|
|
|
+ } else {
|
|
|
+ os_memcpy(bss->ssid.ssid, str, slen);
|
|
|
+ bss->ssid.ssid_len = slen;
|
|
|
+ bss->ssid.ssid_set = 1;
|
|
|
+ }
|
|
|
+ os_free(str);
|
|
|
+ } else if (os_strcmp(buf, "utf8_ssid") == 0) {
|
|
|
+ bss->ssid.utf8_ssid = atoi(pos) > 0;
|
|
|
+ } else if (os_strcmp(buf, "macaddr_acl") == 0) {
|
|
|
+ bss->macaddr_acl = atoi(pos);
|
|
|
+ if (bss->macaddr_acl != ACCEPT_UNLESS_DENIED &&
|
|
|
+ bss->macaddr_acl != DENY_UNLESS_ACCEPTED &&
|
|
|
+ bss->macaddr_acl != USE_EXTERNAL_RADIUS_AUTH) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: unknown macaddr_acl %d",
|
|
|
+ line, bss->macaddr_acl);
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "accept_mac_file") == 0) {
|
|
|
+ if (hostapd_config_read_maclist(pos, &bss->accept_mac,
|
|
|
+ &bss->num_accept_mac)) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: Failed to read accept_mac_file '%s'",
|
|
|
+ line, pos);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "deny_mac_file") == 0) {
|
|
|
+ if (hostapd_config_read_maclist(pos, &bss->deny_mac,
|
|
|
+ &bss->num_deny_mac)) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: Failed to read deny_mac_file '%s'",
|
|
|
+ line, pos);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "wds_sta") == 0) {
|
|
|
+ bss->wds_sta = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "start_disabled") == 0) {
|
|
|
+ bss->start_disabled = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "ap_isolate") == 0) {
|
|
|
+ bss->isolate = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "ap_max_inactivity") == 0) {
|
|
|
+ bss->ap_max_inactivity = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "skip_inactivity_poll") == 0) {
|
|
|
+ bss->skip_inactivity_poll = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "country_code") == 0) {
|
|
|
+ os_memcpy(conf->country, pos, 2);
|
|
|
+ /* FIX: make this configurable */
|
|
|
+ conf->country[2] = ' ';
|
|
|
+ } else if (os_strcmp(buf, "ieee80211d") == 0) {
|
|
|
+ conf->ieee80211d = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "ieee80211h") == 0) {
|
|
|
+ conf->ieee80211h = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "ieee8021x") == 0) {
|
|
|
+ bss->ieee802_1x = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "eapol_version") == 0) {
|
|
|
+ bss->eapol_version = atoi(pos);
|
|
|
+ if (bss->eapol_version < 1 || bss->eapol_version > 2) {
|
|
|
+ wpa_printf(MSG_ERROR,
|
|
|
+ "Line %d: invalid EAPOL version (%d): '%s'.",
|
|
|
+ line, bss->eapol_version, pos);
|
|
|
+ errors++;
|
|
|
+ } else
|
|
|
+ wpa_printf(MSG_DEBUG, "eapol_version=%d",
|
|
|
+ bss->eapol_version);
|
|
|
#ifdef EAP_SERVER
|
|
|
- } else if (os_strcmp(buf, "eap_authenticator") == 0) {
|
|
|
- bss->eap_server = atoi(pos);
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: obsolete "
|
|
|
- "eap_authenticator used; this has been "
|
|
|
- "renamed to eap_server", line);
|
|
|
- } else if (os_strcmp(buf, "eap_server") == 0) {
|
|
|
- bss->eap_server = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "eap_user_file") == 0) {
|
|
|
- if (hostapd_config_read_eap_user(pos, bss))
|
|
|
- errors++;
|
|
|
- } else if (os_strcmp(buf, "ca_cert") == 0) {
|
|
|
- os_free(bss->ca_cert);
|
|
|
- bss->ca_cert = os_strdup(pos);
|
|
|
- } else if (os_strcmp(buf, "server_cert") == 0) {
|
|
|
- os_free(bss->server_cert);
|
|
|
- bss->server_cert = os_strdup(pos);
|
|
|
- } else if (os_strcmp(buf, "private_key") == 0) {
|
|
|
- os_free(bss->private_key);
|
|
|
- bss->private_key = os_strdup(pos);
|
|
|
- } else if (os_strcmp(buf, "private_key_passwd") == 0) {
|
|
|
- os_free(bss->private_key_passwd);
|
|
|
- bss->private_key_passwd = os_strdup(pos);
|
|
|
- } else if (os_strcmp(buf, "check_crl") == 0) {
|
|
|
- bss->check_crl = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "ocsp_stapling_response") == 0) {
|
|
|
- os_free(bss->ocsp_stapling_response);
|
|
|
- bss->ocsp_stapling_response = os_strdup(pos);
|
|
|
- } else if (os_strcmp(buf, "dh_file") == 0) {
|
|
|
- os_free(bss->dh_file);
|
|
|
- bss->dh_file = os_strdup(pos);
|
|
|
- } else if (os_strcmp(buf, "fragment_size") == 0) {
|
|
|
- bss->fragment_size = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "eap_authenticator") == 0) {
|
|
|
+ bss->eap_server = atoi(pos);
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: obsolete eap_authenticator used; this has been renamed to eap_server", line);
|
|
|
+ } else if (os_strcmp(buf, "eap_server") == 0) {
|
|
|
+ bss->eap_server = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "eap_user_file") == 0) {
|
|
|
+ if (hostapd_config_read_eap_user(pos, bss))
|
|
|
+ errors++;
|
|
|
+ } else if (os_strcmp(buf, "ca_cert") == 0) {
|
|
|
+ os_free(bss->ca_cert);
|
|
|
+ bss->ca_cert = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "server_cert") == 0) {
|
|
|
+ os_free(bss->server_cert);
|
|
|
+ bss->server_cert = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "private_key") == 0) {
|
|
|
+ os_free(bss->private_key);
|
|
|
+ bss->private_key = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "private_key_passwd") == 0) {
|
|
|
+ os_free(bss->private_key_passwd);
|
|
|
+ bss->private_key_passwd = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "check_crl") == 0) {
|
|
|
+ bss->check_crl = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "ocsp_stapling_response") == 0) {
|
|
|
+ os_free(bss->ocsp_stapling_response);
|
|
|
+ bss->ocsp_stapling_response = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "dh_file") == 0) {
|
|
|
+ os_free(bss->dh_file);
|
|
|
+ bss->dh_file = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "fragment_size") == 0) {
|
|
|
+ bss->fragment_size = atoi(pos);
|
|
|
#ifdef EAP_SERVER_FAST
|
|
|
- } else if (os_strcmp(buf, "pac_opaque_encr_key") == 0) {
|
|
|
- os_free(bss->pac_opaque_encr_key);
|
|
|
- bss->pac_opaque_encr_key = os_malloc(16);
|
|
|
- if (bss->pac_opaque_encr_key == NULL) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: No memory for "
|
|
|
- "pac_opaque_encr_key", line);
|
|
|
- errors++;
|
|
|
- } else if (hexstr2bin(pos, bss->pac_opaque_encr_key,
|
|
|
- 16)) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: Invalid "
|
|
|
- "pac_opaque_encr_key", line);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "eap_fast_a_id") == 0) {
|
|
|
- size_t idlen = os_strlen(pos);
|
|
|
- if (idlen & 1) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: Invalid "
|
|
|
- "eap_fast_a_id", line);
|
|
|
+ } else if (os_strcmp(buf, "pac_opaque_encr_key") == 0) {
|
|
|
+ os_free(bss->pac_opaque_encr_key);
|
|
|
+ bss->pac_opaque_encr_key = os_malloc(16);
|
|
|
+ if (bss->pac_opaque_encr_key == NULL) {
|
|
|
+ wpa_printf(MSG_ERROR,
|
|
|
+ "Line %d: No memory for pac_opaque_encr_key",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ } else if (hexstr2bin(pos, bss->pac_opaque_encr_key, 16)) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: Invalid pac_opaque_encr_key",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "eap_fast_a_id") == 0) {
|
|
|
+ size_t idlen = os_strlen(pos);
|
|
|
+ if (idlen & 1) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: Invalid eap_fast_a_id",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ } else {
|
|
|
+ os_free(bss->eap_fast_a_id);
|
|
|
+ bss->eap_fast_a_id = os_malloc(idlen / 2);
|
|
|
+ if (bss->eap_fast_a_id == NULL ||
|
|
|
+ hexstr2bin(pos, bss->eap_fast_a_id, idlen / 2)) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: Failed to parse eap_fast_a_id",
|
|
|
+ line);
|
|
|
errors++;
|
|
|
- } else {
|
|
|
- os_free(bss->eap_fast_a_id);
|
|
|
- bss->eap_fast_a_id = os_malloc(idlen / 2);
|
|
|
- if (bss->eap_fast_a_id == NULL ||
|
|
|
- hexstr2bin(pos, bss->eap_fast_a_id,
|
|
|
- idlen / 2)) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: "
|
|
|
- "Failed to parse "
|
|
|
- "eap_fast_a_id", line);
|
|
|
- errors++;
|
|
|
- } else
|
|
|
- bss->eap_fast_a_id_len = idlen / 2;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "eap_fast_a_id_info") == 0) {
|
|
|
- os_free(bss->eap_fast_a_id_info);
|
|
|
- bss->eap_fast_a_id_info = os_strdup(pos);
|
|
|
- } else if (os_strcmp(buf, "eap_fast_prov") == 0) {
|
|
|
- bss->eap_fast_prov = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "pac_key_lifetime") == 0) {
|
|
|
- bss->pac_key_lifetime = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "pac_key_refresh_time") == 0) {
|
|
|
- bss->pac_key_refresh_time = atoi(pos);
|
|
|
+ } else
|
|
|
+ bss->eap_fast_a_id_len = idlen / 2;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "eap_fast_a_id_info") == 0) {
|
|
|
+ os_free(bss->eap_fast_a_id_info);
|
|
|
+ bss->eap_fast_a_id_info = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "eap_fast_prov") == 0) {
|
|
|
+ bss->eap_fast_prov = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "pac_key_lifetime") == 0) {
|
|
|
+ bss->pac_key_lifetime = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "pac_key_refresh_time") == 0) {
|
|
|
+ bss->pac_key_refresh_time = atoi(pos);
|
|
|
#endif /* EAP_SERVER_FAST */
|
|
|
#ifdef EAP_SERVER_SIM
|
|
|
- } else if (os_strcmp(buf, "eap_sim_db") == 0) {
|
|
|
- os_free(bss->eap_sim_db);
|
|
|
- bss->eap_sim_db = os_strdup(pos);
|
|
|
- } else if (os_strcmp(buf, "eap_sim_aka_result_ind") == 0) {
|
|
|
- bss->eap_sim_aka_result_ind = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "eap_sim_db") == 0) {
|
|
|
+ os_free(bss->eap_sim_db);
|
|
|
+ bss->eap_sim_db = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "eap_sim_aka_result_ind") == 0) {
|
|
|
+ bss->eap_sim_aka_result_ind = atoi(pos);
|
|
|
#endif /* EAP_SERVER_SIM */
|
|
|
#ifdef EAP_SERVER_TNC
|
|
|
- } else if (os_strcmp(buf, "tnc") == 0) {
|
|
|
- bss->tnc = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "tnc") == 0) {
|
|
|
+ bss->tnc = atoi(pos);
|
|
|
#endif /* EAP_SERVER_TNC */
|
|
|
#ifdef EAP_SERVER_PWD
|
|
|
- } else if (os_strcmp(buf, "pwd_group") == 0) {
|
|
|
- bss->pwd_group = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "pwd_group") == 0) {
|
|
|
+ bss->pwd_group = atoi(pos);
|
|
|
#endif /* EAP_SERVER_PWD */
|
|
|
#endif /* EAP_SERVER */
|
|
|
- } else if (os_strcmp(buf, "eap_message") == 0) {
|
|
|
- char *term;
|
|
|
- bss->eap_req_id_text = os_strdup(pos);
|
|
|
- if (bss->eap_req_id_text == NULL) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: Failed to "
|
|
|
- "allocate memory for "
|
|
|
- "eap_req_id_text", line);
|
|
|
- errors++;
|
|
|
- return errors;
|
|
|
- }
|
|
|
- bss->eap_req_id_text_len =
|
|
|
- os_strlen(bss->eap_req_id_text);
|
|
|
- term = os_strstr(bss->eap_req_id_text, "\\0");
|
|
|
- if (term) {
|
|
|
- *term++ = '\0';
|
|
|
- os_memmove(term, term + 1,
|
|
|
- bss->eap_req_id_text_len -
|
|
|
- (term - bss->eap_req_id_text) - 1);
|
|
|
- bss->eap_req_id_text_len--;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "wep_key_len_broadcast") == 0) {
|
|
|
- bss->default_wep_key_len = atoi(pos);
|
|
|
- if (bss->default_wep_key_len > 13) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid WEP "
|
|
|
- "key len %lu (= %lu bits)", line,
|
|
|
- (unsigned long)
|
|
|
- bss->default_wep_key_len,
|
|
|
- (unsigned long)
|
|
|
- bss->default_wep_key_len * 8);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "wep_key_len_unicast") == 0) {
|
|
|
- bss->individual_wep_key_len = atoi(pos);
|
|
|
- if (bss->individual_wep_key_len < 0 ||
|
|
|
- bss->individual_wep_key_len > 13) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid WEP "
|
|
|
- "key len %d (= %d bits)", line,
|
|
|
- bss->individual_wep_key_len,
|
|
|
- bss->individual_wep_key_len * 8);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "wep_rekey_period") == 0) {
|
|
|
- bss->wep_rekeying_period = atoi(pos);
|
|
|
- if (bss->wep_rekeying_period < 0) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid "
|
|
|
- "period %d",
|
|
|
- line, bss->wep_rekeying_period);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "eap_reauth_period") == 0) {
|
|
|
- bss->eap_reauth_period = atoi(pos);
|
|
|
- if (bss->eap_reauth_period < 0) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid "
|
|
|
- "period %d",
|
|
|
- line, bss->eap_reauth_period);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "eapol_key_index_workaround") == 0) {
|
|
|
- bss->eapol_key_index_workaround = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "eap_message") == 0) {
|
|
|
+ char *term;
|
|
|
+ bss->eap_req_id_text = os_strdup(pos);
|
|
|
+ if (bss->eap_req_id_text == NULL) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: Failed to allocate memory for eap_req_id_text",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ return errors;
|
|
|
+ }
|
|
|
+ bss->eap_req_id_text_len = os_strlen(bss->eap_req_id_text);
|
|
|
+ term = os_strstr(bss->eap_req_id_text, "\\0");
|
|
|
+ if (term) {
|
|
|
+ *term++ = '\0';
|
|
|
+ os_memmove(term, term + 1,
|
|
|
+ bss->eap_req_id_text_len -
|
|
|
+ (term - bss->eap_req_id_text) - 1);
|
|
|
+ bss->eap_req_id_text_len--;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "wep_key_len_broadcast") == 0) {
|
|
|
+ bss->default_wep_key_len = atoi(pos);
|
|
|
+ if (bss->default_wep_key_len > 13) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: invalid WEP key len %lu (= %lu bits)",
|
|
|
+ line,
|
|
|
+ (unsigned long) bss->default_wep_key_len,
|
|
|
+ (unsigned long)
|
|
|
+ bss->default_wep_key_len * 8);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "wep_key_len_unicast") == 0) {
|
|
|
+ bss->individual_wep_key_len = atoi(pos);
|
|
|
+ if (bss->individual_wep_key_len < 0 ||
|
|
|
+ bss->individual_wep_key_len > 13) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: invalid WEP key len %d (= %d bits)",
|
|
|
+ line, bss->individual_wep_key_len,
|
|
|
+ bss->individual_wep_key_len * 8);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "wep_rekey_period") == 0) {
|
|
|
+ bss->wep_rekeying_period = atoi(pos);
|
|
|
+ if (bss->wep_rekeying_period < 0) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: invalid period %d",
|
|
|
+ line, bss->wep_rekeying_period);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "eap_reauth_period") == 0) {
|
|
|
+ bss->eap_reauth_period = atoi(pos);
|
|
|
+ if (bss->eap_reauth_period < 0) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: invalid period %d",
|
|
|
+ line, bss->eap_reauth_period);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "eapol_key_index_workaround") == 0) {
|
|
|
+ bss->eapol_key_index_workaround = atoi(pos);
|
|
|
#ifdef CONFIG_IAPP
|
|
|
- } else if (os_strcmp(buf, "iapp_interface") == 0) {
|
|
|
- bss->ieee802_11f = 1;
|
|
|
- os_strlcpy(bss->iapp_iface, pos,
|
|
|
- sizeof(bss->iapp_iface));
|
|
|
+ } else if (os_strcmp(buf, "iapp_interface") == 0) {
|
|
|
+ bss->ieee802_11f = 1;
|
|
|
+ os_strlcpy(bss->iapp_iface, pos, sizeof(bss->iapp_iface));
|
|
|
#endif /* CONFIG_IAPP */
|
|
|
- } else if (os_strcmp(buf, "own_ip_addr") == 0) {
|
|
|
- if (hostapd_parse_ip_addr(pos, &bss->own_ip_addr)) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid IP "
|
|
|
- "address '%s'", line, pos);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "nas_identifier") == 0) {
|
|
|
- bss->nas_identifier = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "own_ip_addr") == 0) {
|
|
|
+ if (hostapd_parse_ip_addr(pos, &bss->own_ip_addr)) {
|
|
|
+ wpa_printf(MSG_ERROR,
|
|
|
+ "Line %d: invalid IP address '%s'",
|
|
|
+ line, pos);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "nas_identifier") == 0) {
|
|
|
+ bss->nas_identifier = os_strdup(pos);
|
|
|
#ifndef CONFIG_NO_RADIUS
|
|
|
- } else if (os_strcmp(buf, "auth_server_addr") == 0) {
|
|
|
- if (hostapd_config_read_radius_addr(
|
|
|
- &bss->radius->auth_servers,
|
|
|
- &bss->radius->num_auth_servers, pos, 1812,
|
|
|
- &bss->radius->auth_server)) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid IP "
|
|
|
- "address '%s'", line, pos);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (bss->radius->auth_server &&
|
|
|
- os_strcmp(buf, "auth_server_port") == 0) {
|
|
|
- bss->radius->auth_server->port = atoi(pos);
|
|
|
- } else if (bss->radius->auth_server &&
|
|
|
- os_strcmp(buf, "auth_server_shared_secret") == 0) {
|
|
|
- int len = os_strlen(pos);
|
|
|
- if (len == 0) {
|
|
|
- /* RFC 2865, Ch. 3 */
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: empty shared "
|
|
|
- "secret is not allowed.", line);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- bss->radius->auth_server->shared_secret =
|
|
|
- (u8 *) os_strdup(pos);
|
|
|
- bss->radius->auth_server->shared_secret_len = len;
|
|
|
- } else if (os_strcmp(buf, "acct_server_addr") == 0) {
|
|
|
- if (hostapd_config_read_radius_addr(
|
|
|
- &bss->radius->acct_servers,
|
|
|
- &bss->radius->num_acct_servers, pos, 1813,
|
|
|
- &bss->radius->acct_server)) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid IP "
|
|
|
- "address '%s'", line, pos);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (bss->radius->acct_server &&
|
|
|
- os_strcmp(buf, "acct_server_port") == 0) {
|
|
|
- bss->radius->acct_server->port = atoi(pos);
|
|
|
- } else if (bss->radius->acct_server &&
|
|
|
- os_strcmp(buf, "acct_server_shared_secret") == 0) {
|
|
|
- int len = os_strlen(pos);
|
|
|
- if (len == 0) {
|
|
|
- /* RFC 2865, Ch. 3 */
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: empty shared "
|
|
|
- "secret is not allowed.", line);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- bss->radius->acct_server->shared_secret =
|
|
|
- (u8 *) os_strdup(pos);
|
|
|
- bss->radius->acct_server->shared_secret_len = len;
|
|
|
- } else if (os_strcmp(buf, "radius_retry_primary_interval") ==
|
|
|
- 0) {
|
|
|
- bss->radius->retry_primary_interval = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "radius_acct_interim_interval") == 0)
|
|
|
- {
|
|
|
- bss->acct_interim_interval = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "radius_request_cui") == 0) {
|
|
|
- bss->radius_request_cui = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "radius_auth_req_attr") == 0) {
|
|
|
- struct hostapd_radius_attr *attr, *a;
|
|
|
- attr = hostapd_parse_radius_attr(pos);
|
|
|
- if (attr == NULL) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid "
|
|
|
- "radius_auth_req_attr", line);
|
|
|
- errors++;
|
|
|
- } else if (bss->radius_auth_req_attr == NULL) {
|
|
|
- bss->radius_auth_req_attr = attr;
|
|
|
- } else {
|
|
|
- a = bss->radius_auth_req_attr;
|
|
|
- while (a->next)
|
|
|
- a = a->next;
|
|
|
- a->next = attr;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "radius_acct_req_attr") == 0) {
|
|
|
- struct hostapd_radius_attr *attr, *a;
|
|
|
- attr = hostapd_parse_radius_attr(pos);
|
|
|
- if (attr == NULL) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid "
|
|
|
- "radius_acct_req_attr", line);
|
|
|
- errors++;
|
|
|
- } else if (bss->radius_acct_req_attr == NULL) {
|
|
|
- bss->radius_acct_req_attr = attr;
|
|
|
- } else {
|
|
|
- a = bss->radius_acct_req_attr;
|
|
|
- while (a->next)
|
|
|
- a = a->next;
|
|
|
- a->next = attr;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "radius_das_port") == 0) {
|
|
|
- bss->radius_das_port = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "radius_das_client") == 0) {
|
|
|
- if (hostapd_parse_das_client(bss, pos) < 0) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid "
|
|
|
- "DAS client", line);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "radius_das_time_window") == 0) {
|
|
|
- bss->radius_das_time_window = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "radius_das_require_event_timestamp")
|
|
|
- == 0) {
|
|
|
- bss->radius_das_require_event_timestamp = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "auth_server_addr") == 0) {
|
|
|
+ if (hostapd_config_read_radius_addr(
|
|
|
+ &bss->radius->auth_servers,
|
|
|
+ &bss->radius->num_auth_servers, pos, 1812,
|
|
|
+ &bss->radius->auth_server)) {
|
|
|
+ wpa_printf(MSG_ERROR,
|
|
|
+ "Line %d: invalid IP address '%s'",
|
|
|
+ line, pos);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (bss->radius->auth_server &&
|
|
|
+ os_strcmp(buf, "auth_server_port") == 0) {
|
|
|
+ bss->radius->auth_server->port = atoi(pos);
|
|
|
+ } else if (bss->radius->auth_server &&
|
|
|
+ os_strcmp(buf, "auth_server_shared_secret") == 0) {
|
|
|
+ int len = os_strlen(pos);
|
|
|
+ if (len == 0) {
|
|
|
+ /* RFC 2865, Ch. 3 */
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: empty shared secret is not allowed",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ bss->radius->auth_server->shared_secret = (u8 *) os_strdup(pos);
|
|
|
+ bss->radius->auth_server->shared_secret_len = len;
|
|
|
+ } else if (os_strcmp(buf, "acct_server_addr") == 0) {
|
|
|
+ if (hostapd_config_read_radius_addr(
|
|
|
+ &bss->radius->acct_servers,
|
|
|
+ &bss->radius->num_acct_servers, pos, 1813,
|
|
|
+ &bss->radius->acct_server)) {
|
|
|
+ wpa_printf(MSG_ERROR,
|
|
|
+ "Line %d: invalid IP address '%s'",
|
|
|
+ line, pos);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (bss->radius->acct_server &&
|
|
|
+ os_strcmp(buf, "acct_server_port") == 0) {
|
|
|
+ bss->radius->acct_server->port = atoi(pos);
|
|
|
+ } else if (bss->radius->acct_server &&
|
|
|
+ os_strcmp(buf, "acct_server_shared_secret") == 0) {
|
|
|
+ int len = os_strlen(pos);
|
|
|
+ if (len == 0) {
|
|
|
+ /* RFC 2865, Ch. 3 */
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: empty shared secret is not allowed",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ bss->radius->acct_server->shared_secret = (u8 *) os_strdup(pos);
|
|
|
+ bss->radius->acct_server->shared_secret_len = len;
|
|
|
+ } else if (os_strcmp(buf, "radius_retry_primary_interval") == 0) {
|
|
|
+ bss->radius->retry_primary_interval = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "radius_acct_interim_interval") == 0) {
|
|
|
+ bss->acct_interim_interval = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "radius_request_cui") == 0) {
|
|
|
+ bss->radius_request_cui = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "radius_auth_req_attr") == 0) {
|
|
|
+ struct hostapd_radius_attr *attr, *a;
|
|
|
+ attr = hostapd_parse_radius_attr(pos);
|
|
|
+ if (attr == NULL) {
|
|
|
+ wpa_printf(MSG_ERROR,
|
|
|
+ "Line %d: invalid radius_auth_req_attr",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ } else if (bss->radius_auth_req_attr == NULL) {
|
|
|
+ bss->radius_auth_req_attr = attr;
|
|
|
+ } else {
|
|
|
+ a = bss->radius_auth_req_attr;
|
|
|
+ while (a->next)
|
|
|
+ a = a->next;
|
|
|
+ a->next = attr;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "radius_acct_req_attr") == 0) {
|
|
|
+ struct hostapd_radius_attr *attr, *a;
|
|
|
+ attr = hostapd_parse_radius_attr(pos);
|
|
|
+ if (attr == NULL) {
|
|
|
+ wpa_printf(MSG_ERROR,
|
|
|
+ "Line %d: invalid radius_acct_req_attr",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ } else if (bss->radius_acct_req_attr == NULL) {
|
|
|
+ bss->radius_acct_req_attr = attr;
|
|
|
+ } else {
|
|
|
+ a = bss->radius_acct_req_attr;
|
|
|
+ while (a->next)
|
|
|
+ a = a->next;
|
|
|
+ a->next = attr;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "radius_das_port") == 0) {
|
|
|
+ bss->radius_das_port = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "radius_das_client") == 0) {
|
|
|
+ if (hostapd_parse_das_client(bss, pos) < 0) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: invalid DAS client",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "radius_das_time_window") == 0) {
|
|
|
+ bss->radius_das_time_window = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "radius_das_require_event_timestamp") == 0) {
|
|
|
+ bss->radius_das_require_event_timestamp = atoi(pos);
|
|
|
#endif /* CONFIG_NO_RADIUS */
|
|
|
- } else if (os_strcmp(buf, "auth_algs") == 0) {
|
|
|
- bss->auth_algs = atoi(pos);
|
|
|
- if (bss->auth_algs == 0) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: no "
|
|
|
- "authentication algorithms allowed",
|
|
|
- line);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "max_num_sta") == 0) {
|
|
|
- bss->max_num_sta = atoi(pos);
|
|
|
- if (bss->max_num_sta < 0 ||
|
|
|
- bss->max_num_sta > MAX_STA_COUNT) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: Invalid "
|
|
|
- "max_num_sta=%d; allowed range "
|
|
|
- "0..%d", line, bss->max_num_sta,
|
|
|
- MAX_STA_COUNT);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "wpa") == 0) {
|
|
|
- bss->wpa = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "wpa_group_rekey") == 0) {
|
|
|
- bss->wpa_group_rekey = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "wpa_strict_rekey") == 0) {
|
|
|
- bss->wpa_strict_rekey = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "wpa_gmk_rekey") == 0) {
|
|
|
- bss->wpa_gmk_rekey = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "wpa_ptk_rekey") == 0) {
|
|
|
- bss->wpa_ptk_rekey = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "wpa_passphrase") == 0) {
|
|
|
- int len = os_strlen(pos);
|
|
|
- if (len < 8 || len > 63) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid WPA "
|
|
|
- "passphrase length %d (expected "
|
|
|
- "8..63)", line, len);
|
|
|
- errors++;
|
|
|
- } else {
|
|
|
- os_free(bss->ssid.wpa_passphrase);
|
|
|
- bss->ssid.wpa_passphrase = os_strdup(pos);
|
|
|
- if (bss->ssid.wpa_passphrase) {
|
|
|
- os_free(bss->ssid.wpa_psk);
|
|
|
- bss->ssid.wpa_psk = NULL;
|
|
|
- bss->ssid.wpa_passphrase_set = 1;
|
|
|
- }
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "wpa_psk") == 0) {
|
|
|
- os_free(bss->ssid.wpa_psk);
|
|
|
- bss->ssid.wpa_psk =
|
|
|
- os_zalloc(sizeof(struct hostapd_wpa_psk));
|
|
|
- if (bss->ssid.wpa_psk == NULL)
|
|
|
- errors++;
|
|
|
- else if (hexstr2bin(pos, bss->ssid.wpa_psk->psk,
|
|
|
- PMK_LEN) ||
|
|
|
- pos[PMK_LEN * 2] != '\0') {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: Invalid PSK "
|
|
|
- "'%s'.", line, pos);
|
|
|
- errors++;
|
|
|
- } else {
|
|
|
- bss->ssid.wpa_psk->group = 1;
|
|
|
- os_free(bss->ssid.wpa_passphrase);
|
|
|
- bss->ssid.wpa_passphrase = NULL;
|
|
|
- bss->ssid.wpa_psk_set = 1;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "wpa_psk_file") == 0) {
|
|
|
- os_free(bss->ssid.wpa_psk_file);
|
|
|
- bss->ssid.wpa_psk_file = os_strdup(pos);
|
|
|
- if (!bss->ssid.wpa_psk_file) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: allocation "
|
|
|
- "failed", line);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "wpa_key_mgmt") == 0) {
|
|
|
- bss->wpa_key_mgmt =
|
|
|
- hostapd_config_parse_key_mgmt(line, pos);
|
|
|
- if (bss->wpa_key_mgmt == -1)
|
|
|
- errors++;
|
|
|
- } else if (os_strcmp(buf, "wpa_psk_radius") == 0) {
|
|
|
- bss->wpa_psk_radius = atoi(pos);
|
|
|
- if (bss->wpa_psk_radius != PSK_RADIUS_IGNORED &&
|
|
|
- bss->wpa_psk_radius != PSK_RADIUS_ACCEPTED &&
|
|
|
- bss->wpa_psk_radius != PSK_RADIUS_REQUIRED) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: unknown "
|
|
|
- "wpa_psk_radius %d",
|
|
|
- line, bss->wpa_psk_radius);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "wpa_pairwise") == 0) {
|
|
|
- bss->wpa_pairwise =
|
|
|
- hostapd_config_parse_cipher(line, pos);
|
|
|
- if (bss->wpa_pairwise == -1 ||
|
|
|
- bss->wpa_pairwise == 0)
|
|
|
- errors++;
|
|
|
- else if (bss->wpa_pairwise &
|
|
|
- (WPA_CIPHER_NONE | WPA_CIPHER_WEP40 |
|
|
|
- WPA_CIPHER_WEP104)) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: unsupported "
|
|
|
- "pairwise cipher suite '%s'",
|
|
|
- bss->wpa_pairwise, pos);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "rsn_pairwise") == 0) {
|
|
|
- bss->rsn_pairwise =
|
|
|
- hostapd_config_parse_cipher(line, pos);
|
|
|
- if (bss->rsn_pairwise == -1 ||
|
|
|
- bss->rsn_pairwise == 0)
|
|
|
- errors++;
|
|
|
- else if (bss->rsn_pairwise &
|
|
|
- (WPA_CIPHER_NONE | WPA_CIPHER_WEP40 |
|
|
|
- WPA_CIPHER_WEP104)) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: unsupported "
|
|
|
- "pairwise cipher suite '%s'",
|
|
|
- bss->rsn_pairwise, pos);
|
|
|
- errors++;
|
|
|
+ } else if (os_strcmp(buf, "auth_algs") == 0) {
|
|
|
+ bss->auth_algs = atoi(pos);
|
|
|
+ if (bss->auth_algs == 0) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: no authentication algorithms allowed",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "max_num_sta") == 0) {
|
|
|
+ bss->max_num_sta = atoi(pos);
|
|
|
+ if (bss->max_num_sta < 0 ||
|
|
|
+ bss->max_num_sta > MAX_STA_COUNT) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: Invalid max_num_sta=%d; allowed range 0..%d",
|
|
|
+ line, bss->max_num_sta, MAX_STA_COUNT);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "wpa") == 0) {
|
|
|
+ bss->wpa = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "wpa_group_rekey") == 0) {
|
|
|
+ bss->wpa_group_rekey = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "wpa_strict_rekey") == 0) {
|
|
|
+ bss->wpa_strict_rekey = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "wpa_gmk_rekey") == 0) {
|
|
|
+ bss->wpa_gmk_rekey = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "wpa_ptk_rekey") == 0) {
|
|
|
+ bss->wpa_ptk_rekey = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "wpa_passphrase") == 0) {
|
|
|
+ int len = os_strlen(pos);
|
|
|
+ if (len < 8 || len > 63) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: invalid WPA passphrase length %d (expected 8..63)",
|
|
|
+ line, len);
|
|
|
+ errors++;
|
|
|
+ } else {
|
|
|
+ os_free(bss->ssid.wpa_passphrase);
|
|
|
+ bss->ssid.wpa_passphrase = os_strdup(pos);
|
|
|
+ if (bss->ssid.wpa_passphrase) {
|
|
|
+ os_free(bss->ssid.wpa_psk);
|
|
|
+ bss->ssid.wpa_psk = NULL;
|
|
|
+ bss->ssid.wpa_passphrase_set = 1;
|
|
|
}
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "wpa_psk") == 0) {
|
|
|
+ os_free(bss->ssid.wpa_psk);
|
|
|
+ bss->ssid.wpa_psk = os_zalloc(sizeof(struct hostapd_wpa_psk));
|
|
|
+ if (bss->ssid.wpa_psk == NULL)
|
|
|
+ errors++;
|
|
|
+ else if (hexstr2bin(pos, bss->ssid.wpa_psk->psk, PMK_LEN) ||
|
|
|
+ pos[PMK_LEN * 2] != '\0') {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: Invalid PSK '%s'.",
|
|
|
+ line, pos);
|
|
|
+ errors++;
|
|
|
+ } else {
|
|
|
+ bss->ssid.wpa_psk->group = 1;
|
|
|
+ os_free(bss->ssid.wpa_passphrase);
|
|
|
+ bss->ssid.wpa_passphrase = NULL;
|
|
|
+ bss->ssid.wpa_psk_set = 1;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "wpa_psk_file") == 0) {
|
|
|
+ os_free(bss->ssid.wpa_psk_file);
|
|
|
+ bss->ssid.wpa_psk_file = os_strdup(pos);
|
|
|
+ if (!bss->ssid.wpa_psk_file) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: allocation failed",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "wpa_key_mgmt") == 0) {
|
|
|
+ bss->wpa_key_mgmt = hostapd_config_parse_key_mgmt(line, pos);
|
|
|
+ if (bss->wpa_key_mgmt == -1)
|
|
|
+ errors++;
|
|
|
+ } else if (os_strcmp(buf, "wpa_psk_radius") == 0) {
|
|
|
+ bss->wpa_psk_radius = atoi(pos);
|
|
|
+ if (bss->wpa_psk_radius != PSK_RADIUS_IGNORED &&
|
|
|
+ bss->wpa_psk_radius != PSK_RADIUS_ACCEPTED &&
|
|
|
+ bss->wpa_psk_radius != PSK_RADIUS_REQUIRED) {
|
|
|
+ wpa_printf(MSG_ERROR,
|
|
|
+ "Line %d: unknown wpa_psk_radius %d",
|
|
|
+ line, bss->wpa_psk_radius);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "wpa_pairwise") == 0) {
|
|
|
+ bss->wpa_pairwise = hostapd_config_parse_cipher(line, pos);
|
|
|
+ if (bss->wpa_pairwise == -1 || bss->wpa_pairwise == 0)
|
|
|
+ errors++;
|
|
|
+ else if (bss->wpa_pairwise &
|
|
|
+ (WPA_CIPHER_NONE | WPA_CIPHER_WEP40 |
|
|
|
+ WPA_CIPHER_WEP104)) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: unsupported pairwise cipher suite '%s'",
|
|
|
+ bss->wpa_pairwise, pos);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "rsn_pairwise") == 0) {
|
|
|
+ bss->rsn_pairwise = hostapd_config_parse_cipher(line, pos);
|
|
|
+ if (bss->rsn_pairwise == -1 || bss->rsn_pairwise == 0)
|
|
|
+ errors++;
|
|
|
+ else if (bss->rsn_pairwise &
|
|
|
+ (WPA_CIPHER_NONE | WPA_CIPHER_WEP40 |
|
|
|
+ WPA_CIPHER_WEP104)) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: unsupported pairwise cipher suite '%s'",
|
|
|
+ bss->rsn_pairwise, pos);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
#ifdef CONFIG_RSN_PREAUTH
|
|
|
- } else if (os_strcmp(buf, "rsn_preauth") == 0) {
|
|
|
- bss->rsn_preauth = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "rsn_preauth_interfaces") == 0) {
|
|
|
- bss->rsn_preauth_interfaces = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "rsn_preauth") == 0) {
|
|
|
+ bss->rsn_preauth = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "rsn_preauth_interfaces") == 0) {
|
|
|
+ bss->rsn_preauth_interfaces = os_strdup(pos);
|
|
|
#endif /* CONFIG_RSN_PREAUTH */
|
|
|
#ifdef CONFIG_PEERKEY
|
|
|
- } else if (os_strcmp(buf, "peerkey") == 0) {
|
|
|
- bss->peerkey = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "peerkey") == 0) {
|
|
|
+ bss->peerkey = atoi(pos);
|
|
|
#endif /* CONFIG_PEERKEY */
|
|
|
#ifdef CONFIG_IEEE80211R
|
|
|
- } else if (os_strcmp(buf, "mobility_domain") == 0) {
|
|
|
- if (os_strlen(pos) != 2 * MOBILITY_DOMAIN_ID_LEN ||
|
|
|
- hexstr2bin(pos, bss->mobility_domain,
|
|
|
- MOBILITY_DOMAIN_ID_LEN) != 0) {
|
|
|
- wpa_printf(MSG_DEBUG, "Line %d: Invalid "
|
|
|
- "mobility_domain '%s'", line, pos);
|
|
|
- errors++;
|
|
|
- return errors;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "r1_key_holder") == 0) {
|
|
|
- if (os_strlen(pos) != 2 * FT_R1KH_ID_LEN ||
|
|
|
- hexstr2bin(pos, bss->r1_key_holder,
|
|
|
- FT_R1KH_ID_LEN) != 0) {
|
|
|
- wpa_printf(MSG_DEBUG, "Line %d: Invalid "
|
|
|
- "r1_key_holder '%s'", line, pos);
|
|
|
- errors++;
|
|
|
- return errors;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "r0_key_lifetime") == 0) {
|
|
|
- bss->r0_key_lifetime = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "reassociation_deadline") == 0) {
|
|
|
- bss->reassociation_deadline = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "r0kh") == 0) {
|
|
|
- if (add_r0kh(bss, pos) < 0) {
|
|
|
- wpa_printf(MSG_DEBUG, "Line %d: Invalid "
|
|
|
- "r0kh '%s'", line, pos);
|
|
|
- errors++;
|
|
|
- return errors;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "r1kh") == 0) {
|
|
|
- if (add_r1kh(bss, pos) < 0) {
|
|
|
- wpa_printf(MSG_DEBUG, "Line %d: Invalid "
|
|
|
- "r1kh '%s'", line, pos);
|
|
|
- errors++;
|
|
|
- return errors;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "pmk_r1_push") == 0) {
|
|
|
- bss->pmk_r1_push = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "ft_over_ds") == 0) {
|
|
|
- bss->ft_over_ds = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "mobility_domain") == 0) {
|
|
|
+ if (os_strlen(pos) != 2 * MOBILITY_DOMAIN_ID_LEN ||
|
|
|
+ hexstr2bin(pos, bss->mobility_domain,
|
|
|
+ MOBILITY_DOMAIN_ID_LEN) != 0) {
|
|
|
+ wpa_printf(MSG_ERROR,
|
|
|
+ "Line %d: Invalid mobility_domain '%s'",
|
|
|
+ line, pos);
|
|
|
+ errors++;
|
|
|
+ return errors;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "r1_key_holder") == 0) {
|
|
|
+ if (os_strlen(pos) != 2 * FT_R1KH_ID_LEN ||
|
|
|
+ hexstr2bin(pos, bss->r1_key_holder, FT_R1KH_ID_LEN) != 0) {
|
|
|
+ wpa_printf(MSG_ERROR,
|
|
|
+ "Line %d: Invalid r1_key_holder '%s'",
|
|
|
+ line, pos);
|
|
|
+ errors++;
|
|
|
+ return errors;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "r0_key_lifetime") == 0) {
|
|
|
+ bss->r0_key_lifetime = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "reassociation_deadline") == 0) {
|
|
|
+ bss->reassociation_deadline = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "r0kh") == 0) {
|
|
|
+ if (add_r0kh(bss, pos) < 0) {
|
|
|
+ wpa_printf(MSG_DEBUG, "Line %d: Invalid r0kh '%s'",
|
|
|
+ line, pos);
|
|
|
+ errors++;
|
|
|
+ return errors;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "r1kh") == 0) {
|
|
|
+ if (add_r1kh(bss, pos) < 0) {
|
|
|
+ wpa_printf(MSG_DEBUG, "Line %d: Invalid r1kh '%s'",
|
|
|
+ line, pos);
|
|
|
+ errors++;
|
|
|
+ return errors;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "pmk_r1_push") == 0) {
|
|
|
+ bss->pmk_r1_push = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "ft_over_ds") == 0) {
|
|
|
+ bss->ft_over_ds = atoi(pos);
|
|
|
#endif /* CONFIG_IEEE80211R */
|
|
|
#ifndef CONFIG_NO_CTRL_IFACE
|
|
|
- } else if (os_strcmp(buf, "ctrl_interface") == 0) {
|
|
|
- os_free(bss->ctrl_interface);
|
|
|
- bss->ctrl_interface = os_strdup(pos);
|
|
|
- } else if (os_strcmp(buf, "ctrl_interface_group") == 0) {
|
|
|
+ } else if (os_strcmp(buf, "ctrl_interface") == 0) {
|
|
|
+ os_free(bss->ctrl_interface);
|
|
|
+ bss->ctrl_interface = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "ctrl_interface_group") == 0) {
|
|
|
#ifndef CONFIG_NATIVE_WINDOWS
|
|
|
- struct group *grp;
|
|
|
- char *endp;
|
|
|
- const char *group = pos;
|
|
|
-
|
|
|
- grp = getgrnam(group);
|
|
|
- if (grp) {
|
|
|
- bss->ctrl_interface_gid = grp->gr_gid;
|
|
|
- bss->ctrl_interface_gid_set = 1;
|
|
|
- wpa_printf(MSG_DEBUG, "ctrl_interface_group=%d"
|
|
|
- " (from group name '%s')",
|
|
|
- bss->ctrl_interface_gid, group);
|
|
|
- return errors;
|
|
|
- }
|
|
|
+ struct group *grp;
|
|
|
+ char *endp;
|
|
|
+ const char *group = pos;
|
|
|
|
|
|
- /* Group name not found - try to parse this as gid */
|
|
|
- bss->ctrl_interface_gid = strtol(group, &endp, 10);
|
|
|
- if (*group == '\0' || *endp != '\0') {
|
|
|
- wpa_printf(MSG_DEBUG, "Line %d: Invalid group "
|
|
|
- "'%s'", line, group);
|
|
|
- errors++;
|
|
|
- return errors;
|
|
|
- }
|
|
|
+ grp = getgrnam(group);
|
|
|
+ if (grp) {
|
|
|
+ bss->ctrl_interface_gid = grp->gr_gid;
|
|
|
bss->ctrl_interface_gid_set = 1;
|
|
|
- wpa_printf(MSG_DEBUG, "ctrl_interface_group=%d",
|
|
|
- bss->ctrl_interface_gid);
|
|
|
+ wpa_printf(MSG_DEBUG, "ctrl_interface_group=%d (from group name '%s')",
|
|
|
+ bss->ctrl_interface_gid, group);
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* Group name not found - try to parse this as gid */
|
|
|
+ bss->ctrl_interface_gid = strtol(group, &endp, 10);
|
|
|
+ if (*group == '\0' || *endp != '\0') {
|
|
|
+ wpa_printf(MSG_DEBUG, "Line %d: Invalid group '%s'",
|
|
|
+ line, group);
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ bss->ctrl_interface_gid_set = 1;
|
|
|
+ wpa_printf(MSG_DEBUG, "ctrl_interface_group=%d",
|
|
|
+ bss->ctrl_interface_gid);
|
|
|
#endif /* CONFIG_NATIVE_WINDOWS */
|
|
|
#endif /* CONFIG_NO_CTRL_IFACE */
|
|
|
#ifdef RADIUS_SERVER
|
|
|
- } else if (os_strcmp(buf, "radius_server_clients") == 0) {
|
|
|
- os_free(bss->radius_server_clients);
|
|
|
- bss->radius_server_clients = os_strdup(pos);
|
|
|
- } else if (os_strcmp(buf, "radius_server_auth_port") == 0) {
|
|
|
- bss->radius_server_auth_port = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "radius_server_acct_port") == 0) {
|
|
|
- bss->radius_server_acct_port = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "radius_server_ipv6") == 0) {
|
|
|
- bss->radius_server_ipv6 = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "radius_server_clients") == 0) {
|
|
|
+ os_free(bss->radius_server_clients);
|
|
|
+ bss->radius_server_clients = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "radius_server_auth_port") == 0) {
|
|
|
+ bss->radius_server_auth_port = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "radius_server_acct_port") == 0) {
|
|
|
+ bss->radius_server_acct_port = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "radius_server_ipv6") == 0) {
|
|
|
+ bss->radius_server_ipv6 = atoi(pos);
|
|
|
#endif /* RADIUS_SERVER */
|
|
|
- } else if (os_strcmp(buf, "test_socket") == 0) {
|
|
|
- os_free(bss->test_socket);
|
|
|
- bss->test_socket = os_strdup(pos);
|
|
|
- } else if (os_strcmp(buf, "use_pae_group_addr") == 0) {
|
|
|
- bss->use_pae_group_addr = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "hw_mode") == 0) {
|
|
|
- if (os_strcmp(pos, "a") == 0)
|
|
|
- conf->hw_mode = HOSTAPD_MODE_IEEE80211A;
|
|
|
- else if (os_strcmp(pos, "b") == 0)
|
|
|
- conf->hw_mode = HOSTAPD_MODE_IEEE80211B;
|
|
|
- else if (os_strcmp(pos, "g") == 0)
|
|
|
- conf->hw_mode = HOSTAPD_MODE_IEEE80211G;
|
|
|
- else if (os_strcmp(pos, "ad") == 0)
|
|
|
- conf->hw_mode = HOSTAPD_MODE_IEEE80211AD;
|
|
|
- else {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: unknown "
|
|
|
- "hw_mode '%s'", line, pos);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "wps_rf_bands") == 0) {
|
|
|
- if (os_strcmp(pos, "a") == 0)
|
|
|
- bss->wps_rf_bands = WPS_RF_50GHZ;
|
|
|
- else if (os_strcmp(pos, "g") == 0 ||
|
|
|
- os_strcmp(pos, "b") == 0)
|
|
|
- bss->wps_rf_bands = WPS_RF_24GHZ;
|
|
|
- else if (os_strcmp(pos, "ag") == 0 ||
|
|
|
- os_strcmp(pos, "ga") == 0)
|
|
|
- bss->wps_rf_bands =
|
|
|
- WPS_RF_24GHZ | WPS_RF_50GHZ;
|
|
|
- else {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: unknown "
|
|
|
- "wps_rf_band '%s'", line, pos);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "channel") == 0) {
|
|
|
- if (os_strcmp(pos, "acs_survey") == 0) {
|
|
|
+ } else if (os_strcmp(buf, "test_socket") == 0) {
|
|
|
+ os_free(bss->test_socket);
|
|
|
+ bss->test_socket = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "use_pae_group_addr") == 0) {
|
|
|
+ bss->use_pae_group_addr = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "hw_mode") == 0) {
|
|
|
+ if (os_strcmp(pos, "a") == 0)
|
|
|
+ conf->hw_mode = HOSTAPD_MODE_IEEE80211A;
|
|
|
+ else if (os_strcmp(pos, "b") == 0)
|
|
|
+ conf->hw_mode = HOSTAPD_MODE_IEEE80211B;
|
|
|
+ else if (os_strcmp(pos, "g") == 0)
|
|
|
+ conf->hw_mode = HOSTAPD_MODE_IEEE80211G;
|
|
|
+ else if (os_strcmp(pos, "ad") == 0)
|
|
|
+ conf->hw_mode = HOSTAPD_MODE_IEEE80211AD;
|
|
|
+ else {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: unknown hw_mode '%s'",
|
|
|
+ line, pos);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "wps_rf_bands") == 0) {
|
|
|
+ if (os_strcmp(pos, "a") == 0)
|
|
|
+ bss->wps_rf_bands = WPS_RF_50GHZ;
|
|
|
+ else if (os_strcmp(pos, "g") == 0 ||
|
|
|
+ os_strcmp(pos, "b") == 0)
|
|
|
+ bss->wps_rf_bands = WPS_RF_24GHZ;
|
|
|
+ else if (os_strcmp(pos, "ag") == 0 ||
|
|
|
+ os_strcmp(pos, "ga") == 0)
|
|
|
+ bss->wps_rf_bands = WPS_RF_24GHZ | WPS_RF_50GHZ;
|
|
|
+ else {
|
|
|
+ wpa_printf(MSG_ERROR,
|
|
|
+ "Line %d: unknown wps_rf_band '%s'",
|
|
|
+ line, pos);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "channel") == 0) {
|
|
|
+ if (os_strcmp(pos, "acs_survey") == 0) {
|
|
|
#ifndef CONFIG_ACS
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: tries to enable ACS but CONFIG_ACS disabled",
|
|
|
- line);
|
|
|
- errors++;
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: tries to enable ACS but CONFIG_ACS disabled",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
#endif /* CONFIG_ACS */
|
|
|
- conf->channel = 0;
|
|
|
- } else
|
|
|
- conf->channel = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "chanlist") == 0) {
|
|
|
- if (hostapd_parse_intlist(&conf->chanlist, pos)) {
|
|
|
- wpa_printf(MSG_ERROR,
|
|
|
- "Line %d: invalid channel list",
|
|
|
- line);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "beacon_int") == 0) {
|
|
|
- int val = atoi(pos);
|
|
|
- /* MIB defines range as 1..65535, but very small values
|
|
|
- * cause problems with the current implementation.
|
|
|
- * Since it is unlikely that this small numbers are
|
|
|
- * useful in real life scenarios, do not allow beacon
|
|
|
- * period to be set below 15 TU. */
|
|
|
- if (val < 15 || val > 65535) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid "
|
|
|
- "beacon_int %d (expected "
|
|
|
- "15..65535)", line, val);
|
|
|
- errors++;
|
|
|
- } else
|
|
|
- conf->beacon_int = val;
|
|
|
+ conf->channel = 0;
|
|
|
+ } else
|
|
|
+ conf->channel = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "chanlist") == 0) {
|
|
|
+ if (hostapd_parse_intlist(&conf->chanlist, pos)) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: invalid channel list",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "beacon_int") == 0) {
|
|
|
+ int val = atoi(pos);
|
|
|
+ /* MIB defines range as 1..65535, but very small values
|
|
|
+ * cause problems with the current implementation.
|
|
|
+ * Since it is unlikely that this small numbers are
|
|
|
+ * useful in real life scenarios, do not allow beacon
|
|
|
+ * period to be set below 15 TU. */
|
|
|
+ if (val < 15 || val > 65535) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: invalid beacon_int %d (expected 15..65535)",
|
|
|
+ line, val);
|
|
|
+ errors++;
|
|
|
+ } else
|
|
|
+ conf->beacon_int = val;
|
|
|
#ifdef CONFIG_ACS
|
|
|
- } else if (os_strcmp(buf, "acs_num_scans") == 0) {
|
|
|
- int val = atoi(pos);
|
|
|
- if (val <= 0 || val > 100) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid acs_num_scans %d (expected 1..100)",
|
|
|
- line, val);
|
|
|
- errors++;
|
|
|
- } else
|
|
|
- conf->acs_num_scans = val;
|
|
|
+ } else if (os_strcmp(buf, "acs_num_scans") == 0) {
|
|
|
+ int val = atoi(pos);
|
|
|
+ if (val <= 0 || val > 100) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: invalid acs_num_scans %d (expected 1..100)",
|
|
|
+ line, val);
|
|
|
+ errors++;
|
|
|
+ } else
|
|
|
+ conf->acs_num_scans = val;
|
|
|
#endif /* CONFIG_ACS */
|
|
|
- } else if (os_strcmp(buf, "dtim_period") == 0) {
|
|
|
- bss->dtim_period = atoi(pos);
|
|
|
- if (bss->dtim_period < 1 || bss->dtim_period > 255) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid "
|
|
|
- "dtim_period %d",
|
|
|
- line, bss->dtim_period);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "rts_threshold") == 0) {
|
|
|
- conf->rts_threshold = atoi(pos);
|
|
|
- if (conf->rts_threshold < 0 ||
|
|
|
- conf->rts_threshold > 2347) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid "
|
|
|
- "rts_threshold %d",
|
|
|
- line, conf->rts_threshold);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "fragm_threshold") == 0) {
|
|
|
- conf->fragm_threshold = atoi(pos);
|
|
|
- if (conf->fragm_threshold < 256 ||
|
|
|
- conf->fragm_threshold > 2346) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid "
|
|
|
- "fragm_threshold %d",
|
|
|
- line, conf->fragm_threshold);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "send_probe_response") == 0) {
|
|
|
- int val = atoi(pos);
|
|
|
- if (val != 0 && val != 1) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid "
|
|
|
- "send_probe_response %d (expected "
|
|
|
- "0 or 1)", line, val);
|
|
|
- } else
|
|
|
- conf->send_probe_response = val;
|
|
|
- } else if (os_strcmp(buf, "supported_rates") == 0) {
|
|
|
- if (hostapd_parse_intlist(&conf->supported_rates, pos))
|
|
|
- {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid rate "
|
|
|
- "list", line);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "basic_rates") == 0) {
|
|
|
- if (hostapd_parse_intlist(&conf->basic_rates, pos)) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid rate "
|
|
|
- "list", line);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "preamble") == 0) {
|
|
|
- if (atoi(pos))
|
|
|
- conf->preamble = SHORT_PREAMBLE;
|
|
|
- else
|
|
|
- conf->preamble = LONG_PREAMBLE;
|
|
|
- } else if (os_strcmp(buf, "ignore_broadcast_ssid") == 0) {
|
|
|
- bss->ignore_broadcast_ssid = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "wep_default_key") == 0) {
|
|
|
- bss->ssid.wep.idx = atoi(pos);
|
|
|
- if (bss->ssid.wep.idx > 3) {
|
|
|
- wpa_printf(MSG_ERROR, "Invalid "
|
|
|
- "wep_default_key index %d",
|
|
|
- bss->ssid.wep.idx);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "wep_key0") == 0 ||
|
|
|
- os_strcmp(buf, "wep_key1") == 0 ||
|
|
|
- os_strcmp(buf, "wep_key2") == 0 ||
|
|
|
- os_strcmp(buf, "wep_key3") == 0) {
|
|
|
- if (hostapd_config_read_wep(&bss->ssid.wep,
|
|
|
- buf[7] - '0', pos)) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid WEP "
|
|
|
- "key '%s'", line, buf);
|
|
|
- errors++;
|
|
|
- }
|
|
|
+ } else if (os_strcmp(buf, "dtim_period") == 0) {
|
|
|
+ bss->dtim_period = atoi(pos);
|
|
|
+ if (bss->dtim_period < 1 || bss->dtim_period > 255) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: invalid dtim_period %d",
|
|
|
+ line, bss->dtim_period);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "rts_threshold") == 0) {
|
|
|
+ conf->rts_threshold = atoi(pos);
|
|
|
+ if (conf->rts_threshold < 0 || conf->rts_threshold > 2347) {
|
|
|
+ wpa_printf(MSG_ERROR,
|
|
|
+ "Line %d: invalid rts_threshold %d",
|
|
|
+ line, conf->rts_threshold);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "fragm_threshold") == 0) {
|
|
|
+ conf->fragm_threshold = atoi(pos);
|
|
|
+ if (conf->fragm_threshold < 256 ||
|
|
|
+ conf->fragm_threshold > 2346) {
|
|
|
+ wpa_printf(MSG_ERROR,
|
|
|
+ "Line %d: invalid fragm_threshold %d",
|
|
|
+ line, conf->fragm_threshold);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "send_probe_response") == 0) {
|
|
|
+ int val = atoi(pos);
|
|
|
+ if (val != 0 && val != 1) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: invalid send_probe_response %d (expected 0 or 1)",
|
|
|
+ line, val);
|
|
|
+ } else
|
|
|
+ conf->send_probe_response = val;
|
|
|
+ } else if (os_strcmp(buf, "supported_rates") == 0) {
|
|
|
+ if (hostapd_parse_intlist(&conf->supported_rates, pos)) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: invalid rate list",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "basic_rates") == 0) {
|
|
|
+ if (hostapd_parse_intlist(&conf->basic_rates, pos)) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: invalid rate list",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "preamble") == 0) {
|
|
|
+ if (atoi(pos))
|
|
|
+ conf->preamble = SHORT_PREAMBLE;
|
|
|
+ else
|
|
|
+ conf->preamble = LONG_PREAMBLE;
|
|
|
+ } else if (os_strcmp(buf, "ignore_broadcast_ssid") == 0) {
|
|
|
+ bss->ignore_broadcast_ssid = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "wep_default_key") == 0) {
|
|
|
+ bss->ssid.wep.idx = atoi(pos);
|
|
|
+ if (bss->ssid.wep.idx > 3) {
|
|
|
+ wpa_printf(MSG_ERROR,
|
|
|
+ "Invalid wep_default_key index %d",
|
|
|
+ bss->ssid.wep.idx);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "wep_key0") == 0 ||
|
|
|
+ os_strcmp(buf, "wep_key1") == 0 ||
|
|
|
+ os_strcmp(buf, "wep_key2") == 0 ||
|
|
|
+ os_strcmp(buf, "wep_key3") == 0) {
|
|
|
+ if (hostapd_config_read_wep(&bss->ssid.wep,
|
|
|
+ buf[7] - '0', pos)) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: invalid WEP key '%s'",
|
|
|
+ line, buf);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
#ifndef CONFIG_NO_VLAN
|
|
|
- } else if (os_strcmp(buf, "dynamic_vlan") == 0) {
|
|
|
- bss->ssid.dynamic_vlan = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "vlan_file") == 0) {
|
|
|
- if (hostapd_config_read_vlan_file(bss, pos)) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: failed to "
|
|
|
- "read VLAN file '%s'", line, pos);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "vlan_naming") == 0) {
|
|
|
- bss->ssid.vlan_naming = atoi(pos);
|
|
|
- if (bss->ssid.vlan_naming >= DYNAMIC_VLAN_NAMING_END ||
|
|
|
- bss->ssid.vlan_naming < 0) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid "
|
|
|
- "naming scheme %d", line,
|
|
|
- bss->ssid.vlan_naming);
|
|
|
- errors++;
|
|
|
- }
|
|
|
+ } else if (os_strcmp(buf, "dynamic_vlan") == 0) {
|
|
|
+ bss->ssid.dynamic_vlan = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "vlan_file") == 0) {
|
|
|
+ if (hostapd_config_read_vlan_file(bss, pos)) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: failed to read VLAN file '%s'",
|
|
|
+ line, pos);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "vlan_naming") == 0) {
|
|
|
+ bss->ssid.vlan_naming = atoi(pos);
|
|
|
+ if (bss->ssid.vlan_naming >= DYNAMIC_VLAN_NAMING_END ||
|
|
|
+ bss->ssid.vlan_naming < 0) {
|
|
|
+ wpa_printf(MSG_ERROR,
|
|
|
+ "Line %d: invalid naming scheme %d",
|
|
|
+ line, bss->ssid.vlan_naming);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
#ifdef CONFIG_FULL_DYNAMIC_VLAN
|
|
|
- } else if (os_strcmp(buf, "vlan_tagged_interface") == 0) {
|
|
|
- bss->ssid.vlan_tagged_interface = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "vlan_tagged_interface") == 0) {
|
|
|
+ bss->ssid.vlan_tagged_interface = os_strdup(pos);
|
|
|
#endif /* CONFIG_FULL_DYNAMIC_VLAN */
|
|
|
#endif /* CONFIG_NO_VLAN */
|
|
|
- } else if (os_strcmp(buf, "ap_table_max_size") == 0) {
|
|
|
- conf->ap_table_max_size = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "ap_table_expiration_time") == 0) {
|
|
|
- conf->ap_table_expiration_time = atoi(pos);
|
|
|
- } else if (os_strncmp(buf, "tx_queue_", 9) == 0) {
|
|
|
- if (hostapd_config_tx_queue(conf, buf, pos)) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid TX "
|
|
|
- "queue item", line);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "wme_enabled") == 0 ||
|
|
|
- os_strcmp(buf, "wmm_enabled") == 0) {
|
|
|
- bss->wmm_enabled = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "uapsd_advertisement_enabled") == 0) {
|
|
|
- bss->wmm_uapsd = atoi(pos);
|
|
|
- } else if (os_strncmp(buf, "wme_ac_", 7) == 0 ||
|
|
|
- os_strncmp(buf, "wmm_ac_", 7) == 0) {
|
|
|
- if (hostapd_config_wmm_ac(conf->wmm_ac_params, buf,
|
|
|
- pos)) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid WMM "
|
|
|
- "ac item", line);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "bss") == 0) {
|
|
|
- if (hostapd_config_bss(conf, pos)) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid bss "
|
|
|
- "item", line);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "bssid") == 0) {
|
|
|
- if (hwaddr_aton(pos, bss->bssid)) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid bssid "
|
|
|
- "item", line);
|
|
|
- errors++;
|
|
|
- }
|
|
|
+ } else if (os_strcmp(buf, "ap_table_max_size") == 0) {
|
|
|
+ conf->ap_table_max_size = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "ap_table_expiration_time") == 0) {
|
|
|
+ conf->ap_table_expiration_time = atoi(pos);
|
|
|
+ } else if (os_strncmp(buf, "tx_queue_", 9) == 0) {
|
|
|
+ if (hostapd_config_tx_queue(conf, buf, pos)) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: invalid TX queue item",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "wme_enabled") == 0 ||
|
|
|
+ os_strcmp(buf, "wmm_enabled") == 0) {
|
|
|
+ bss->wmm_enabled = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "uapsd_advertisement_enabled") == 0) {
|
|
|
+ bss->wmm_uapsd = atoi(pos);
|
|
|
+ } else if (os_strncmp(buf, "wme_ac_", 7) == 0 ||
|
|
|
+ os_strncmp(buf, "wmm_ac_", 7) == 0) {
|
|
|
+ if (hostapd_config_wmm_ac(conf->wmm_ac_params, buf, pos)) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: invalid WMM ac item",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "bss") == 0) {
|
|
|
+ if (hostapd_config_bss(conf, pos)) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: invalid bss item",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "bssid") == 0) {
|
|
|
+ if (hwaddr_aton(pos, bss->bssid)) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: invalid bssid item",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
#ifdef CONFIG_IEEE80211W
|
|
|
- } else if (os_strcmp(buf, "ieee80211w") == 0) {
|
|
|
- bss->ieee80211w = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "assoc_sa_query_max_timeout") == 0) {
|
|
|
- bss->assoc_sa_query_max_timeout = atoi(pos);
|
|
|
- if (bss->assoc_sa_query_max_timeout == 0) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid "
|
|
|
- "assoc_sa_query_max_timeout", line);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "assoc_sa_query_retry_timeout") == 0)
|
|
|
- {
|
|
|
- bss->assoc_sa_query_retry_timeout = atoi(pos);
|
|
|
- if (bss->assoc_sa_query_retry_timeout == 0) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid "
|
|
|
- "assoc_sa_query_retry_timeout",
|
|
|
- line);
|
|
|
- errors++;
|
|
|
- }
|
|
|
+ } else if (os_strcmp(buf, "ieee80211w") == 0) {
|
|
|
+ bss->ieee80211w = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "assoc_sa_query_max_timeout") == 0) {
|
|
|
+ bss->assoc_sa_query_max_timeout = atoi(pos);
|
|
|
+ if (bss->assoc_sa_query_max_timeout == 0) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: invalid assoc_sa_query_max_timeout",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "assoc_sa_query_retry_timeout") == 0) {
|
|
|
+ bss->assoc_sa_query_retry_timeout = atoi(pos);
|
|
|
+ if (bss->assoc_sa_query_retry_timeout == 0) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: invalid assoc_sa_query_retry_timeout",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
#endif /* CONFIG_IEEE80211W */
|
|
|
#ifdef CONFIG_IEEE80211N
|
|
|
- } else if (os_strcmp(buf, "ieee80211n") == 0) {
|
|
|
- conf->ieee80211n = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "ht_capab") == 0) {
|
|
|
- if (hostapd_config_ht_capab(conf, pos) < 0) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid "
|
|
|
- "ht_capab", line);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "require_ht") == 0) {
|
|
|
- conf->require_ht = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "obss_interval") == 0) {
|
|
|
- conf->obss_interval = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "ieee80211n") == 0) {
|
|
|
+ conf->ieee80211n = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "ht_capab") == 0) {
|
|
|
+ if (hostapd_config_ht_capab(conf, pos) < 0) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: invalid ht_capab",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "require_ht") == 0) {
|
|
|
+ conf->require_ht = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "obss_interval") == 0) {
|
|
|
+ conf->obss_interval = atoi(pos);
|
|
|
#endif /* CONFIG_IEEE80211N */
|
|
|
#ifdef CONFIG_IEEE80211AC
|
|
|
- } else if (os_strcmp(buf, "ieee80211ac") == 0) {
|
|
|
- conf->ieee80211ac = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "vht_capab") == 0) {
|
|
|
- if (hostapd_config_vht_capab(conf, pos) < 0) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid "
|
|
|
- "vht_capab", line);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "require_vht") == 0) {
|
|
|
- conf->require_vht = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "vht_oper_chwidth") == 0) {
|
|
|
- conf->vht_oper_chwidth = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "vht_oper_centr_freq_seg0_idx") == 0)
|
|
|
- {
|
|
|
- conf->vht_oper_centr_freq_seg0_idx = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "vht_oper_centr_freq_seg1_idx") == 0)
|
|
|
- {
|
|
|
- conf->vht_oper_centr_freq_seg1_idx = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "ieee80211ac") == 0) {
|
|
|
+ conf->ieee80211ac = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "vht_capab") == 0) {
|
|
|
+ if (hostapd_config_vht_capab(conf, pos) < 0) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: invalid vht_capab",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "require_vht") == 0) {
|
|
|
+ conf->require_vht = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "vht_oper_chwidth") == 0) {
|
|
|
+ conf->vht_oper_chwidth = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "vht_oper_centr_freq_seg0_idx") == 0) {
|
|
|
+ conf->vht_oper_centr_freq_seg0_idx = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "vht_oper_centr_freq_seg1_idx") == 0) {
|
|
|
+ conf->vht_oper_centr_freq_seg1_idx = atoi(pos);
|
|
|
#endif /* CONFIG_IEEE80211AC */
|
|
|
- } else if (os_strcmp(buf, "max_listen_interval") == 0) {
|
|
|
- bss->max_listen_interval = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "disable_pmksa_caching") == 0) {
|
|
|
- bss->disable_pmksa_caching = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "okc") == 0) {
|
|
|
- bss->okc = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "max_listen_interval") == 0) {
|
|
|
+ bss->max_listen_interval = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "disable_pmksa_caching") == 0) {
|
|
|
+ bss->disable_pmksa_caching = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "okc") == 0) {
|
|
|
+ bss->okc = atoi(pos);
|
|
|
#ifdef CONFIG_WPS
|
|
|
- } else if (os_strcmp(buf, "wps_state") == 0) {
|
|
|
- bss->wps_state = atoi(pos);
|
|
|
- if (bss->wps_state < 0 || bss->wps_state > 2) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid "
|
|
|
- "wps_state", line);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "wps_independent") == 0) {
|
|
|
- bss->wps_independent = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "ap_setup_locked") == 0) {
|
|
|
- bss->ap_setup_locked = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "uuid") == 0) {
|
|
|
- if (uuid_str2bin(pos, bss->uuid)) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid UUID",
|
|
|
- line);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "wps_pin_requests") == 0) {
|
|
|
- os_free(bss->wps_pin_requests);
|
|
|
- bss->wps_pin_requests = os_strdup(pos);
|
|
|
- } else if (os_strcmp(buf, "device_name") == 0) {
|
|
|
- if (os_strlen(pos) > 32) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: Too long "
|
|
|
- "device_name", line);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- os_free(bss->device_name);
|
|
|
- bss->device_name = os_strdup(pos);
|
|
|
- } else if (os_strcmp(buf, "manufacturer") == 0) {
|
|
|
- if (os_strlen(pos) > 64) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: Too long "
|
|
|
- "manufacturer", line);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- os_free(bss->manufacturer);
|
|
|
- bss->manufacturer = os_strdup(pos);
|
|
|
- } else if (os_strcmp(buf, "model_name") == 0) {
|
|
|
- if (os_strlen(pos) > 32) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: Too long "
|
|
|
- "model_name", line);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- os_free(bss->model_name);
|
|
|
- bss->model_name = os_strdup(pos);
|
|
|
- } else if (os_strcmp(buf, "model_number") == 0) {
|
|
|
- if (os_strlen(pos) > 32) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: Too long "
|
|
|
- "model_number", line);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- os_free(bss->model_number);
|
|
|
- bss->model_number = os_strdup(pos);
|
|
|
- } else if (os_strcmp(buf, "serial_number") == 0) {
|
|
|
- if (os_strlen(pos) > 32) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: Too long "
|
|
|
- "serial_number", line);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- os_free(bss->serial_number);
|
|
|
- bss->serial_number = os_strdup(pos);
|
|
|
- } else if (os_strcmp(buf, "device_type") == 0) {
|
|
|
- if (wps_dev_type_str2bin(pos, bss->device_type))
|
|
|
- errors++;
|
|
|
- } else if (os_strcmp(buf, "config_methods") == 0) {
|
|
|
- os_free(bss->config_methods);
|
|
|
- bss->config_methods = os_strdup(pos);
|
|
|
- } else if (os_strcmp(buf, "os_version") == 0) {
|
|
|
- if (hexstr2bin(pos, bss->os_version, 4)) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid "
|
|
|
- "os_version", line);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "ap_pin") == 0) {
|
|
|
- os_free(bss->ap_pin);
|
|
|
- bss->ap_pin = os_strdup(pos);
|
|
|
- } else if (os_strcmp(buf, "skip_cred_build") == 0) {
|
|
|
- bss->skip_cred_build = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "extra_cred") == 0) {
|
|
|
- os_free(bss->extra_cred);
|
|
|
- bss->extra_cred =
|
|
|
- (u8 *) os_readfile(pos, &bss->extra_cred_len);
|
|
|
- if (bss->extra_cred == NULL) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: could not "
|
|
|
- "read Credentials from '%s'",
|
|
|
- line, pos);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "wps_cred_processing") == 0) {
|
|
|
- bss->wps_cred_processing = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "ap_settings") == 0) {
|
|
|
- os_free(bss->ap_settings);
|
|
|
- bss->ap_settings =
|
|
|
- (u8 *) os_readfile(pos, &bss->ap_settings_len);
|
|
|
- if (bss->ap_settings == NULL) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: could not "
|
|
|
- "read AP Settings from '%s'",
|
|
|
- line, pos);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "upnp_iface") == 0) {
|
|
|
- bss->upnp_iface = os_strdup(pos);
|
|
|
- } else if (os_strcmp(buf, "friendly_name") == 0) {
|
|
|
- os_free(bss->friendly_name);
|
|
|
- bss->friendly_name = os_strdup(pos);
|
|
|
- } else if (os_strcmp(buf, "manufacturer_url") == 0) {
|
|
|
- os_free(bss->manufacturer_url);
|
|
|
- bss->manufacturer_url = os_strdup(pos);
|
|
|
- } else if (os_strcmp(buf, "model_description") == 0) {
|
|
|
- os_free(bss->model_description);
|
|
|
- bss->model_description = os_strdup(pos);
|
|
|
- } else if (os_strcmp(buf, "model_url") == 0) {
|
|
|
- os_free(bss->model_url);
|
|
|
- bss->model_url = os_strdup(pos);
|
|
|
- } else if (os_strcmp(buf, "upc") == 0) {
|
|
|
- os_free(bss->upc);
|
|
|
- bss->upc = os_strdup(pos);
|
|
|
- } else if (os_strcmp(buf, "pbc_in_m1") == 0) {
|
|
|
- bss->pbc_in_m1 = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "server_id") == 0) {
|
|
|
- os_free(bss->server_id);
|
|
|
- bss->server_id = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "wps_state") == 0) {
|
|
|
+ bss->wps_state = atoi(pos);
|
|
|
+ if (bss->wps_state < 0 || bss->wps_state > 2) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: invalid wps_state",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "wps_independent") == 0) {
|
|
|
+ bss->wps_independent = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "ap_setup_locked") == 0) {
|
|
|
+ bss->ap_setup_locked = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "uuid") == 0) {
|
|
|
+ if (uuid_str2bin(pos, bss->uuid)) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: invalid UUID", line);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "wps_pin_requests") == 0) {
|
|
|
+ os_free(bss->wps_pin_requests);
|
|
|
+ bss->wps_pin_requests = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "device_name") == 0) {
|
|
|
+ if (os_strlen(pos) > 32) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: Too long "
|
|
|
+ "device_name", line);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ os_free(bss->device_name);
|
|
|
+ bss->device_name = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "manufacturer") == 0) {
|
|
|
+ if (os_strlen(pos) > 64) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: Too long manufacturer",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ os_free(bss->manufacturer);
|
|
|
+ bss->manufacturer = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "model_name") == 0) {
|
|
|
+ if (os_strlen(pos) > 32) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: Too long model_name",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ os_free(bss->model_name);
|
|
|
+ bss->model_name = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "model_number") == 0) {
|
|
|
+ if (os_strlen(pos) > 32) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: Too long model_number",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ os_free(bss->model_number);
|
|
|
+ bss->model_number = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "serial_number") == 0) {
|
|
|
+ if (os_strlen(pos) > 32) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: Too long serial_number",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ os_free(bss->serial_number);
|
|
|
+ bss->serial_number = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "device_type") == 0) {
|
|
|
+ if (wps_dev_type_str2bin(pos, bss->device_type))
|
|
|
+ errors++;
|
|
|
+ } else if (os_strcmp(buf, "config_methods") == 0) {
|
|
|
+ os_free(bss->config_methods);
|
|
|
+ bss->config_methods = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "os_version") == 0) {
|
|
|
+ if (hexstr2bin(pos, bss->os_version, 4)) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: invalid os_version",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "ap_pin") == 0) {
|
|
|
+ os_free(bss->ap_pin);
|
|
|
+ bss->ap_pin = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "skip_cred_build") == 0) {
|
|
|
+ bss->skip_cred_build = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "extra_cred") == 0) {
|
|
|
+ os_free(bss->extra_cred);
|
|
|
+ bss->extra_cred = (u8 *) os_readfile(pos, &bss->extra_cred_len);
|
|
|
+ if (bss->extra_cred == NULL) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: could not read Credentials from '%s'",
|
|
|
+ line, pos);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "wps_cred_processing") == 0) {
|
|
|
+ bss->wps_cred_processing = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "ap_settings") == 0) {
|
|
|
+ os_free(bss->ap_settings);
|
|
|
+ bss->ap_settings =
|
|
|
+ (u8 *) os_readfile(pos, &bss->ap_settings_len);
|
|
|
+ if (bss->ap_settings == NULL) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: could not read AP Settings from '%s'",
|
|
|
+ line, pos);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "upnp_iface") == 0) {
|
|
|
+ bss->upnp_iface = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "friendly_name") == 0) {
|
|
|
+ os_free(bss->friendly_name);
|
|
|
+ bss->friendly_name = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "manufacturer_url") == 0) {
|
|
|
+ os_free(bss->manufacturer_url);
|
|
|
+ bss->manufacturer_url = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "model_description") == 0) {
|
|
|
+ os_free(bss->model_description);
|
|
|
+ bss->model_description = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "model_url") == 0) {
|
|
|
+ os_free(bss->model_url);
|
|
|
+ bss->model_url = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "upc") == 0) {
|
|
|
+ os_free(bss->upc);
|
|
|
+ bss->upc = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "pbc_in_m1") == 0) {
|
|
|
+ bss->pbc_in_m1 = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "server_id") == 0) {
|
|
|
+ os_free(bss->server_id);
|
|
|
+ bss->server_id = os_strdup(pos);
|
|
|
#ifdef CONFIG_WPS_NFC
|
|
|
- } else if (os_strcmp(buf, "wps_nfc_dev_pw_id") == 0) {
|
|
|
- bss->wps_nfc_dev_pw_id = atoi(pos);
|
|
|
- if (bss->wps_nfc_dev_pw_id < 0x10 ||
|
|
|
- bss->wps_nfc_dev_pw_id > 0xffff) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: Invalid "
|
|
|
- "wps_nfc_dev_pw_id value", line);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- bss->wps_nfc_pw_from_config = 1;
|
|
|
- } else if (os_strcmp(buf, "wps_nfc_dh_pubkey") == 0) {
|
|
|
- wpabuf_free(bss->wps_nfc_dh_pubkey);
|
|
|
- bss->wps_nfc_dh_pubkey = hostapd_parse_bin(pos);
|
|
|
- bss->wps_nfc_pw_from_config = 1;
|
|
|
- } else if (os_strcmp(buf, "wps_nfc_dh_privkey") == 0) {
|
|
|
- wpabuf_free(bss->wps_nfc_dh_privkey);
|
|
|
- bss->wps_nfc_dh_privkey = hostapd_parse_bin(pos);
|
|
|
- bss->wps_nfc_pw_from_config = 1;
|
|
|
- } else if (os_strcmp(buf, "wps_nfc_dev_pw") == 0) {
|
|
|
- wpabuf_free(bss->wps_nfc_dev_pw);
|
|
|
- bss->wps_nfc_dev_pw = hostapd_parse_bin(pos);
|
|
|
- bss->wps_nfc_pw_from_config = 1;
|
|
|
+ } else if (os_strcmp(buf, "wps_nfc_dev_pw_id") == 0) {
|
|
|
+ bss->wps_nfc_dev_pw_id = atoi(pos);
|
|
|
+ if (bss->wps_nfc_dev_pw_id < 0x10 ||
|
|
|
+ bss->wps_nfc_dev_pw_id > 0xffff) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: Invalid wps_nfc_dev_pw_id value",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ bss->wps_nfc_pw_from_config = 1;
|
|
|
+ } else if (os_strcmp(buf, "wps_nfc_dh_pubkey") == 0) {
|
|
|
+ wpabuf_free(bss->wps_nfc_dh_pubkey);
|
|
|
+ bss->wps_nfc_dh_pubkey = hostapd_parse_bin(pos);
|
|
|
+ bss->wps_nfc_pw_from_config = 1;
|
|
|
+ } else if (os_strcmp(buf, "wps_nfc_dh_privkey") == 0) {
|
|
|
+ wpabuf_free(bss->wps_nfc_dh_privkey);
|
|
|
+ bss->wps_nfc_dh_privkey = hostapd_parse_bin(pos);
|
|
|
+ bss->wps_nfc_pw_from_config = 1;
|
|
|
+ } else if (os_strcmp(buf, "wps_nfc_dev_pw") == 0) {
|
|
|
+ wpabuf_free(bss->wps_nfc_dev_pw);
|
|
|
+ bss->wps_nfc_dev_pw = hostapd_parse_bin(pos);
|
|
|
+ bss->wps_nfc_pw_from_config = 1;
|
|
|
#endif /* CONFIG_WPS_NFC */
|
|
|
#endif /* CONFIG_WPS */
|
|
|
#ifdef CONFIG_P2P_MANAGER
|
|
|
- } else if (os_strcmp(buf, "manage_p2p") == 0) {
|
|
|
- int manage = atoi(pos);
|
|
|
- if (manage)
|
|
|
- bss->p2p |= P2P_MANAGE;
|
|
|
- else
|
|
|
- bss->p2p &= ~P2P_MANAGE;
|
|
|
- } else if (os_strcmp(buf, "allow_cross_connection") == 0) {
|
|
|
- if (atoi(pos))
|
|
|
- bss->p2p |= P2P_ALLOW_CROSS_CONNECTION;
|
|
|
- else
|
|
|
- bss->p2p &= ~P2P_ALLOW_CROSS_CONNECTION;
|
|
|
+ } else if (os_strcmp(buf, "manage_p2p") == 0) {
|
|
|
+ int manage = atoi(pos);
|
|
|
+ if (manage)
|
|
|
+ bss->p2p |= P2P_MANAGE;
|
|
|
+ else
|
|
|
+ bss->p2p &= ~P2P_MANAGE;
|
|
|
+ } else if (os_strcmp(buf, "allow_cross_connection") == 0) {
|
|
|
+ if (atoi(pos))
|
|
|
+ bss->p2p |= P2P_ALLOW_CROSS_CONNECTION;
|
|
|
+ else
|
|
|
+ bss->p2p &= ~P2P_ALLOW_CROSS_CONNECTION;
|
|
|
#endif /* CONFIG_P2P_MANAGER */
|
|
|
- } else if (os_strcmp(buf, "disassoc_low_ack") == 0) {
|
|
|
- bss->disassoc_low_ack = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "tdls_prohibit") == 0) {
|
|
|
- int val = atoi(pos);
|
|
|
- if (val)
|
|
|
- bss->tdls |= TDLS_PROHIBIT;
|
|
|
- else
|
|
|
- bss->tdls &= ~TDLS_PROHIBIT;
|
|
|
- } else if (os_strcmp(buf, "tdls_prohibit_chan_switch") == 0) {
|
|
|
- int val = atoi(pos);
|
|
|
- if (val)
|
|
|
- bss->tdls |= TDLS_PROHIBIT_CHAN_SWITCH;
|
|
|
- else
|
|
|
- bss->tdls &= ~TDLS_PROHIBIT_CHAN_SWITCH;
|
|
|
+ } else if (os_strcmp(buf, "disassoc_low_ack") == 0) {
|
|
|
+ bss->disassoc_low_ack = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "tdls_prohibit") == 0) {
|
|
|
+ int val = atoi(pos);
|
|
|
+ if (val)
|
|
|
+ bss->tdls |= TDLS_PROHIBIT;
|
|
|
+ else
|
|
|
+ bss->tdls &= ~TDLS_PROHIBIT;
|
|
|
+ } else if (os_strcmp(buf, "tdls_prohibit_chan_switch") == 0) {
|
|
|
+ int val = atoi(pos);
|
|
|
+ if (val)
|
|
|
+ bss->tdls |= TDLS_PROHIBIT_CHAN_SWITCH;
|
|
|
+ else
|
|
|
+ bss->tdls &= ~TDLS_PROHIBIT_CHAN_SWITCH;
|
|
|
#ifdef CONFIG_RSN_TESTING
|
|
|
- } else if (os_strcmp(buf, "rsn_testing") == 0) {
|
|
|
- extern int rsn_testing;
|
|
|
- rsn_testing = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "rsn_testing") == 0) {
|
|
|
+ extern int rsn_testing;
|
|
|
+ rsn_testing = atoi(pos);
|
|
|
#endif /* CONFIG_RSN_TESTING */
|
|
|
- } else if (os_strcmp(buf, "time_advertisement") == 0) {
|
|
|
- bss->time_advertisement = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "time_zone") == 0) {
|
|
|
- size_t tz_len = os_strlen(pos);
|
|
|
- if (tz_len < 4 || tz_len > 255) {
|
|
|
- wpa_printf(MSG_DEBUG, "Line %d: invalid "
|
|
|
- "time_zone", line);
|
|
|
- errors++;
|
|
|
- return errors;
|
|
|
- }
|
|
|
- os_free(bss->time_zone);
|
|
|
- bss->time_zone = os_strdup(pos);
|
|
|
- if (bss->time_zone == NULL)
|
|
|
- errors++;
|
|
|
+ } else if (os_strcmp(buf, "time_advertisement") == 0) {
|
|
|
+ bss->time_advertisement = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "time_zone") == 0) {
|
|
|
+ size_t tz_len = os_strlen(pos);
|
|
|
+ if (tz_len < 4 || tz_len > 255) {
|
|
|
+ wpa_printf(MSG_DEBUG, "Line %d: invalid time_zone",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ return errors;
|
|
|
+ }
|
|
|
+ os_free(bss->time_zone);
|
|
|
+ bss->time_zone = os_strdup(pos);
|
|
|
+ if (bss->time_zone == NULL)
|
|
|
+ errors++;
|
|
|
#ifdef CONFIG_WNM
|
|
|
- } else if (os_strcmp(buf, "wnm_sleep_mode") == 0) {
|
|
|
- bss->wnm_sleep_mode = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "bss_transition") == 0) {
|
|
|
- bss->bss_transition = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "wnm_sleep_mode") == 0) {
|
|
|
+ bss->wnm_sleep_mode = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "bss_transition") == 0) {
|
|
|
+ bss->bss_transition = atoi(pos);
|
|
|
#endif /* CONFIG_WNM */
|
|
|
#ifdef CONFIG_INTERWORKING
|
|
|
- } else if (os_strcmp(buf, "interworking") == 0) {
|
|
|
- bss->interworking = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "access_network_type") == 0) {
|
|
|
- bss->access_network_type = atoi(pos);
|
|
|
- if (bss->access_network_type < 0 ||
|
|
|
- bss->access_network_type > 15) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid "
|
|
|
- "access_network_type", line);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "internet") == 0) {
|
|
|
- bss->internet = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "asra") == 0) {
|
|
|
- bss->asra = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "esr") == 0) {
|
|
|
- bss->esr = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "uesa") == 0) {
|
|
|
- bss->uesa = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "venue_group") == 0) {
|
|
|
- bss->venue_group = atoi(pos);
|
|
|
- bss->venue_info_set = 1;
|
|
|
- } else if (os_strcmp(buf, "venue_type") == 0) {
|
|
|
- bss->venue_type = atoi(pos);
|
|
|
- bss->venue_info_set = 1;
|
|
|
- } else if (os_strcmp(buf, "hessid") == 0) {
|
|
|
- if (hwaddr_aton(pos, bss->hessid)) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: invalid "
|
|
|
- "hessid", line);
|
|
|
- errors++;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "roaming_consortium") == 0) {
|
|
|
- if (parse_roaming_consortium(bss, pos, line) < 0)
|
|
|
- errors++;
|
|
|
- } else if (os_strcmp(buf, "venue_name") == 0) {
|
|
|
- if (parse_venue_name(bss, pos, line) < 0)
|
|
|
- errors++;
|
|
|
- } else if (os_strcmp(buf, "network_auth_type") == 0) {
|
|
|
- u8 auth_type;
|
|
|
- u16 redirect_url_len;
|
|
|
- if (hexstr2bin(pos, &auth_type, 1)) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: Invalid "
|
|
|
- "network_auth_type '%s'",
|
|
|
- line, pos);
|
|
|
- errors++;
|
|
|
- return errors;
|
|
|
- }
|
|
|
- if (auth_type == 0 || auth_type == 2)
|
|
|
- redirect_url_len = os_strlen(pos + 2);
|
|
|
- else
|
|
|
- redirect_url_len = 0;
|
|
|
- os_free(bss->network_auth_type);
|
|
|
- bss->network_auth_type =
|
|
|
- os_malloc(redirect_url_len + 3 + 1);
|
|
|
- if (bss->network_auth_type == NULL) {
|
|
|
- errors++;
|
|
|
- return errors;
|
|
|
- }
|
|
|
- *bss->network_auth_type = auth_type;
|
|
|
- WPA_PUT_LE16(bss->network_auth_type + 1,
|
|
|
- redirect_url_len);
|
|
|
- if (redirect_url_len)
|
|
|
- os_memcpy(bss->network_auth_type + 3,
|
|
|
- pos + 2, redirect_url_len);
|
|
|
- bss->network_auth_type_len = 3 + redirect_url_len;
|
|
|
- } else if (os_strcmp(buf, "ipaddr_type_availability") == 0) {
|
|
|
- if (hexstr2bin(pos, &bss->ipaddr_type_availability, 1))
|
|
|
- {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: Invalid "
|
|
|
- "ipaddr_type_availability '%s'",
|
|
|
- line, pos);
|
|
|
- bss->ipaddr_type_configured = 0;
|
|
|
- errors++;
|
|
|
- return errors;
|
|
|
- }
|
|
|
- bss->ipaddr_type_configured = 1;
|
|
|
+ } else if (os_strcmp(buf, "interworking") == 0) {
|
|
|
+ bss->interworking = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "access_network_type") == 0) {
|
|
|
+ bss->access_network_type = atoi(pos);
|
|
|
+ if (bss->access_network_type < 0 ||
|
|
|
+ bss->access_network_type > 15) {
|
|
|
+ wpa_printf(MSG_ERROR,
|
|
|
+ "Line %d: invalid access_network_type",
|
|
|
+ line);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "internet") == 0) {
|
|
|
+ bss->internet = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "asra") == 0) {
|
|
|
+ bss->asra = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "esr") == 0) {
|
|
|
+ bss->esr = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "uesa") == 0) {
|
|
|
+ bss->uesa = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "venue_group") == 0) {
|
|
|
+ bss->venue_group = atoi(pos);
|
|
|
+ bss->venue_info_set = 1;
|
|
|
+ } else if (os_strcmp(buf, "venue_type") == 0) {
|
|
|
+ bss->venue_type = atoi(pos);
|
|
|
+ bss->venue_info_set = 1;
|
|
|
+ } else if (os_strcmp(buf, "hessid") == 0) {
|
|
|
+ if (hwaddr_aton(pos, bss->hessid)) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: invalid hessid", line);
|
|
|
+ errors++;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "roaming_consortium") == 0) {
|
|
|
+ if (parse_roaming_consortium(bss, pos, line) < 0)
|
|
|
+ errors++;
|
|
|
+ } else if (os_strcmp(buf, "venue_name") == 0) {
|
|
|
+ if (parse_venue_name(bss, pos, line) < 0)
|
|
|
+ errors++;
|
|
|
+ } else if (os_strcmp(buf, "network_auth_type") == 0) {
|
|
|
+ u8 auth_type;
|
|
|
+ u16 redirect_url_len;
|
|
|
+ if (hexstr2bin(pos, &auth_type, 1)) {
|
|
|
+ wpa_printf(MSG_ERROR,
|
|
|
+ "Line %d: Invalid network_auth_type '%s'",
|
|
|
+ line, pos);
|
|
|
+ errors++;
|
|
|
+ return errors;
|
|
|
+ }
|
|
|
+ if (auth_type == 0 || auth_type == 2)
|
|
|
+ redirect_url_len = os_strlen(pos + 2);
|
|
|
+ else
|
|
|
+ redirect_url_len = 0;
|
|
|
+ os_free(bss->network_auth_type);
|
|
|
+ bss->network_auth_type = os_malloc(redirect_url_len + 3 + 1);
|
|
|
+ if (bss->network_auth_type == NULL) {
|
|
|
+ errors++;
|
|
|
+ return errors;
|
|
|
+ }
|
|
|
+ *bss->network_auth_type = auth_type;
|
|
|
+ WPA_PUT_LE16(bss->network_auth_type + 1, redirect_url_len);
|
|
|
+ if (redirect_url_len)
|
|
|
+ os_memcpy(bss->network_auth_type + 3, pos + 2,
|
|
|
+ redirect_url_len);
|
|
|
+ bss->network_auth_type_len = 3 + redirect_url_len;
|
|
|
+ } else if (os_strcmp(buf, "ipaddr_type_availability") == 0) {
|
|
|
+ if (hexstr2bin(pos, &bss->ipaddr_type_availability, 1)) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: Invalid ipaddr_type_availability '%s'",
|
|
|
+ line, pos);
|
|
|
+ bss->ipaddr_type_configured = 0;
|
|
|
+ errors++;
|
|
|
+ return errors;
|
|
|
+ }
|
|
|
+ bss->ipaddr_type_configured = 1;
|
|
|
} else if (os_strcmp(buf, "domain_name") == 0) {
|
|
|
- int j, num_domains, domain_len, domain_list_len = 0;
|
|
|
- char *tok_start, *tok_prev;
|
|
|
- u8 *domain_list, *domain_ptr;
|
|
|
+ int j, num_domains, domain_len, domain_list_len = 0;
|
|
|
+ char *tok_start, *tok_prev;
|
|
|
+ u8 *domain_list, *domain_ptr;
|
|
|
|
|
|
- domain_list_len = os_strlen(pos) + 1;
|
|
|
- domain_list = os_malloc(domain_list_len);
|
|
|
- if (domain_list == NULL) {
|
|
|
- errors++;
|
|
|
- return errors;
|
|
|
- }
|
|
|
+ domain_list_len = os_strlen(pos) + 1;
|
|
|
+ domain_list = os_malloc(domain_list_len);
|
|
|
+ if (domain_list == NULL) {
|
|
|
+ errors++;
|
|
|
+ return errors;
|
|
|
+ }
|
|
|
|
|
|
- domain_ptr = domain_list;
|
|
|
- tok_prev = pos;
|
|
|
- num_domains = 1;
|
|
|
- while ((tok_prev = os_strchr(tok_prev, ','))) {
|
|
|
- num_domains++;
|
|
|
- tok_prev++;
|
|
|
- }
|
|
|
- tok_prev = pos;
|
|
|
- for (j = 0; j < num_domains; j++) {
|
|
|
- tok_start = os_strchr(tok_prev, ',');
|
|
|
- if (tok_start) {
|
|
|
- domain_len = tok_start - tok_prev;
|
|
|
- *domain_ptr = domain_len;
|
|
|
- os_memcpy(domain_ptr + 1, tok_prev,
|
|
|
- domain_len);
|
|
|
- domain_ptr += domain_len + 1;
|
|
|
- tok_prev = ++tok_start;
|
|
|
- } else {
|
|
|
- domain_len = os_strlen(tok_prev);
|
|
|
- *domain_ptr = domain_len;
|
|
|
- os_memcpy(domain_ptr + 1, tok_prev,
|
|
|
- domain_len);
|
|
|
- domain_ptr += domain_len + 1;
|
|
|
- }
|
|
|
+ domain_ptr = domain_list;
|
|
|
+ tok_prev = pos;
|
|
|
+ num_domains = 1;
|
|
|
+ while ((tok_prev = os_strchr(tok_prev, ','))) {
|
|
|
+ num_domains++;
|
|
|
+ tok_prev++;
|
|
|
+ }
|
|
|
+ tok_prev = pos;
|
|
|
+ for (j = 0; j < num_domains; j++) {
|
|
|
+ tok_start = os_strchr(tok_prev, ',');
|
|
|
+ if (tok_start) {
|
|
|
+ domain_len = tok_start - tok_prev;
|
|
|
+ *domain_ptr = domain_len;
|
|
|
+ os_memcpy(domain_ptr + 1, tok_prev, domain_len);
|
|
|
+ domain_ptr += domain_len + 1;
|
|
|
+ tok_prev = ++tok_start;
|
|
|
+ } else {
|
|
|
+ domain_len = os_strlen(tok_prev);
|
|
|
+ *domain_ptr = domain_len;
|
|
|
+ os_memcpy(domain_ptr + 1, tok_prev, domain_len);
|
|
|
+ domain_ptr += domain_len + 1;
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- os_free(bss->domain_name);
|
|
|
- bss->domain_name = domain_list;
|
|
|
- bss->domain_name_len = domain_list_len;
|
|
|
- } else if (os_strcmp(buf, "anqp_3gpp_cell_net") == 0) {
|
|
|
- if (parse_3gpp_cell_net(bss, pos, line) < 0)
|
|
|
- errors++;
|
|
|
- } else if (os_strcmp(buf, "nai_realm") == 0) {
|
|
|
- if (parse_nai_realm(bss, pos, line) < 0)
|
|
|
- errors++;
|
|
|
- } else if (os_strcmp(buf, "gas_frag_limit") == 0) {
|
|
|
- bss->gas_frag_limit = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "gas_comeback_delay") == 0) {
|
|
|
- bss->gas_comeback_delay = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "qos_map_set") == 0) {
|
|
|
- if (parse_qos_map_set(bss, pos, line) < 0)
|
|
|
- errors++;
|
|
|
+ os_free(bss->domain_name);
|
|
|
+ bss->domain_name = domain_list;
|
|
|
+ bss->domain_name_len = domain_list_len;
|
|
|
+ } else if (os_strcmp(buf, "anqp_3gpp_cell_net") == 0) {
|
|
|
+ if (parse_3gpp_cell_net(bss, pos, line) < 0)
|
|
|
+ errors++;
|
|
|
+ } else if (os_strcmp(buf, "nai_realm") == 0) {
|
|
|
+ if (parse_nai_realm(bss, pos, line) < 0)
|
|
|
+ errors++;
|
|
|
+ } else if (os_strcmp(buf, "gas_frag_limit") == 0) {
|
|
|
+ bss->gas_frag_limit = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "gas_comeback_delay") == 0) {
|
|
|
+ bss->gas_comeback_delay = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "qos_map_set") == 0) {
|
|
|
+ if (parse_qos_map_set(bss, pos, line) < 0)
|
|
|
+ errors++;
|
|
|
#endif /* CONFIG_INTERWORKING */
|
|
|
#ifdef CONFIG_RADIUS_TEST
|
|
|
- } else if (os_strcmp(buf, "dump_msk_file") == 0) {
|
|
|
- os_free(bss->dump_msk_file);
|
|
|
- bss->dump_msk_file = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "dump_msk_file") == 0) {
|
|
|
+ os_free(bss->dump_msk_file);
|
|
|
+ bss->dump_msk_file = os_strdup(pos);
|
|
|
#endif /* CONFIG_RADIUS_TEST */
|
|
|
#ifdef CONFIG_HS20
|
|
|
- } else if (os_strcmp(buf, "hs20") == 0) {
|
|
|
- bss->hs20 = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "disable_dgaf") == 0) {
|
|
|
- bss->disable_dgaf = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "osen") == 0) {
|
|
|
- bss->osen = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "anqp_domain_id") == 0) {
|
|
|
- bss->anqp_domain_id = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "hs20_deauth_req_timeout") == 0) {
|
|
|
- bss->hs20_deauth_req_timeout = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "hs20_oper_friendly_name") == 0) {
|
|
|
- if (hs20_parse_oper_friendly_name(bss, pos, line) < 0)
|
|
|
- errors++;
|
|
|
- } else if (os_strcmp(buf, "hs20_wan_metrics") == 0) {
|
|
|
- if (hs20_parse_wan_metrics(bss, pos, line) < 0) {
|
|
|
- errors++;
|
|
|
- return errors;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "hs20_conn_capab") == 0) {
|
|
|
- if (hs20_parse_conn_capab(bss, pos, line) < 0) {
|
|
|
- errors++;
|
|
|
- return errors;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "hs20_operating_class") == 0) {
|
|
|
- u8 *oper_class;
|
|
|
- size_t oper_class_len;
|
|
|
- oper_class_len = os_strlen(pos);
|
|
|
- if (oper_class_len < 2 || (oper_class_len & 0x01)) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: Invalid "
|
|
|
- "hs20_operating_class '%s'",
|
|
|
- line, pos);
|
|
|
- errors++;
|
|
|
- return errors;
|
|
|
- }
|
|
|
- oper_class_len /= 2;
|
|
|
- oper_class = os_malloc(oper_class_len);
|
|
|
- if (oper_class == NULL) {
|
|
|
- errors++;
|
|
|
- return errors;
|
|
|
- }
|
|
|
- if (hexstr2bin(pos, oper_class, oper_class_len)) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: Invalid "
|
|
|
- "hs20_operating_class '%s'",
|
|
|
- line, pos);
|
|
|
- os_free(oper_class);
|
|
|
- errors++;
|
|
|
- return errors;
|
|
|
- }
|
|
|
- os_free(bss->hs20_operating_class);
|
|
|
- bss->hs20_operating_class = oper_class;
|
|
|
- bss->hs20_operating_class_len = oper_class_len;
|
|
|
- } else if (os_strcmp(buf, "hs20_icon") == 0) {
|
|
|
- if (hs20_parse_icon(bss, pos) < 0) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: Invalid "
|
|
|
- "hs20_icon '%s'", line, pos);
|
|
|
- errors++;
|
|
|
- return errors;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "osu_ssid") == 0) {
|
|
|
- if (hs20_parse_osu_ssid(bss, pos, line) < 0)
|
|
|
- errors++;
|
|
|
- } else if (os_strcmp(buf, "osu_server_uri") == 0) {
|
|
|
- if (hs20_parse_osu_server_uri(bss, pos, line) < 0)
|
|
|
- errors++;
|
|
|
- } else if (os_strcmp(buf, "osu_friendly_name") == 0) {
|
|
|
- if (hs20_parse_osu_friendly_name(bss, pos, line) < 0)
|
|
|
- errors++;
|
|
|
- } else if (os_strcmp(buf, "osu_nai") == 0) {
|
|
|
- if (hs20_parse_osu_nai(bss, pos, line) < 0)
|
|
|
- errors++;
|
|
|
- } else if (os_strcmp(buf, "osu_method_list") == 0) {
|
|
|
- if (hs20_parse_osu_method_list(bss, pos, line) < 0)
|
|
|
- errors++;
|
|
|
- } else if (os_strcmp(buf, "osu_icon") == 0) {
|
|
|
- if (hs20_parse_osu_icon(bss, pos, line) < 0)
|
|
|
- errors++;
|
|
|
- } else if (os_strcmp(buf, "osu_service_desc") == 0) {
|
|
|
- if (hs20_parse_osu_service_desc(bss, pos, line) < 0)
|
|
|
- errors++;
|
|
|
- } else if (os_strcmp(buf, "subscr_remediation_url") == 0) {
|
|
|
- os_free(bss->subscr_remediation_url);
|
|
|
- bss->subscr_remediation_url = os_strdup(pos);
|
|
|
- } else if (os_strcmp(buf, "subscr_remediation_method") == 0) {
|
|
|
- bss->subscr_remediation_method = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "hs20") == 0) {
|
|
|
+ bss->hs20 = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "disable_dgaf") == 0) {
|
|
|
+ bss->disable_dgaf = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "osen") == 0) {
|
|
|
+ bss->osen = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "anqp_domain_id") == 0) {
|
|
|
+ bss->anqp_domain_id = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "hs20_deauth_req_timeout") == 0) {
|
|
|
+ bss->hs20_deauth_req_timeout = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "hs20_oper_friendly_name") == 0) {
|
|
|
+ if (hs20_parse_oper_friendly_name(bss, pos, line) < 0)
|
|
|
+ errors++;
|
|
|
+ } else if (os_strcmp(buf, "hs20_wan_metrics") == 0) {
|
|
|
+ if (hs20_parse_wan_metrics(bss, pos, line) < 0) {
|
|
|
+ errors++;
|
|
|
+ return errors;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "hs20_conn_capab") == 0) {
|
|
|
+ if (hs20_parse_conn_capab(bss, pos, line) < 0) {
|
|
|
+ errors++;
|
|
|
+ return errors;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "hs20_operating_class") == 0) {
|
|
|
+ u8 *oper_class;
|
|
|
+ size_t oper_class_len;
|
|
|
+ oper_class_len = os_strlen(pos);
|
|
|
+ if (oper_class_len < 2 || (oper_class_len & 0x01)) {
|
|
|
+ wpa_printf(MSG_ERROR,
|
|
|
+ "Line %d: Invalid hs20_operating_class '%s'",
|
|
|
+ line, pos);
|
|
|
+ errors++;
|
|
|
+ return errors;
|
|
|
+ }
|
|
|
+ oper_class_len /= 2;
|
|
|
+ oper_class = os_malloc(oper_class_len);
|
|
|
+ if (oper_class == NULL) {
|
|
|
+ errors++;
|
|
|
+ return errors;
|
|
|
+ }
|
|
|
+ if (hexstr2bin(pos, oper_class, oper_class_len)) {
|
|
|
+ wpa_printf(MSG_ERROR,
|
|
|
+ "Line %d: Invalid hs20_operating_class '%s'",
|
|
|
+ line, pos);
|
|
|
+ os_free(oper_class);
|
|
|
+ errors++;
|
|
|
+ return errors;
|
|
|
+ }
|
|
|
+ os_free(bss->hs20_operating_class);
|
|
|
+ bss->hs20_operating_class = oper_class;
|
|
|
+ bss->hs20_operating_class_len = oper_class_len;
|
|
|
+ } else if (os_strcmp(buf, "hs20_icon") == 0) {
|
|
|
+ if (hs20_parse_icon(bss, pos) < 0) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: Invalid hs20_icon '%s'",
|
|
|
+ line, pos);
|
|
|
+ errors++;
|
|
|
+ return errors;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "osu_ssid") == 0) {
|
|
|
+ if (hs20_parse_osu_ssid(bss, pos, line) < 0)
|
|
|
+ errors++;
|
|
|
+ } else if (os_strcmp(buf, "osu_server_uri") == 0) {
|
|
|
+ if (hs20_parse_osu_server_uri(bss, pos, line) < 0)
|
|
|
+ errors++;
|
|
|
+ } else if (os_strcmp(buf, "osu_friendly_name") == 0) {
|
|
|
+ if (hs20_parse_osu_friendly_name(bss, pos, line) < 0)
|
|
|
+ errors++;
|
|
|
+ } else if (os_strcmp(buf, "osu_nai") == 0) {
|
|
|
+ if (hs20_parse_osu_nai(bss, pos, line) < 0)
|
|
|
+ errors++;
|
|
|
+ } else if (os_strcmp(buf, "osu_method_list") == 0) {
|
|
|
+ if (hs20_parse_osu_method_list(bss, pos, line) < 0)
|
|
|
+ errors++;
|
|
|
+ } else if (os_strcmp(buf, "osu_icon") == 0) {
|
|
|
+ if (hs20_parse_osu_icon(bss, pos, line) < 0)
|
|
|
+ errors++;
|
|
|
+ } else if (os_strcmp(buf, "osu_service_desc") == 0) {
|
|
|
+ if (hs20_parse_osu_service_desc(bss, pos, line) < 0)
|
|
|
+ errors++;
|
|
|
+ } else if (os_strcmp(buf, "subscr_remediation_url") == 0) {
|
|
|
+ os_free(bss->subscr_remediation_url);
|
|
|
+ bss->subscr_remediation_url = os_strdup(pos);
|
|
|
+ } else if (os_strcmp(buf, "subscr_remediation_method") == 0) {
|
|
|
+ bss->subscr_remediation_method = atoi(pos);
|
|
|
#endif /* CONFIG_HS20 */
|
|
|
#ifdef CONFIG_TESTING_OPTIONS
|
|
|
-#define PARSE_TEST_PROBABILITY(_val) \
|
|
|
- } else if (os_strcmp(buf, #_val) == 0) { \
|
|
|
- char *end; \
|
|
|
- \
|
|
|
- conf->_val = strtod(pos, &end); \
|
|
|
- if (*end || conf->_val < 0.0d || \
|
|
|
- conf->_val > 1.0d) { \
|
|
|
- wpa_printf(MSG_ERROR, \
|
|
|
- "Line %d: Invalid value '%s'", \
|
|
|
- line, pos); \
|
|
|
- errors++; \
|
|
|
- return errors; \
|
|
|
- }
|
|
|
- PARSE_TEST_PROBABILITY(ignore_probe_probability)
|
|
|
- PARSE_TEST_PROBABILITY(ignore_auth_probability)
|
|
|
- PARSE_TEST_PROBABILITY(ignore_assoc_probability)
|
|
|
- PARSE_TEST_PROBABILITY(ignore_reassoc_probability)
|
|
|
- PARSE_TEST_PROBABILITY(corrupt_gtk_rekey_mic_probability)
|
|
|
- } else if (os_strcmp(buf, "bss_load_test") == 0) {
|
|
|
- WPA_PUT_LE16(bss->bss_load_test, atoi(pos));
|
|
|
- pos = os_strchr(pos, ':');
|
|
|
- if (pos == NULL) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: Invalid "
|
|
|
- "bss_load_test", line);
|
|
|
- return 1;
|
|
|
- }
|
|
|
- pos++;
|
|
|
- bss->bss_load_test[2] = atoi(pos);
|
|
|
- pos = os_strchr(pos, ':');
|
|
|
- if (pos == NULL) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: Invalid "
|
|
|
- "bss_load_test", line);
|
|
|
- return 1;
|
|
|
- }
|
|
|
- pos++;
|
|
|
- WPA_PUT_LE16(&bss->bss_load_test[3], atoi(pos));
|
|
|
- bss->bss_load_test_set = 1;
|
|
|
+#define PARSE_TEST_PROBABILITY(_val) \
|
|
|
+ } else if (os_strcmp(buf, #_val) == 0) { \
|
|
|
+ char *end; \
|
|
|
+ \
|
|
|
+ conf->_val = strtod(pos, &end); \
|
|
|
+ if (*end || conf->_val < 0.0d || \
|
|
|
+ conf->_val > 1.0d) { \
|
|
|
+ wpa_printf(MSG_ERROR, \
|
|
|
+ "Line %d: Invalid value '%s'", \
|
|
|
+ line, pos); \
|
|
|
+ errors++; \
|
|
|
+ return errors; \
|
|
|
+ }
|
|
|
+ PARSE_TEST_PROBABILITY(ignore_probe_probability)
|
|
|
+ PARSE_TEST_PROBABILITY(ignore_auth_probability)
|
|
|
+ PARSE_TEST_PROBABILITY(ignore_assoc_probability)
|
|
|
+ PARSE_TEST_PROBABILITY(ignore_reassoc_probability)
|
|
|
+ PARSE_TEST_PROBABILITY(corrupt_gtk_rekey_mic_probability)
|
|
|
+ } else if (os_strcmp(buf, "bss_load_test") == 0) {
|
|
|
+ WPA_PUT_LE16(bss->bss_load_test, atoi(pos));
|
|
|
+ pos = os_strchr(pos, ':');
|
|
|
+ if (pos == NULL) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: Invalid bss_load_test",
|
|
|
+ line);
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ pos++;
|
|
|
+ bss->bss_load_test[2] = atoi(pos);
|
|
|
+ pos = os_strchr(pos, ':');
|
|
|
+ if (pos == NULL) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: Invalid bss_load_test",
|
|
|
+ line);
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ pos++;
|
|
|
+ WPA_PUT_LE16(&bss->bss_load_test[3], atoi(pos));
|
|
|
+ bss->bss_load_test_set = 1;
|
|
|
#endif /* CONFIG_TESTING_OPTIONS */
|
|
|
- } else if (os_strcmp(buf, "vendor_elements") == 0) {
|
|
|
- struct wpabuf *elems;
|
|
|
- size_t len = os_strlen(pos);
|
|
|
- if (len & 0x01) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: Invalid "
|
|
|
- "vendor_elements '%s'", line, pos);
|
|
|
- return 1;
|
|
|
- }
|
|
|
- len /= 2;
|
|
|
- if (len == 0) {
|
|
|
- wpabuf_free(bss->vendor_elements);
|
|
|
- bss->vendor_elements = NULL;
|
|
|
- return 0;
|
|
|
- }
|
|
|
+ } else if (os_strcmp(buf, "vendor_elements") == 0) {
|
|
|
+ struct wpabuf *elems;
|
|
|
+ size_t len = os_strlen(pos);
|
|
|
+ if (len & 0x01) {
|
|
|
+ wpa_printf(MSG_ERROR,
|
|
|
+ "Line %d: Invalid vendor_elements '%s'",
|
|
|
+ line, pos);
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ len /= 2;
|
|
|
+ if (len == 0) {
|
|
|
+ wpabuf_free(bss->vendor_elements);
|
|
|
+ bss->vendor_elements = NULL;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
|
|
|
- elems = wpabuf_alloc(len);
|
|
|
- if (elems == NULL)
|
|
|
- return 1;
|
|
|
+ elems = wpabuf_alloc(len);
|
|
|
+ if (elems == NULL)
|
|
|
+ return 1;
|
|
|
|
|
|
- if (hexstr2bin(pos, wpabuf_put(elems, len), len)) {
|
|
|
- wpabuf_free(elems);
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: Invalid "
|
|
|
- "vendor_elements '%s'", line, pos);
|
|
|
- return 1;
|
|
|
- }
|
|
|
+ if (hexstr2bin(pos, wpabuf_put(elems, len), len)) {
|
|
|
+ wpabuf_free(elems);
|
|
|
+ wpa_printf(MSG_ERROR,
|
|
|
+ "Line %d: Invalid vendor_elements '%s'",
|
|
|
+ line, pos);
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
|
|
|
- wpabuf_free(bss->vendor_elements);
|
|
|
- bss->vendor_elements = elems;
|
|
|
- } else if (os_strcmp(buf, "sae_anti_clogging_threshold") == 0) {
|
|
|
- bss->sae_anti_clogging_threshold = atoi(pos);
|
|
|
- } else if (os_strcmp(buf, "sae_groups") == 0) {
|
|
|
- if (hostapd_parse_intlist(&bss->sae_groups, pos)) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: Invalid "
|
|
|
- "sae_groups value '%s'", line, pos);
|
|
|
- return 1;
|
|
|
- }
|
|
|
- } else if (os_strcmp(buf, "local_pwr_constraint") == 0) {
|
|
|
- int val = atoi(pos);
|
|
|
- if (val < 0 || val > 255) {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: Invalid local_pwr_constraint %d (expected 0..255)",
|
|
|
- line, val);
|
|
|
- return 1;
|
|
|
- }
|
|
|
- conf->local_pwr_constraint = val;
|
|
|
- } else if (os_strcmp(buf, "spectrum_mgmt_required") == 0) {
|
|
|
- conf->spectrum_mgmt_required = atoi(pos);
|
|
|
- } else {
|
|
|
- wpa_printf(MSG_ERROR, "Line %d: unknown configuration "
|
|
|
- "item '%s'", line, buf);
|
|
|
- errors++;
|
|
|
+ wpabuf_free(bss->vendor_elements);
|
|
|
+ bss->vendor_elements = elems;
|
|
|
+ } else if (os_strcmp(buf, "sae_anti_clogging_threshold") == 0) {
|
|
|
+ bss->sae_anti_clogging_threshold = atoi(pos);
|
|
|
+ } else if (os_strcmp(buf, "sae_groups") == 0) {
|
|
|
+ if (hostapd_parse_intlist(&bss->sae_groups, pos)) {
|
|
|
+ wpa_printf(MSG_ERROR,
|
|
|
+ "Line %d: Invalid sae_groups value '%s'",
|
|
|
+ line, pos);
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ } else if (os_strcmp(buf, "local_pwr_constraint") == 0) {
|
|
|
+ int val = atoi(pos);
|
|
|
+ if (val < 0 || val > 255) {
|
|
|
+ wpa_printf(MSG_ERROR, "Line %d: Invalid local_pwr_constraint %d (expected 0..255)",
|
|
|
+ line, val);
|
|
|
+ return 1;
|
|
|
}
|
|
|
+ conf->local_pwr_constraint = val;
|
|
|
+ } else if (os_strcmp(buf, "spectrum_mgmt_required") == 0) {
|
|
|
+ conf->spectrum_mgmt_required = atoi(pos);
|
|
|
+ } else {
|
|
|
+ wpa_printf(MSG_ERROR,
|
|
|
+ "Line %d: unknown configuration item '%s'",
|
|
|
+ line, buf);
|
|
|
+ errors++;
|
|
|
}
|
|
|
|
|
|
return errors;
|