diff mbox series

[V3,7/7] bss_coloring: allow using a random starting color

Message ID 20200812165451.2698941-8-john@phrozen.org
State Superseded
Headers show
Series bss coloring: add support | expand

Commit Message

John Crispin Aug. 12, 2020, 4:54 p.m. UTC
Enhance the possible values for he_bss_color. Anything greater than 63 will
make hostapd choose a random color.

Signed-off-by: John Crispin <john@phrozen.org>
---
 hostapd/config_file.c | 7 +++++--
 hostapd/hostapd.conf  | 5 ++++-
 2 files changed, 9 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 7728aff55..6abcf306e 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -3439,8 +3439,11 @@  static int hostapd_config_fill(struct hostapd_config *conf,
 	} else if (os_strcmp(buf, "he_mu_beamformer") == 0) {
 		conf->he_phy_capab.he_mu_beamformer = atoi(pos);
 	} else if (os_strcmp(buf, "he_bss_color") == 0) {
-		bss->he_op.he_bss_color = atoi(pos) & 0x3f;
-		bss->he_op.he_bss_color_disabled = 0;
+		bss->he_op.he_bss_color = atoi(pos);
+		if (bss->he_op.he_bss_color > 63)
+			bss->he_op.he_bss_color = (os_random() % 63) + 1;
+		if (bss->he_op.he_bss_color)
+			bss->he_op.he_bss_color_disabled = 0;
 	} else if (os_strcmp(buf, "he_bss_color_partial") == 0) {
 		bss->he_op.he_bss_color_partial = atoi(pos);
 	} else if (os_strcmp(buf, "he_default_pe_duration") == 0) {
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index 91ac96785..5fc4d5f86 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -801,7 +801,10 @@  wmm_ac_vo_acm=0
 # 1 = supported
 #he_mu_beamformer=1
 
-# he_bss_color: BSS color (1-63)
+# he_bss_color:
+# 0 = disable
+# 1-63 = pre-defined color
+# 64+ =	random color
 #he_bss_color=1
 
 # he_bss_color_partial: BSS color AID equation