diff mbox

ACS: fix VHT80 segment picking

Message ID 1394007131-6845-1-git-send-email-michal.kazior@tieto.com
State Accepted
Headers show

Commit Message

Michal Kazior March 5, 2014, 8:12 a.m. UTC
The code considered, e.g. [44, 48, 52, 56] as a
valid VHT80 -- which is not. This resulted in,
e.g. failure to start CAC when channels overlapped
segments included DFS channels.

This adds a check similar to the HT40 one to
prevent that.

The check is performed the way it is as the ACS
code assumes primary channel to be the first
channel in a given segment.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 src/ap/acs.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

Comments

Jouni Malinen March 5, 2014, 10:50 p.m. UTC | #1
On Wed, Mar 05, 2014 at 09:12:11AM +0100, Michal Kazior wrote:
> The code considered, e.g. [44, 48, 52, 56] as a
> valid VHT80 -- which is not. This resulted in,
> e.g. failure to start CAC when channels overlapped
> segments included DFS channels.
> 
> This adds a check similar to the HT40 one to
> prevent that.
> 
> The check is performed the way it is as the ACS
> code assumes primary channel to be the first
> channel in a given segment.

Thanks, applied.
diff mbox

Patch

diff --git a/src/ap/acs.c b/src/ap/acs.c
index f58b091..60b7580 100644
--- a/src/ap/acs.c
+++ b/src/ap/acs.c
@@ -367,6 +367,19 @@  static int acs_usable_ht40_chan(struct hostapd_channel_data *chan)
 }
 
 
+static int acs_usable_vht80_chan(struct hostapd_channel_data *chan)
+{
+	const int allowed[] = { 36, 52, 100, 116, 132, 149 };
+	unsigned int i;
+
+	for (i = 0; i < ARRAY_SIZE(allowed); i++)
+		if (chan->chan == allowed[i])
+			return 1;
+
+	return 0;
+}
+
+
 static int acs_survey_is_sufficient(struct freq_survey *survey)
 {
 	if (!(survey->filled & SURVEY_HAS_NF)) {
@@ -541,6 +554,15 @@  acs_find_ideal_chan(struct hostapd_iface *iface)
 			continue;
 		}
 
+		if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211A &&
+		    iface->conf->ieee80211ac &&
+		    iface->conf->vht_oper_chwidth == 1 &&
+		    !acs_usable_vht80_chan(chan)) {
+			wpa_printf(MSG_DEBUG, "ACS: Channel %d: not allowed as primary channel for VHT80",
+				   chan->chan);
+			continue;
+		}
+
 		factor = 0;
 		if (acs_usable_chan(chan))
 			factor = chan->interference_factor;