Allow wpa_supplicant AP mode to configure Beacon interval

beacon_int (in TU) can now be used to configure Beacon interval for AP
mode operations (including P2P GO) in wpa_supplicant. This can be set
either in a network block or as a global parameter in the configuration
file (or with "SET beacon_int <value>" control interface command) to
apply for all networks that do not include the beacon_int parameter to
override the default.

In addition, this commits extends the dtim_period parameter to be
available as a global parameter to set the default value. dtim_period is
now stored in the configuration file, too, if it was set.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2013-03-01 20:50:08 +02:00 committed by Jouni Malinen
parent 5473362458
commit 18206e02c5
6 changed files with 46 additions and 0 deletions

View file

@ -209,6 +209,13 @@ static int wpa_supplicant_conf_ap(struct wpa_supplicant *wpa_s,
if (ssid->dtim_period) if (ssid->dtim_period)
bss->dtim_period = ssid->dtim_period; bss->dtim_period = ssid->dtim_period;
else if (wpa_s->conf->dtim_period)
bss->dtim_period = wpa_s->conf->dtim_period;
if (ssid->beacon_int)
conf->beacon_int = ssid->beacon_int;
else if (wpa_s->conf->beacon_int)
conf->beacon_int = wpa_s->conf->beacon_int;
if ((bss->wpa & 2) && bss->rsn_pairwise == 0) if ((bss->wpa & 2) && bss->rsn_pairwise == 0)
bss->rsn_pairwise = bss->wpa_pairwise; bss->rsn_pairwise = bss->wpa_pairwise;

View file

@ -1545,6 +1545,7 @@ static const struct parse_data ssid_fields[] = {
#endif /* CONFIG_HT_OVERRIDES */ #endif /* CONFIG_HT_OVERRIDES */
{ INT(ap_max_inactivity) }, { INT(ap_max_inactivity) },
{ INT(dtim_period) }, { INT(dtim_period) },
{ INT(beacon_int) },
}; };
#undef OFFSET #undef OFFSET
@ -2991,6 +2992,8 @@ static const struct global_parse_data global_fields[] = {
{ INT(okc), 0 }, { INT(okc), 0 },
{ INT(pmf), 0 }, { INT(pmf), 0 },
{ FUNC(sae_groups), 0 }, { FUNC(sae_groups), 0 },
{ INT(dtim_period), 0 },
{ INT(beacon_int), 0 },
}; };
#undef FUNC #undef FUNC

View file

@ -817,6 +817,22 @@ struct wpa_config {
* groups will be tried in the indicated order. * groups will be tried in the indicated order.
*/ */
int *sae_groups; int *sae_groups;
/**
* dtim_period - Default DTIM period in Beacon intervals
*
* This parameter can be used to set the default value for network
* blocks that do not specify dtim_period.
*/
int dtim_period;
/**
* beacon_int - Default Beacon interval in TU
*
* This parameter can be used to set the default value for network
* blocks that do not specify beacon_int.
*/
int beacon_int;
}; };

View file

@ -690,6 +690,8 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid)
#ifdef CONFIG_P2P #ifdef CONFIG_P2P
write_p2p_client_list(f, ssid); write_p2p_client_list(f, ssid);
#endif /* CONFIG_P2P */ #endif /* CONFIG_P2P */
INT(dtim_period);
INT(beacon_int);
#undef STR #undef STR
#undef INT #undef INT
@ -974,6 +976,10 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
fprintf(f, "okc=%d\n", config->okc); fprintf(f, "okc=%d\n", config->okc);
if (config->pmf) if (config->pmf)
fprintf(f, "pmf=%d\n", config->pmf); fprintf(f, "pmf=%d\n", config->pmf);
if (config->dtim_period)
fprintf(f, "dtim_period=%d\n", config->dtim_period);
if (config->beacon_int)
fprintf(f, "beacon_int=%d\n", config->beacon_int);
if (config->sae_groups) { if (config->sae_groups) {
int i; int i;

View file

@ -548,6 +548,11 @@ struct wpa_ssid {
*/ */
int dtim_period; int dtim_period;
/**
* beacon_int - Beacon interval (default: 100 TU)
*/
int beacon_int;
/** /**
* auth_failures - Number of consecutive authentication failures * auth_failures - Number of consecutive authentication failures
*/ */

View file

@ -289,6 +289,12 @@ fast_reauth=1
# http://www.iana.org/assignments/ipsec-registry/ipsec-registry.xml#ipsec-registry-9 # http://www.iana.org/assignments/ipsec-registry/ipsec-registry.xml#ipsec-registry-9
#sae_groups=21 20 19 26 25 #sae_groups=21 20 19 26 25
# Default value for DTIM period (if not overridden in network block)
#dtim_period=2
# Default value for Beacon interval (if not overridden in network block)
#beacon_int=100
# Interworking (IEEE 802.11u) # Interworking (IEEE 802.11u)
# Enable Interworking # Enable Interworking
@ -832,6 +838,9 @@ fast_reauth=1
# DTIM period in Beacon intervals for AP mode (default: 2) # DTIM period in Beacon intervals for AP mode (default: 2)
#dtim_period=2 #dtim_period=2
# Beacon interval (default: 100 TU)
#beacon_int=100
# disable_ht: Whether HT (802.11n) should be disabled. # disable_ht: Whether HT (802.11n) should be disabled.
# 0 = HT enabled (if AP supports it) # 0 = HT enabled (if AP supports it)
# 1 = HT disabled # 1 = HT disabled