From 2a009a8328ba337104aca37664728ec7890571c2 Mon Sep 17 00:00:00 2001
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Wed, 6 Nov 2019 22:02:04 +0100
Subject: [PATCH] hostapd: drop obsolete channel selection patch

As of OpenWrt commit b3d8b3ab8e6f ("mac80211: set noscan=1 if sta/adhoc/
mesh interfaces are present"), the issue workarounded by this patch cannot
occur anymore.
---
 ...tapd-prevent-channel-switch-for-5GHz.patch | 84 -------------------
 ...r-custom-format-strings-for-doubles.patch} |  0
 ...ways-allow-password-less-root-login.patch} |  0
 ...-support-for-ICMP-IGMP-type-matches.patch} |  0
 ...ath10k-ct-reduce-memory-consumption.patch} |  0
 5 files changed, 84 deletions(-)
 delete mode 100644 patches/openwrt/0003-hostapd-prevent-channel-switch-for-5GHz.patch
 rename patches/openwrt/{0004-libjson-c-Add-support-for-custom-format-strings-for-doubles.patch => 0003-libjson-c-Add-support-for-custom-format-strings-for-doubles.patch} (100%)
 rename patches/openwrt/{0005-dropbear-add-a-failsafe-mode-that-will-always-allow-password-less-root-login.patch => 0004-dropbear-add-a-failsafe-mode-that-will-always-allow-password-less-root-login.patch} (100%)
 rename patches/openwrt/{0006-kernel-ebtables-add-support-for-ICMP-IGMP-type-matches.patch => 0005-kernel-ebtables-add-support-for-ICMP-IGMP-type-matches.patch} (100%)
 rename patches/openwrt/{0007-ath10k-ct-reduce-memory-consumption.patch => 0006-ath10k-ct-reduce-memory-consumption.patch} (100%)

diff --git a/patches/openwrt/0003-hostapd-prevent-channel-switch-for-5GHz.patch b/patches/openwrt/0003-hostapd-prevent-channel-switch-for-5GHz.patch
deleted file mode 100644
index 3eda369db..000000000
--- a/patches/openwrt/0003-hostapd-prevent-channel-switch-for-5GHz.patch
+++ /dev/null
@@ -1,84 +0,0 @@
-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/900-no_channel_switch.patch b/package/network/services/hostapd/patches/900-no_channel_switch.patch
-new file mode 100644
-index 0000000000000000000000000000000000000000..c6145156928ffa5a5195ca145b0655bb88c92091
---- /dev/null
-+++ b/package/network/services/hostapd/patches/900-no_channel_switch.patch
-@@ -0,0 +1,68 @@
-+--- a/src/common/hw_features_common.c
-++++ b/src/common/hw_features_common.c
-+@@ -171,7 +171,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;
-+@@ -180,57 +179,6 @@ int check_40mhz_5g(struct hostapd_hw_mod
-+ 	    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;
-+ }
-+ 
diff --git a/patches/openwrt/0004-libjson-c-Add-support-for-custom-format-strings-for-doubles.patch b/patches/openwrt/0003-libjson-c-Add-support-for-custom-format-strings-for-doubles.patch
similarity index 100%
rename from patches/openwrt/0004-libjson-c-Add-support-for-custom-format-strings-for-doubles.patch
rename to patches/openwrt/0003-libjson-c-Add-support-for-custom-format-strings-for-doubles.patch
diff --git a/patches/openwrt/0005-dropbear-add-a-failsafe-mode-that-will-always-allow-password-less-root-login.patch b/patches/openwrt/0004-dropbear-add-a-failsafe-mode-that-will-always-allow-password-less-root-login.patch
similarity index 100%
rename from patches/openwrt/0005-dropbear-add-a-failsafe-mode-that-will-always-allow-password-less-root-login.patch
rename to patches/openwrt/0004-dropbear-add-a-failsafe-mode-that-will-always-allow-password-less-root-login.patch
diff --git a/patches/openwrt/0006-kernel-ebtables-add-support-for-ICMP-IGMP-type-matches.patch b/patches/openwrt/0005-kernel-ebtables-add-support-for-ICMP-IGMP-type-matches.patch
similarity index 100%
rename from patches/openwrt/0006-kernel-ebtables-add-support-for-ICMP-IGMP-type-matches.patch
rename to patches/openwrt/0005-kernel-ebtables-add-support-for-ICMP-IGMP-type-matches.patch
diff --git a/patches/openwrt/0007-ath10k-ct-reduce-memory-consumption.patch b/patches/openwrt/0006-ath10k-ct-reduce-memory-consumption.patch
similarity index 100%
rename from patches/openwrt/0007-ath10k-ct-reduce-memory-consumption.patch
rename to patches/openwrt/0006-ath10k-ct-reduce-memory-consumption.patch
-- 
GitLab