]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Make check_20mhz_bss common
authorJanusz Dziedzic <janusz.dziedzic@tieto.com>
Thu, 8 Jan 2015 11:48:34 +0000 (12:48 +0100)
committerJouni Malinen <j@w1.fi>
Sat, 10 Jan 2015 15:35:53 +0000 (17:35 +0200)
Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
src/ap/hw_features.c
src/common/hw_features_common.c
src/common/hw_features_common.h

index d629bbece14a7535e8f38b4cfa0846e72cb050ff..cc0c19d67a20e9e4d4f24d321d110ecc1ccc74f1 100644 (file)
@@ -277,30 +277,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);
 }
 
 
index bb6e5db29d7ed531e8b5586ae3e4034203b1cb2e..ce729ff2ef601d3628b484381557e2abcb250a3f 100644 (file)
@@ -236,3 +236,32 @@ int check_40mhz_5g(struct hostapd_hw_modes *mode,
 
        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;
+}
index ed01d0ae24d5cad5a3396635eff5d0255fb3757c..8a03d749715b1bd967aa975684069260a1c89e25 100644 (file)
@@ -26,5 +26,6 @@ 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 */