Make maximum BSS table size configurable

New global configuration parameter bss_max_count can now be used to
change the maximum BSS table size. The old fixed size limit (200) is
used as the default value for this parameter.
This commit is contained in:
Jouni Malinen 2010-03-05 20:20:09 +02:00
parent ac26ebd8b5
commit c9c38b0996
6 changed files with 28 additions and 6 deletions

View File

@ -19,15 +19,12 @@
#include "common/ieee802_11_defs.h"
#include "drivers/driver.h"
#include "wpa_supplicant_i.h"
#include "config.h"
#include "notify.h"
#include "scan.h"
#include "bss.h"
#ifndef WPA_BSS_MAX_COUNT
#define WPA_BSS_MAX_COUNT 200
#endif /* WPA_BSS_MAX_COUNT */
/**
* WPA_BSS_EXPIRATION_PERIOD - Period of expiration run in seconds
*/
@ -139,7 +136,7 @@ static void wpa_bss_add(struct wpa_supplicant *wpa_s,
wpa_printf(MSG_DEBUG, "BSS: Add new id %u BSSID " MACSTR " SSID '%s'",
bss->id, MAC2STR(bss->bssid), wpa_ssid_txt(ssid, ssid_len));
wpas_notify_bss_added(wpa_s, bss->bssid, bss->id);
if (wpa_s->num_bss > WPA_BSS_MAX_COUNT) {
if (wpa_s->num_bss > wpa_s->conf->bss_max_count) {
/* Remove the oldest entry */
wpa_bss_remove(wpa_s, dl_list_first(&wpa_s->bss,
struct wpa_bss, list));

View File

@ -2086,6 +2086,7 @@ struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface,
config->eapol_version = DEFAULT_EAPOL_VERSION;
config->ap_scan = DEFAULT_AP_SCAN;
config->fast_reauth = DEFAULT_FAST_REAUTH;
config->bss_max_count = DEFAULT_BSS_MAX_COUNT;
if (ctrl_interface)
config->ctrl_interface = os_strdup(ctrl_interface);

View File

@ -22,6 +22,7 @@
#define DEFAULT_AP_SCAN 1
#endif /* CONFIG_NO_SCAN_PROCESSING */
#define DEFAULT_FAST_REAUTH 1
#define DEFAULT_BSS_MAX_COUNT 200
#include "config_ssid.h"
@ -331,6 +332,11 @@ struct wpa_config {
* ctrl_iface to external program(s)
*/
int wps_cred_processing;
/**
* bss_max_count - Maximum number of BSS entries to keep in memory
*/
unsigned int bss_max_count;
};

View File

@ -457,7 +457,8 @@ static const struct global_parse_data global_fields[] = {
{ STR(config_methods) },
{ INT_RANGE(wps_cred_processing, 0, 2) },
#endif /* CONFIG_WPS */
{ FUNC(country) }
{ FUNC(country) },
{ INT(bss_max_count) }
};
#undef FUNC
@ -889,6 +890,8 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
fprintf(f, "country=%c%c\n",
config->country[0], config->country[1]);
}
if (config->bss_max_count != DEFAULT_BSS_MAX_COUNT)
fprintf(f, "bss_max_count=%u\n", config->bss_max_count);
}
#endif /* CONFIG_NO_CONFIG_WRITE */

View File

@ -257,6 +257,9 @@ static int wpa_config_read_global(struct wpa_config *config, HKEY hk)
&config->wps_cred_processing);
#endif /* CONFIG_WPS */
wpa_config_read_reg_dword(hk, TEXT("bss_max_count"),
&config->bss_max_count);
return errors ? -1 : 0;
}
@ -583,6 +586,10 @@ static int wpa_config_write_global(struct wpa_config *config, HKEY hk)
config->wps_cred_processing, 0);
#endif /* CONFIG_WPS */
wpa_config_write_reg_dword(hk, TEXT("bss_max_count"),
config->bss_max_count,
DEFAULT_BSS_MAX_COUNT);
return 0;
}

View File

@ -210,6 +210,14 @@ fast_reauth=1
# to external program(s)
#wps_cred_processing=0
# Maximum number of BSS entries to keep in memory
# Default: 200
# This can be used to limit memory use on the BSS entries (cached scan
# results). A larger value may be needed in environments that have huge number
# of APs when using ap_scan=1 mode.
#bss_max_count=200
# network block
#
# Each network (usually AP's sharing the same SSID) is configured as a separate