aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd/config_file.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2015-02-06 15:59:57 (GMT)
committerJouni Malinen <j@w1.fi>2015-02-06 15:59:57 (GMT)
commit68fa00c341e26be69c1faffa58f94867b5f1cfd3 (patch)
treee69c6ab2a6d0a54be0e5ef64b415215ef56264ac /hostapd/config_file.c
parent6f41a258057294c6006fab477754da80c93c890e (diff)
downloadhostap-68fa00c341e26be69c1faffa58f94867b5f1cfd3.zip
hostap-68fa00c341e26be69c1faffa58f94867b5f1cfd3.tar.gz
hostap-68fa00c341e26be69c1faffa58f94867b5f1cfd3.tar.bz2
ACS: Allow specific channels to be preferred
The new acs_chan_bias configuration parameter is a space-separated list of <channel>:<bias> pairs. It can be used to increase (or decrease) the likelihood of a specific channel to be selected by the ACS algorithm. The total interference factor for each channel gets multiplied by the specified bias value before finding the channel with the lowest value. In other words, values between 0.0 and 1.0 can be used to make a channel more likely to be picked while values larger than 1.0 make the specified channel less likely to be picked. This can be used, e.g., to prefer the commonly used 2.4 GHz band channels 1, 6, and 11 (which is the default behavior on 2.4 GHz band if no acs_chan_bias parameter is specified). Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'hostapd/config_file.c')
-rw-r--r--hostapd/config_file.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index e3cad7c..3466f28 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -1856,6 +1856,48 @@ static struct wpabuf * hostapd_parse_bin(const char *buf)
#endif /* CONFIG_WPS_NFC */
+#ifdef CONFIG_ACS
+static int hostapd_config_parse_acs_chan_bias(struct hostapd_config *conf,
+ char *pos)
+{
+ struct acs_bias *bias = NULL, *tmp;
+ unsigned int num = 0;
+ char *end;
+
+ while (*pos) {
+ tmp = os_realloc_array(bias, num + 1, sizeof(*bias));
+ if (!tmp)
+ goto fail;
+ bias = tmp;
+
+ bias[num].channel = atoi(pos);
+ if (bias[num].channel <= 0)
+ goto fail;
+ pos = os_strchr(pos, ':');
+ if (!pos)
+ goto fail;
+ pos++;
+ bias[num].bias = strtod(pos, &end);
+ if (end == pos || bias[num].bias < 0.0)
+ goto fail;
+ pos = end;
+ if (*pos != ' ' && *pos != '\0')
+ goto fail;
+ num++;
+ }
+
+ os_free(conf->acs_chan_bias);
+ conf->acs_chan_bias = bias;
+ conf->num_acs_chan_bias = num;
+
+ return 0;
+fail:
+ os_free(bias);
+ return -1;
+}
+#endif /* CONFIG_ACS */
+
+
static int hostapd_config_fill(struct hostapd_config *conf,
struct hostapd_bss_config *bss,
char *buf, char *pos, int line)
@@ -2508,6 +2550,12 @@ static int hostapd_config_fill(struct hostapd_config *conf,
return 1;
}
conf->acs_num_scans = val;
+ } else if (os_strcmp(buf, "acs_chan_bias") == 0) {
+ if (hostapd_config_parse_acs_chan_bias(conf, pos)) {
+ wpa_printf(MSG_ERROR, "Line %d: invalid acs_chan_bias",
+ line);
+ return -1;
+ }
#endif /* CONFIG_ACS */
} else if (os_strcmp(buf, "dtim_period") == 0) {
bss->dtim_period = atoi(pos);