]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Add ap_isolate configuration option for wpa_supplicant AP mode
authorDanilo Ravotto <danilo.ravotto@zirak.it>
Thu, 1 Feb 2018 11:09:38 +0000 (12:09 +0100)
committerJouni Malinen <j@w1.fi>
Sat, 17 Feb 2018 15:48:31 +0000 (17:48 +0200)
Allow client isolation to be configured with ap_isolate inside
wpa_supplicant configuration file.

Signed-off-by: Danilo Ravotto <danilo.ravotto@zirak.it>
wpa_supplicant/ap.c
wpa_supplicant/config.c
wpa_supplicant/config.h
wpa_supplicant/config_file.c
wpa_supplicant/config_winreg.c
wpa_supplicant/wpa_cli.c

index 939af62ac7c216303330aaa722a92f741316da81..679b346007d6774a73d33a34908072ad058b05d4 100644 (file)
@@ -506,6 +506,9 @@ no_wps:
        else
                bss->max_num_sta = wpa_s->conf->max_num_sta;
 
+       if (!bss->isolate)
+               bss->isolate = wpa_s->conf->ap_isolate;
+
        bss->disassoc_low_ack = wpa_s->conf->disassoc_low_ack;
 
        if (wpa_s->conf->ap_vendor_elements) {
index c13383d8035bab27fd734c63bdb967aba0636da0..a0b8cd0073159d37fb46e9530604b7084c9d0880 100644 (file)
@@ -3899,6 +3899,7 @@ struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface,
        config->bss_expiration_age = DEFAULT_BSS_EXPIRATION_AGE;
        config->bss_expiration_scan_count = DEFAULT_BSS_EXPIRATION_SCAN_COUNT;
        config->max_num_sta = DEFAULT_MAX_NUM_STA;
+       config->ap_isolate = DEFAULT_AP_ISOLATE;
        config->access_network_type = DEFAULT_ACCESS_NETWORK_TYPE;
        config->scan_cur_freq = DEFAULT_SCAN_CUR_FREQ;
        config->wmm_ac_params[0] = ac_be;
@@ -4578,6 +4579,7 @@ static const struct global_parse_data global_fields[] = {
        { INT_RANGE(filter_ssids, 0, 1), 0 },
        { INT_RANGE(filter_rssi, -100, 0), 0 },
        { INT(max_num_sta), 0 },
+       { INT_RANGE(ap_isolate, 0, 1), 0 },
        { INT_RANGE(disassoc_low_ack, 0, 1), 0 },
 #ifdef CONFIG_HS20
        { INT_RANGE(hs20, 0, 1), 0 },
index 07b67e6b46d4e3fa5547714effb29fb2e93c462a..68f90a085f33fea61fbb4ce9561e6261aa6f7b2d 100644 (file)
@@ -32,6 +32,7 @@
 #define DEFAULT_BSS_EXPIRATION_AGE 180
 #define DEFAULT_BSS_EXPIRATION_SCAN_COUNT 2
 #define DEFAULT_MAX_NUM_STA 128
+#define DEFAULT_AP_ISOLATE 0
 #define DEFAULT_ACCESS_NETWORK_TYPE 15
 #define DEFAULT_SCAN_CUR_FREQ 0
 #define DEFAULT_P2P_SEARCH_DELAY 500
@@ -842,6 +843,20 @@ struct wpa_config {
         */
        unsigned int max_num_sta;
 
+       /**
+        * ap_isolate - Whether to use client isolation feature
+        *
+        * Client isolation can be used to prevent low-level bridging of
+        * frames between associated stations in the BSS. By default,
+        * this bridging is allowed (ap_isolate=0); except in P2P GO case,
+        * where p2p_intra_bss parameter is used to determine whether to allow
+        * intra-BSS forwarding (ap_isolate = !p2p_intra_bss).
+        *
+        * 0 = do not enable AP isolation
+        * 1 = enable AP isolation
+        */
+       int ap_isolate;
+
        /**
         * freq_list - Array of allowed scan frequencies or %NULL for all
         *
index aaee97e9020ef71314326b2cec12bbd4619abdf1..5a71869616ae0fc27942694a8e20b79852a012db 100644 (file)
@@ -1282,6 +1282,8 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
                fprintf(f, "filter_rssi=%d\n", config->filter_rssi);
        if (config->max_num_sta != DEFAULT_MAX_NUM_STA)
                fprintf(f, "max_num_sta=%u\n", config->max_num_sta);
+       if (config->ap_isolate != DEFAULT_AP_ISOLATE)
+               fprintf(f, "ap_isolate=%u\n", config->ap_isolate);
        if (config->disassoc_low_ack)
                fprintf(f, "disassoc_low_ack=%d\n", config->disassoc_low_ack);
 #ifdef CONFIG_HS20
index 0ba1aa5e8bed76993ae577407590419f545f6f50..8b8992bd7f6661b1e324c6af1d6c7a91a014582c 100644 (file)
@@ -619,6 +619,8 @@ static int wpa_config_write_global(struct wpa_config *config, HKEY hk)
                                   config->filter_ssids, 0);
        wpa_config_write_reg_dword(hk, TEXT("max_num_sta"),
                                   config->max_num_sta, DEFAULT_MAX_NUM_STA);
+       wpa_config_write_reg_dword(hk, TEXT("ap_isolate"),
+                                  config->ap_isolate, DEFAULT_AP_ISOLATE);
        wpa_config_write_reg_dword(hk, TEXT("disassoc_low_ack"),
                                   config->disassoc_low_ack, 0);
 
index 121f831b6b989cf3bb019f9e3a30e3b1510847ca..4f60890b3f2a92488fc549032d408d3ec406c123 100644 (file)
@@ -476,7 +476,7 @@ static char ** wpa_cli_complete_set(const char *str, int pos)
 #endif /* CONFIG_P2P */
                "country", "bss_max_count", "bss_expiration_age",
                "bss_expiration_scan_count", "filter_ssids", "filter_rssi",
-               "max_num_sta", "disassoc_low_ack",
+               "max_num_sta", "disassoc_low_ack", "ap_isolate",
 #ifdef CONFIG_HS20
                "hs20",
 #endif /* CONFIG_HS20 */
@@ -573,7 +573,7 @@ static char ** wpa_cli_complete_get(const char *str, int pos)
 #endif /* CONFIG_P2P */
                "bss_max_count", "bss_expiration_age",
                "bss_expiration_scan_count", "filter_ssids", "filter_rssi",
-               "max_num_sta", "disassoc_low_ack",
+               "max_num_sta", "disassoc_low_ack", "ap_isolate",
 #ifdef CONFIG_HS20
                "hs20",
 #endif /* CONFIG_HS20 */