/*
* 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_IEEE80211N
-static int hostapd_config_defaults_bss_80211n(struct hostapd_bss_config *bss)
-{
- u16 capabilities_info = 0;
- u16 operation_mode = 0;
- if (bss == NULL)
- return -1;
-
- /* add default values to HT capabilities parameters */
- os_memset(&bss->ht_capabilities, 0, sizeof(struct ht_cap_ie));
- bss->ht_capabilities.id = WLAN_EID_HT_CAP;
- bss->ht_capabilities.length = HT_CAPABILITIES_LEN;
-
-#if 0 /* FIX: remove? was commented out */
- bss->ht_capabilities.mac_ht_param_info.max_rx_ampdu_factor =
- MAX_RX_AMPDU_FACTOR_64KB;
-#endif
- SET_2BIT_U8(&bss->ht_capabilities.data.mac_ht_params_info,
- MAC_HT_PARAM_INFO_MAX_RX_AMPDU_FACTOR_OFFSET,
- MAX_RX_AMPDU_FACTOR_64KB);
-
- SET_2BIT_LE16(&capabilities_info,
- HT_CAP_INFO_MIMO_PWR_SAVE_OFFSET,
- MIMO_PWR_NO_LIMIT_ON_MIMO_SEQS);
-
- capabilities_info |= HT_CAP_INFO_GREEN_FIELD;
-
- bss->ht_capabilities.data.capabilities_info =
- host_to_le16(capabilities_info);
-
- bss->ht_capabilities.data.supported_mcs_set[0] = 0xff;
- bss->ht_capabilities.data.supported_mcs_set[1] = 0xff;
-
- /* add default values to HT operation parameters */
- os_memset(&bss->ht_operation, 0, sizeof(struct ht_operation_ie));
- bss->ht_operation.id = WLAN_EID_HT_OPERATION;
- bss->ht_operation.length = HT_OPERATION_LEN;
- SET_2BIT_LE16(&operation_mode,
- HT_INFO_OPERATION_MODE_OP_MODE_OFFSET,
- OP_MODE_PURE);
- bss->ht_operation.data.operation_mode = host_to_le16(operation_mode);
-
- return 0;
+#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 */
}
-#endif /* CONFIG_IEEE80211N */
static struct hostapd_config * hostapd_config_defaults(void)
conf->wme_ac_params[3] = ac_vo;
#ifdef CONFIG_IEEE80211N
- hostapd_config_defaults_bss_80211n(bss);
+ 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);
} 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);
+ } 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) {
#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) {
- bss->ieee80211n = atoi(pos);
+ conf->ieee80211n = atoi(pos);
#endif /* CONFIG_IEEE80211N */
} else if (os_strcmp(buf, "max_listen_interval") == 0) {
bss->max_listen_interval = atoi(pos);
/* 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