]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Allow non-PCS 6 GHz channels to be excluded from ACS
authorAnkita Bajaj <bankita@codeaurora.org>
Tue, 26 Nov 2019 05:49:32 +0000 (11:19 +0530)
committerJouni Malinen <j@w1.fi>
Fri, 20 Dec 2019 11:23:13 +0000 (13:23 +0200)
Add support to exclude non-PSC 6 GHz channels from the input frequency
list to ACS. The new acs_exclude_6ghz_non_psc=1 parameter can be used by
6 GHz only APs.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
hostapd/config_file.c
hostapd/hostapd.conf
src/ap/ap_config.h
src/ap/ap_drv_ops.c
src/common/ieee802_11_common.c
src/common/ieee802_11_common.h

index e489ec706d00d17c61ea4531ccd9b5cc925165c2..21c9ab2885651ab4c4a6372748d55b90ede5cf38 100644 (file)
@@ -3169,6 +3169,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                        return 1;
                }
                conf->acs_freq_list_present = 1;
+       } else if (os_strcmp(buf, "acs_exclude_6ghz_non_psc") == 0) {
+               conf->acs_exclude_6ghz_non_psc = atoi(pos);
        } else if (os_strcmp(buf, "beacon_int") == 0) {
                int val = atoi(pos);
                /* MIB defines range as 1..65535, but very small values
index 591386311a48730144c56753c4167d96195e5cbf..f71e83e5167127d215478fbabb83519ed0947d40 100644 (file)
@@ -218,6 +218,13 @@ channel=1
 # in cases where the driver supports DFS channels.
 #acs_exclude_dfs=1
 
+# Include only preferred scan channels from 6 GHz band for ACS
+# This option can be used to include only preferred scan channels in the 6 GHz
+# band. This can be useful in particular for devices that operate only a 6 GHz
+# BSS without a collocated 2.4/5 GHz BSS.
+# Default behavior is to include all PSC and non-PSC channels.
+#acs_exclude_6ghz_non_psc=1
+
 # Beacon interval in kus (1.024 ms) (default: 100; range 15..65535)
 beacon_int=100
 
index a3b9b5d50697f8fceeb76890e8ee029e50a9e89e..83b8aee65871802701951f9daf0c1900b3c11492 100644 (file)
@@ -886,6 +886,7 @@ struct hostapd_config {
        u8 acs_freq_list_present;
        int acs_exclude_dfs;
        enum hostapd_hw_mode hw_mode; /* HOSTAPD_MODE_IEEE80211A, .. */
+       int acs_exclude_6ghz_non_psc;
        enum {
                LONG_PREAMBLE = 0,
                SHORT_PREAMBLE = 1
index bcacf8cc320582f4b216086bf95ea6115b3cb126..053e9bcc260491e2333cd7391f977866583764f3 100644 (file)
@@ -869,6 +869,10 @@ static void hostapd_get_hw_mode_any_channels(struct hostapd_data *hapd,
                             &hapd->iface->conf->acs_ch_list,
                             chan->chan)))
                        continue;
+               if (is_6ghz_freq(chan->freq) &&
+                   hapd->iface->conf->acs_exclude_6ghz_non_psc &&
+                   !is_6ghz_psc_frequency(chan->freq))
+                       continue;
                if (!(chan->flag & HOSTAPD_CHAN_DISABLED) &&
                    !(hapd->iface->conf->acs_exclude_dfs &&
                      (chan->flag & HOSTAPD_CHAN_RADAR)))
index 275c508898c7d0d3682a0a6b0851480d52147f1c..ffcbe414a82798c82a4304aa8c243be6e5d1300b 100644 (file)
@@ -2069,6 +2069,26 @@ int is_6ghz_op_class(u8 op_class)
 }
 
 
+int is_6ghz_psc_frequency(int freq)
+{
+       int i;
+
+       if (!is_6ghz_freq(freq))
+               return 0;
+       if ((((freq - 5940) / 5) & 0x3) != 0x1)
+               return 0;
+
+       i = (freq - 5940 + 55) % 80;
+       if (i == 0)
+               i = (freq - 5940 + 55) / 80;
+
+       if (i >= 1 && i <= 15)
+               return 1;
+
+       return 0;
+}
+
+
 int ieee802_11_parse_candidate_list(const char *pos, u8 *nei_rep,
                                    size_t nei_rep_len)
 {
index 275bca6db7129361d1904476ebf394a2ac6f7237..984d248f6b00b3b06be07722e5d9de45416b02c5 100644 (file)
@@ -226,6 +226,7 @@ int oper_class_bw_to_int(const struct oper_class_map *map);
 int center_idx_to_bw_6ghz(u8 idx);
 int is_6ghz_freq(int freq);
 int is_6ghz_op_class(u8 op_class);
+int is_6ghz_psc_frequency(int freq);
 
 int ieee802_11_parse_candidate_list(const char *pos, u8 *nei_rep,
                                    size_t nei_rep_len);