[RFC 6/8] make check_20mhz_bss common

Janusz Dziedzic janusz.dziedzic at tieto.com
Thu Jan 8 06:48:34 EST 2015


Signed-off-by: Janusz Dziedzic <janusz.dziedzic at tieto.com>
---
 src/ap/hw_features.c            | 25 +------------------------
 src/common/hw_features_common.c | 28 ++++++++++++++++++++++++++++
 src/common/hw_features_common.h |  1 +
 3 files changed, 30 insertions(+), 24 deletions(-)

diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
index 6b87092..127774e 100644
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -276,30 +276,7 @@ static int ieee80211n_check_40mhz_5g(struct hostapd_iface *iface,
 static int ieee80211n_check_20mhz_bss(struct wpa_scan_res *bss, int pri_freq,
 				      int start, int end)
 {
-	struct ieee802_11_elems elems;
-	struct ieee80211_ht_operation *oper;
-
-	if (bss->freq < start || bss->freq > end || bss->freq == pri_freq)
-		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;
+	return check_20mhz_bss(bss, pri_freq, start, end);
 }
 
 
diff --git a/src/common/hw_features_common.c b/src/common/hw_features_common.c
index e88fea0..dd588ef 100644
--- a/src/common/hw_features_common.c
+++ b/src/common/hw_features_common.c
@@ -226,3 +226,31 @@ int check_40mhz_5g(struct hostapd_hw_modes *mode, struct wpa_scan_results *scan_
 
 	return 1;
 }
+
+int check_20mhz_bss(struct wpa_scan_res *bss, int pri_freq, int start, int end)
+{
+	struct ieee802_11_elems elems;
+	struct ieee80211_ht_operation *oper;
+
+	if (bss->freq < start || bss->freq > end || bss->freq == pri_freq)
+		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;
+}
diff --git a/src/common/hw_features_common.h b/src/common/hw_features_common.h
index aa4704d..16d9d47 100644
--- a/src/common/hw_features_common.h
+++ b/src/common/hw_features_common.h
@@ -21,5 +21,6 @@ int hw_get_chan(struct hostapd_hw_modes *mode, int freq);
 int allowed_ht40_channel_pair(struct hostapd_hw_modes *mode, int pri_chan, int sec_chan);
 void get_pri_sec_chan(struct wpa_scan_res *bss, int *pri_chan, int *sec_chan);
 int check_40mhz_5g(struct hostapd_hw_modes *mode, struct wpa_scan_results *scan_res, int pri_chan, int sec_chan);
+int check_20mhz_bss(struct wpa_scan_res *bss, int pri_freq, int start, int end);
 
 #endif /* HW_FEATURES_COMMON_H */
-- 
1.9.1



More information about the HostAP mailing list