/*
* hostapd / Configuration file
- * Copyright (c) 2003-2007, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2003-2008, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2007-2008, Intel Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
bss->eapol_version = EAPOL_VERSION;
bss->max_listen_interval = 65535;
+
+#ifdef CONFIG_IEEE80211W
+ bss->assoc_ping_timeout = 1000;
+ bss->assoc_ping_attempts = 3;
+#endif /* CONFIG_IEEE80211W */
+#ifdef EAP_FAST
+ /* both anonymous and authenticated provisioning */
+ bss->eap_fast_prov = 3;
+ bss->pac_key_lifetime = 7 * 24 * 60 * 60;
+ bss->pac_key_refresh_time = 1 * 24 * 60 * 60;
+#endif /* EAP_FAST */
}
conf->wme_ac_params[2] = ac_vi;
conf->wme_ac_params[3] = ac_vo;
+#ifdef CONFIG_IEEE80211N
+ SET_2BIT_LE16(&conf->ht_capab,
+ HT_CAP_INFO_MIMO_PWR_SAVE_OFFSET,
+ MIMO_PWR_NO_LIMIT_ON_MIMO_SEQS);
+
+ conf->ht_capab |= HT_CAP_INFO_GREEN_FIELD;
+#endif /* CONFIG_IEEE80211N */
+
return conf;
}
}
-static int hostapd_config_read_maclist(const char *fname, macaddr **acl,
- int *num)
+static int hostapd_acl_comp(const void *a, const void *b)
+{
+ const struct mac_acl_entry *aa = a;
+ const struct mac_acl_entry *bb = b;
+ return os_memcmp(aa->addr, bb->addr, sizeof(macaddr));
+}
+
+
+static int hostapd_config_read_maclist(const char *fname,
+ struct mac_acl_entry **acl, int *num)
{
FILE *f;
char buf[128], *pos;
int line = 0;
u8 addr[ETH_ALEN];
- macaddr *newacl;
+ struct mac_acl_entry *newacl;
+ int vlan_id;
if (!fname)
return 0;
return -1;
}
- newacl = os_realloc(*acl, (*num + 1) * ETH_ALEN);
+ vlan_id = 0;
+ pos = buf;
+ while (*pos != '\0' && *pos != ' ' && *pos != '\t')
+ pos++;
+ while (*pos == ' ' || *pos == '\t')
+ pos++;
+ if (*pos != '\0')
+ vlan_id = atoi(pos);
+
+ newacl = os_realloc(*acl, (*num + 1) * sizeof(**acl));
if (newacl == NULL) {
printf("MAC list reallocation failed\n");
fclose(f);
}
*acl = newacl;
- os_memcpy((*acl)[*num], addr, ETH_ALEN);
+ os_memcpy((*acl)[*num].addr, addr, ETH_ALEN);
+ (*acl)[*num].vlan_id = vlan_id;
(*num)++;
}
fclose(f);
- qsort(*acl, *num, sizeof(macaddr), hostapd_mac_comp);
+ qsort(*acl, *num, sizeof(**acl), hostapd_acl_comp);
return 0;
}
else if (os_strcmp(start, "FT-EAP") == 0)
val |= WPA_KEY_MGMT_FT_IEEE8021X;
#endif /* CONFIG_IEEE80211R */
+#ifdef CONFIG_IEEE80211W
+ else if (os_strcmp(start, "WPA-PSK-SHA256") == 0)
+ val |= WPA_KEY_MGMT_PSK_SHA256;
+ else if (os_strcmp(start, "WPA-EAP-SHA256") == 0)
+ val |= WPA_KEY_MGMT_IEEE8021X_SHA256;
+#endif /* CONFIG_IEEE80211W */
else {
printf("Line %d: invalid key_mgmt '%s'\n",
line, start);
errors++;
}
} else if (os_strcmp(buf, "eap_fast_a_id") == 0) {
- os_free(bss->eap_fast_a_id);
- bss->eap_fast_a_id = os_strdup(pos);
+ size_t idlen = os_strlen(pos);
+ if (idlen & 1) {
+ printf("Line %d: Invalid eap_fast_a_id\n",
+ 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)) {
+ printf("Line %d: Failed to parse "
+ "eap_fast_a_id\n", 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);
#endif /* EAP_FAST */
#ifdef EAP_SIM
} else if (os_strcmp(buf, "eap_sim_db") == 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) {
printf("Line %d: invalid rate list\n", 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, "bridge_packets") == 0) {
#ifdef CONFIG_IEEE80211W
} else if (os_strcmp(buf, "ieee80211w") == 0) {
bss->ieee80211w = atoi(pos);
+ } else if (os_strcmp(buf, "assoc_ping_timeout") == 0) {
+ bss->assoc_ping_timeout = atoi(pos);
+ if (bss->assoc_ping_timeout == 0) {
+ printf("Line %d: invalid assoc_ping_timeout\n",
+ line);
+ errors++;
+ }
+ } else if (os_strcmp(buf, "assoc_ping_attempts") == 0) {
+ bss->assoc_ping_timeout = atoi(pos);
+ if (bss->assoc_ping_timeout == 0) {
+ printf("Line %d: invalid assoc_ping_attempts "
+ "(valid range: 1..255)\n",
+ line);
+ errors++;
+ }
#endif /* CONFIG_IEEE80211W */
+#ifdef CONFIG_IEEE80211N
+ } else if (os_strcmp(buf, "ieee80211n") == 0) {
+ conf->ieee80211n = atoi(pos);
+#endif /* CONFIG_IEEE80211N */
} else if (os_strcmp(buf, "max_listen_interval") == 0) {
bss->max_listen_interval = atoi(pos);
} else if (os_strcmp(buf, "okc") == 0) {
os_free(conf->dh_file);
os_free(conf->pac_opaque_encr_key);
os_free(conf->eap_fast_a_id);
+ os_free(conf->eap_fast_a_id_info);
os_free(conf->eap_sim_db);
os_free(conf->radius_server_clients);
os_free(conf->test_socket);
/* Perform a binary search for given MAC address from a pre-sorted list.
* Returns 1 if address is in the list or 0 if not. */
-int hostapd_maclist_found(macaddr *list, int num_entries, const u8 *addr)
+int hostapd_maclist_found(struct mac_acl_entry *list, int num_entries,
+ const u8 *addr, int *vlan_id)
{
int start, end, middle, res;
while (start <= end) {
middle = (start + end) / 2;
- res = os_memcmp(list[middle], addr, ETH_ALEN);
- if (res == 0)
+ res = os_memcmp(list[middle].addr, addr, ETH_ALEN);
+ if (res == 0) {
+ if (vlan_id)
+ *vlan_id = list[middle].vlan_id;
return 1;
+ }
if (res < 0)
start = middle + 1;
else