From e55a00edfdb9d1369e018f99b83402494bbe2084 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 27 Jul 2015 21:00:45 +0200 Subject: [PATCH] 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. --- ...tapd-prevent-channel-switch-for-5GHz.patch | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 patches/openwrt/0042-hostapd-prevent-channel-switch-for-5GHz.patch diff --git a/patches/openwrt/0042-hostapd-prevent-channel-switch-for-5GHz.patch b/patches/openwrt/0042-hostapd-prevent-channel-switch-for-5GHz.patch new file mode 100644 index 00000000..d097117e --- /dev/null +++ b/patches/openwrt/0042-hostapd-prevent-channel-switch-for-5GHz.patch @@ -0,0 +1,77 @@ +From: Matthias Schiffer +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/472-no_channel_switch.patch b/package/network/services/hostapd/patches/472-no_channel_switch.patch +new file mode 100644 +index 0000000..046969b +--- /dev/null ++++ b/package/network/services/hostapd/patches/472-no_channel_switch.patch +@@ -0,0 +1,61 @@ ++--- a/src/ap/hw_features.c +++++ b/src/ap/hw_features.c ++@@ -339,58 +339,6 @@ static int ieee80211n_check_40mhz_5g(str ++ else ++ sec_freq = pri_freq - 20; ++ ++- /* ++- * 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"); ++- ieee80211n_switch_pri_sec(iface); ++- return 1; ++- } ++- ++- /* ++- * 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]; ++- ieee80211n_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]; ++- ieee80211n_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)); ++- ieee80211n_switch_pri_sec(iface); ++- break; ++- } ++- } ++- } ++- ++ return 1; ++ } ++