]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Allow configuring CTWindow when working as GO
authorEliad Peller <eliad@wizery.com>
Wed, 18 Feb 2015 02:35:12 +0000 (21:35 -0500)
committerJouni Malinen <j@w1.fi>
Sat, 21 Feb 2015 14:07:53 +0000 (16:07 +0200)
Read p2p_go_ctwindow (0-127 TUs) from the config file, and pass it to
the driver on GO start.

Use p2p_go_ctwindow=0 (no CTWindow) by default.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
src/ap/ap_config.h
src/ap/beacon.c
src/drivers/driver.h
wpa_supplicant/ap.c
wpa_supplicant/config.c
wpa_supplicant/config.h
wpa_supplicant/config_file.c
wpa_supplicant/p2p_supplicant.c

index 0f33ac9a05b6be43a7f94a1ccc2124f5bae4a956..ec73771f6be35268c14ad6ba812a6f497e31f1c0 100644 (file)
@@ -629,6 +629,10 @@ struct hostapd_config {
        u8 vht_oper_centr_freq_seg0_idx;
        u8 vht_oper_centr_freq_seg1_idx;
 
+#ifdef CONFIG_P2P
+       u8 p2p_go_ctwindow;
+#endif /* CONFIG_P2P */
+
 #ifdef CONFIG_TESTING_OPTIONS
        double ignore_probe_probability;
        double ignore_auth_probability;
index 476379fc715b1dd1595bbc589c465575a6943133..e575b65cbf3ace94e186f6be63ef3be8e8e788d9 100644 (file)
@@ -1008,6 +1008,9 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
                params->hessid = hapd->conf->hessid;
        params->access_network_type = hapd->conf->access_network_type;
        params->ap_max_inactivity = hapd->conf->ap_max_inactivity;
+#ifdef CONFIG_P2P
+       params->p2p_go_ctwindow = hapd->iconf->p2p_go_ctwindow;
+#endif /* CONFIG_P2P */
 #ifdef CONFIG_HS20
        params->disable_dgaf = hapd->conf->disable_dgaf;
        if (hapd->conf->osen) {
index 467c9d2c0d2bf68e9f5380606a97f72627e2fca2..2c21fdb9fc6077a79b1ab1767bf92295386dfb10 100644 (file)
@@ -1017,6 +1017,11 @@ struct wpa_driver_ap_params {
         */
        int ap_max_inactivity;
 
+       /**
+        * ctwindow - Client Traffic Window (in TUs)
+        */
+       u8 p2p_go_ctwindow;
+
        /**
         * smps_mode - SMPS mode
         *
index fca2137c6f5e410aacb040e85edac0f9e3751761..f2c60e7fdd06c2d4be3066f52cb23f2f1c8dd43b 100644 (file)
@@ -265,6 +265,17 @@ static int wpa_supplicant_conf_ap(struct wpa_supplicant *wpa_s,
        else if (wpa_s->conf->beacon_int)
                conf->beacon_int = wpa_s->conf->beacon_int;
 
+#ifdef CONFIG_P2P
+       if (wpa_s->conf->p2p_go_ctwindow > conf->beacon_int) {
+               wpa_printf(MSG_INFO,
+                          "CTWindow (%d) is bigger than beacon interval (%d) - avoid configuring it",
+                          wpa_s->conf->p2p_go_ctwindow, conf->beacon_int);
+               conf->p2p_go_ctwindow = 0;
+       } else {
+               conf->p2p_go_ctwindow = wpa_s->conf->p2p_go_ctwindow;
+       }
+#endif /* CONFIG_P2P */
+
        if ((bss->wpa & 2) && bss->rsn_pairwise == 0)
                bss->rsn_pairwise = bss->wpa_pairwise;
        bss->wpa_group = wpa_select_ap_group_cipher(bss->wpa, bss->wpa_pairwise,
index 30d9342f2334a506bc5535d0180398674229c47d..8e6cd2006b0eada173ef6c28cc2b6c9b17eaf594 100644 (file)
@@ -3504,6 +3504,7 @@ struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface,
        config->p2p_intra_bss = DEFAULT_P2P_INTRA_BSS;
        config->p2p_go_max_inactivity = DEFAULT_P2P_GO_MAX_INACTIVITY;
        config->p2p_optimize_listen_chan = DEFAULT_P2P_OPTIMIZE_LISTEN_CHAN;
+       config->p2p_go_ctwindow = DEFAULT_P2P_GO_CTWINDOW;
        config->bss_max_count = DEFAULT_BSS_MAX_COUNT;
        config->bss_expiration_age = DEFAULT_BSS_EXPIRATION_AGE;
        config->bss_expiration_scan_count = DEFAULT_BSS_EXPIRATION_SCAN_COUNT;
@@ -4136,6 +4137,7 @@ static const struct global_parse_data global_fields[] = {
        { INT(p2p_go_ht40), 0 },
        { INT(p2p_go_vht), 0 },
        { INT(p2p_disabled), 0 },
+       { INT_RANGE(p2p_go_ctwindow, 0, 127), 0 },
        { INT(p2p_no_group_iface), 0 },
        { INT_RANGE(p2p_ignore_shared_freq, 0, 1), 0 },
        { IPV4(ip_addr_go), 0 },
index afae78df8eb78707fe6924478273fe1ac9ed13a7..34b754e09c532d3b8f5cdb388617f640fd863204 100644 (file)
@@ -33,6 +33,7 @@
 #define DEFAULT_RAND_ADDR_LIFETIME 60
 #define DEFAULT_KEY_MGMT_OFFLOAD 1
 #define DEFAULT_CERT_IN_CB 1
+#define DEFAULT_P2P_GO_CTWINDOW 0
 
 #include "config_ssid.h"
 #include "wps/wps.h"
@@ -941,6 +942,14 @@ struct wpa_config {
         */
        int p2p_go_vht;
 
+       /**
+        * p2p_go_ctwindow - CTWindow to use when operating as GO
+        *
+        * By default: 0 (no CTWindow). Values 0-127 can be used to indicate
+        * the length of the CTWindow in TUs.
+        */
+       int p2p_go_ctwindow;
+
        /**
         * p2p_disabled - Whether P2P operations are disabled for this interface
         */
index 06936e7279401b884da399fa16862a6ac4b830d2..3d3a6e404fd8a9f47448b554d90661d7cb9f6619 100644 (file)
@@ -1115,6 +1115,8 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
                fprintf(f, "p2p_go_ht40=%u\n", config->p2p_go_ht40);
        if (config->p2p_go_vht)
                fprintf(f, "p2p_go_vht=%u\n", config->p2p_go_vht);
+       if (config->p2p_go_ctwindow != DEFAULT_P2P_GO_CTWINDOW)
+               fprintf(f, "p2p_go_ctwindow=%u\n", config->p2p_go_ctwindow);
        if (config->p2p_disabled)
                fprintf(f, "p2p_disabled=%u\n", config->p2p_disabled);
        if (config->p2p_no_group_iface)
index 00b8d8590e362cee2c7d54f67a82c4e862d35067..5e6646ed0e0890d815bde05e4df0b9176321cf1f 100644 (file)
@@ -1852,6 +1852,7 @@ static void wpas_p2p_clone_config(struct wpa_supplicant *dst,
        d->ignore_old_scan_res = s->ignore_old_scan_res;
        d->beacon_int = s->beacon_int;
        d->dtim_period = s->dtim_period;
+       d->p2p_go_ctwindow = s->p2p_go_ctwindow;
        d->disassoc_low_ack = s->disassoc_low_ack;
        d->disable_scan_offload = s->disable_scan_offload;
        d->passive_scan = s->passive_scan;