[PATCH] hostapd: check for overlapping 20 MHz BSS before starting 20/40 MHz BSS

Rajkumar Manoharan rmanohar at qti.qualcomm.com
Wed May 14 03:41:44 EDT 2014


Before starting a 20/40 MHz BSS, an 40-MHz-capable HT AP is required by
the rules defined in IEEE 802.11-2012 10.15.5 to examine the channels of
the current regulatory domain to determine whether the operation of a
20/40 MHz BSS might unfairly interfere with the operation of existing
20 MHz BSSs. The AP (or some of its associated HT STAs) is required to scan
all of the channels of the current regulatory domain in order to ascertain
the operating channels of any existing 20 MHz BSSs and 20/40 MHz BSSs.
(IEEE 802.11-2012 S.5.2 Establishing a 20/40 MHz BSS)

Signed-off-by: Rajkumar Manoharan <rmanohar at qti.qualcomm.com>
---
 src/ap/hw_features.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
index b361834..31684d7 100644
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -394,6 +394,34 @@ static int ieee80211n_check_40mhz_5g(struct hostapd_iface *iface,
 	return 1;
 }
 
+static int ieee80211n_check_20mhz_bss(struct wpa_scan_res *bss,
+				      int start, int end)
+{
+	struct ieee802_11_elems elems;
+	struct ieee80211_ht_operation *oper;
+
+	if (bss->freq < start || bss->freq > end)
+		return 0;
+
+	ieee802_11_parse_elems((u8 *) (bss + 1), bss->ie_len, &elems, 0);
+	if (!elems.ht_capabilities) {
+		wpa_printf(MSG_DEBUG, "Found overlapping legacy BSS: "
+			   MACSTR " freq=%d", MAC2STR(bss->bssid), bss->freq);
+		return 1;
+	}
+
+	if (elems.ht_operation &&
+	    elems.ht_operation_len >= sizeof(*oper)) {
+		oper = (struct ieee80211_ht_operation *) elems.ht_operation;
+		if (oper->ht_param & HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK)
+			return 0;
+
+		wpa_printf(MSG_DEBUG, "Found overlapping 20 MHz HT BSS: "
+			   MACSTR " freq=%d", MAC2STR(bss->bssid), bss->freq);
+		return 1;
+	}
+	return 0;
+}
 
 static int ieee80211n_check_40mhz_2g4(struct hostapd_iface *iface,
 				      struct wpa_scan_results *scan_res)
@@ -418,6 +446,14 @@ static int ieee80211n_check_40mhz_2g4(struct hostapd_iface *iface,
 		int sec_chan, pri_chan;
 		struct ieee802_11_elems elems;
 
+		/* Check for Overlapping 20 MHz BSS */
+		if (ieee80211n_check_20mhz_bss(bss, affected_start,
+					       affected_end)) {
+			wpa_printf(MSG_DEBUG,
+				   "Overlapping 20 MHz BSS is found");
+			return 0;
+		}
+
 		ieee80211n_get_pri_sec_chan(bss, &pri_chan, &sec_chan);
 
 		if (sec_chan) {
-- 
1.9.2



More information about the HostAP mailing list