Add max_num_sta config option for wpa_supplicant AP mode

This can be used to limit the number of stations allowed to be
connected to the AP.
This commit is contained in:
Jouni Malinen 2010-10-19 17:08:20 +03:00 committed by Jouni Malinen
parent 59eba7a2b3
commit dae608d5d3
5 changed files with 17 additions and 1 deletions

View file

@ -178,6 +178,8 @@ static int wpa_supplicant_conf_ap(struct wpa_supplicant *wpa_s,
os_memcpy(bss->os_version, wpa_s->conf->os_version, 4); os_memcpy(bss->os_version, wpa_s->conf->os_version, 4);
#endif /* CONFIG_WPS */ #endif /* CONFIG_WPS */
bss->max_num_sta = wpa_s->conf->max_num_sta;
return 0; return 0;
} }

View file

@ -2146,6 +2146,7 @@ struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface,
config->p2p_go_intent = DEFAULT_P2P_GO_INTENT; config->p2p_go_intent = DEFAULT_P2P_GO_INTENT;
config->p2p_intra_bss = DEFAULT_P2P_INTRA_BSS; config->p2p_intra_bss = DEFAULT_P2P_INTRA_BSS;
config->bss_max_count = DEFAULT_BSS_MAX_COUNT; config->bss_max_count = DEFAULT_BSS_MAX_COUNT;
config->max_num_sta = DEFAULT_MAX_NUM_STA;
if (ctrl_interface) if (ctrl_interface)
config->ctrl_interface = os_strdup(ctrl_interface); config->ctrl_interface = os_strdup(ctrl_interface);
@ -2405,7 +2406,8 @@ static const struct global_parse_data global_fields[] = {
#endif /* CONFIG_P2P */ #endif /* CONFIG_P2P */
{ FUNC(country), CFG_CHANGED_COUNTRY }, { FUNC(country), CFG_CHANGED_COUNTRY },
{ INT(bss_max_count), 0 }, { INT(bss_max_count), 0 },
{ INT_RANGE(filter_ssids, 0, 1), 0 } { INT_RANGE(filter_ssids, 0, 1), 0 },
{ INT(max_num_sta), 0 }
}; };
#undef FUNC #undef FUNC

View file

@ -25,6 +25,7 @@
#define DEFAULT_P2P_GO_INTENT 7 #define DEFAULT_P2P_GO_INTENT 7
#define DEFAULT_P2P_INTRA_BSS 1 #define DEFAULT_P2P_INTRA_BSS 1
#define DEFAULT_BSS_MAX_COUNT 200 #define DEFAULT_BSS_MAX_COUNT 200
#define DEFAULT_MAX_NUM_STA 128
#include "config_ssid.h" #include "config_ssid.h"
@ -378,6 +379,11 @@ struct wpa_config {
*/ */
int filter_ssids; int filter_ssids;
/**
* max_num_sta - Maximum number of STAs in an AP/P2P GO
*/
unsigned int max_num_sta;
/** /**
* changed_parameters - Bitmap of changed parameters since last update * changed_parameters - Bitmap of changed parameters since last update
*/ */

View file

@ -685,6 +685,8 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
fprintf(f, "bss_max_count=%u\n", config->bss_max_count); fprintf(f, "bss_max_count=%u\n", config->bss_max_count);
if (config->filter_ssids) if (config->filter_ssids)
fprintf(f, "filter_ssids=%d\n", config->filter_ssids); fprintf(f, "filter_ssids=%d\n", config->filter_ssids);
if (config->max_num_sta != DEFAULT_MAX_NUM_STA)
fprintf(f, "max_num_sta=%u\n", config->max_num_sta);
} }
#endif /* CONFIG_NO_CONFIG_WRITE */ #endif /* CONFIG_NO_CONFIG_WRITE */

View file

@ -265,6 +265,8 @@ static int wpa_config_read_global(struct wpa_config *config, HKEY hk)
(int *) &config->bss_max_count); (int *) &config->bss_max_count);
wpa_config_read_reg_dword(hk, TEXT("filter_ssids"), wpa_config_read_reg_dword(hk, TEXT("filter_ssids"),
&config->filter_ssids); &config->filter_ssids);
wpa_config_read_reg_dword(hk, TEXT("max_num_sta"),
(int *) &config->max_num_sta);
return errors ? -1 : 0; return errors ? -1 : 0;
} }
@ -601,6 +603,8 @@ static int wpa_config_write_global(struct wpa_config *config, HKEY hk)
DEFAULT_BSS_MAX_COUNT); DEFAULT_BSS_MAX_COUNT);
wpa_config_write_reg_dword(hk, TEXT("filter_ssids"), wpa_config_write_reg_dword(hk, TEXT("filter_ssids"),
config->filter_ssids, 0); config->filter_ssids, 0);
wpa_config_write_reg_dword(hk, TEXT("max_num_sta"),
config->max_num_sta, DEFAULT_MAX_NUM_STA);
return 0; return 0;
} }