]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Allow wpa_supplicant AP mode to configure Beacon interval
authorJouni Malinen <jouni@qca.qualcomm.com>
Fri, 1 Mar 2013 18:50:08 +0000 (20:50 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 1 Mar 2013 18:50:08 +0000 (20:50 +0200)
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>

wpa_supplicant/ap.c
wpa_supplicant/config.c
wpa_supplicant/config.h
wpa_supplicant/config_file.c
wpa_supplicant/config_ssid.h
wpa_supplicant/wpa_supplicant.conf

index 82b7e193cb261cd7c69e3346512ef0c357a343ef..720ff7b70cc69a2027f05bcbffee383875d973a3 100644 (file)
@@ -209,6 +209,13 @@ static int wpa_supplicant_conf_ap(struct wpa_supplicant *wpa_s,
 
        if (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)
                bss->rsn_pairwise = bss->wpa_pairwise;
index ee634a5c1c3c2980c3c896d56a3fb84a5cb586a6..91d82aea87483b4f15cbecbf52f6462fc7cdb556 100644 (file)
@@ -1545,6 +1545,7 @@ static const struct parse_data ssid_fields[] = {
 #endif /* CONFIG_HT_OVERRIDES */
        { INT(ap_max_inactivity) },
        { INT(dtim_period) },
+       { INT(beacon_int) },
 };
 
 #undef OFFSET
@@ -2991,6 +2992,8 @@ static const struct global_parse_data global_fields[] = {
        { INT(okc), 0 },
        { INT(pmf), 0 },
        { FUNC(sae_groups), 0 },
+       { INT(dtim_period), 0 },
+       { INT(beacon_int), 0 },
 };
 
 #undef FUNC
index 2b88bb51f77ff07fc4d0ee4320820fffd2c85524..2e3e76bb6f682c790b80993db5f0c4b5a94aa494 100644 (file)
@@ -817,6 +817,22 @@ struct wpa_config {
         * groups will be tried in the indicated order.
         */
        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;
 };
 
 
index f29f7a6b92c6ddcc50ac9945777163fe8e265278..ff99cd7b7ac3a99ea393b2aba41d5d2cddbdeb89 100644 (file)
@@ -690,6 +690,8 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid)
 #ifdef CONFIG_P2P
        write_p2p_client_list(f, ssid);
 #endif /* CONFIG_P2P */
+       INT(dtim_period);
+       INT(beacon_int);
 
 #undef STR
 #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);
        if (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) {
                int i;
index 9ac67c739eeeb993305487888948baee6cb186fa..8cab88f3031fbc9c4b3658a9bad40e20305f9a31 100644 (file)
@@ -548,6 +548,11 @@ struct wpa_ssid {
         */
        int dtim_period;
 
+       /**
+        * beacon_int - Beacon interval (default: 100 TU)
+        */
+       int beacon_int;
+
        /**
         * auth_failures - Number of consecutive authentication failures
         */
index 18460b89e5c55b37051b31d751c19f1c7d48edc1..c9deb4b8aa7b1f02220dbc6320bc5fb587c5b5e2 100644 (file)
@@ -289,6 +289,12 @@ fast_reauth=1
 # http://www.iana.org/assignments/ipsec-registry/ipsec-registry.xml#ipsec-registry-9
 #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)
 
 # Enable Interworking
@@ -832,6 +838,9 @@ fast_reauth=1
 # DTIM period in Beacon intervals for AP mode (default: 2)
 #dtim_period=2
 
+# Beacon interval (default: 100 TU)
+#beacon_int=100
+
 # disable_ht: Whether HT (802.11n) should be disabled.
 # 0 = HT enabled (if AP supports it)
 # 1 = HT disabled