[PATCH] hostapd: add check for overlapping legacy BSS

Rajkumar Manoharan rmanohar
Sat May 3 07:26:07 PDT 2014


Before bringing up 20/40 MHz BSS, a scan is triggered to identify
overlapping BSS. If there is any legacy BSS present within the affected
range, then 40 MHz operation should be rejected and BSS should start
with 20 MHz.

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

diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
index b361834..0a8773c 100644
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -394,6 +394,21 @@ static int ieee80211n_check_40mhz_5g(struct hostapd_iface *iface,
 	return 1;
 }
 
+static int ieee80211n_check_legacy(struct wpa_scan_res *bss, int start, int end)
+{
+	struct ieee802_11_elems elems;
+
+	ieee802_11_parse_elems((u8 *) (bss + 1), bss->ie_len, &elems, 0);
+	if (elems.ht_capabilities)
+		return 0;
+
+	if (bss->freq < start || bss->freq > end)
+		return 0;
+
+	wpa_printf(MSG_DEBUG, "Overlapping Legacy BSS: " MACSTR " freq=%d",
+		   MAC2STR(bss->bssid), bss->freq);
+	return 1;
+}
 
 static int ieee80211n_check_40mhz_2g4(struct hostapd_iface *iface,
 				      struct wpa_scan_results *scan_res)
@@ -418,6 +433,14 @@ static int ieee80211n_check_40mhz_2g4(struct hostapd_iface *iface,
 		int sec_chan, pri_chan;
 		struct ieee802_11_elems elems;
 
+		/* Check for Overlapping Legacy BSS */
+		if (ieee80211n_check_legacy(bss, affected_start,
+					    affected_end)) {
+			wpa_printf(MSG_DEBUG,
+				   "Overlapping legacy 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