hostapd: prevent channel switch for 5GHz

hostapd would switch the primary and secondary channel on 5GHz networks in
certain circumstances, completely breaking the adhoc interfaces of the WLAN
adapter (they would lose their configuration).

As a temporary fix, disable this channel switch function.
This commit is contained in:
Matthias Schiffer 2015-07-27 20:45:33 +02:00
parent 03ed475a42
commit 75cebd236d
1 changed files with 84 additions and 0 deletions

View File

@ -0,0 +1,84 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Mon, 27 Jul 2015 20:42:50 +0200
Subject: hostapd: prevent channel switch for 5GHz
hostapd would switch the primary and secondary channel on 5GHz networks in
certain circumstances, completely breaking the adhoc interfaces of the WLAN
adapter (they would lose their configuration).
As a temporary fix, disable this channel switch function.
diff --git a/package/network/services/hostapd/patches/470-no_channel_switch.patch b/package/network/services/hostapd/patches/470-no_channel_switch.patch
new file mode 100644
index 0000000..2eb1d7e
--- /dev/null
+++ b/package/network/services/hostapd/patches/470-no_channel_switch.patch
@@ -0,0 +1,68 @@
+--- a/src/common/hw_features_common.c
++++ b/src/common/hw_features_common.c
+@@ -172,7 +172,6 @@ int check_40mhz_5g(struct hostapd_hw_mod
+ struct wpa_scan_results *scan_res, int pri_chan,
+ int sec_chan)
+ {
+- int pri_freq, sec_freq, pri_bss, sec_bss;
+ int bss_pri_chan, bss_sec_chan;
+ size_t i;
+ int match;
+@@ -183,57 +182,6 @@ int check_40mhz_5g(struct hostapd_hw_mod
+ if (pri_chan == sec_chan)
+ return 0;
+
+- pri_freq = hw_get_freq(mode, pri_chan);
+- sec_freq = hw_get_freq(mode, sec_chan);
+-
+- /*
+- * Switch PRI/SEC channels if Beacons were detected on selected SEC
+- * channel, but not on selected PRI channel.
+- */
+- pri_bss = sec_bss = 0;
+- for (i = 0; i < scan_res->num; i++) {
+- struct wpa_scan_res *bss = scan_res->res[i];
+- if (bss->freq == pri_freq)
+- pri_bss++;
+- else if (bss->freq == sec_freq)
+- sec_bss++;
+- }
+- if (sec_bss && !pri_bss) {
+- wpa_printf(MSG_INFO,
+- "Switch own primary and secondary channel to get secondary channel with no Beacons from other BSSes");
+- return 2;
+- }
+-
+- /*
+- * Match PRI/SEC channel with any existing HT40 BSS on the same
+- * channels that we are about to use (if already mixed order in
+- * existing BSSes, use own preference).
+- */
+- match = 0;
+- for (i = 0; i < scan_res->num; i++) {
+- struct wpa_scan_res *bss = scan_res->res[i];
+- get_pri_sec_chan(bss, &bss_pri_chan, &bss_sec_chan);
+- if (pri_chan == bss_pri_chan &&
+- sec_chan == bss_sec_chan) {
+- match = 1;
+- break;
+- }
+- }
+- if (!match) {
+- for (i = 0; i < scan_res->num; i++) {
+- struct wpa_scan_res *bss = scan_res->res[i];
+- get_pri_sec_chan(bss, &bss_pri_chan, &bss_sec_chan);
+- if (pri_chan == bss_sec_chan &&
+- sec_chan == bss_pri_chan) {
+- wpa_printf(MSG_INFO, "Switch own primary and "
+- "secondary channel due to BSS "
+- "overlap with " MACSTR,
+- MAC2STR(bss->bssid));
+- return 2;
+- }
+- }
+- }
+-
+ return 1;
+ }
+