0009-hostapd-prevent-channel-switch-for-5GHz.patch 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Mon, 27 Jul 2015 20:42:50 +0200
  3. Subject: hostapd: prevent channel switch for 5GHz
  4. hostapd would switch the primary and secondary channel on 5GHz networks in
  5. certain circumstances, completely breaking the adhoc interfaces of the WLAN
  6. adapter (they would lose their configuration).
  7. As a temporary fix, disable this channel switch function.
  8. diff --git a/package/network/services/hostapd/patches/900-no_channel_switch.patch b/package/network/services/hostapd/patches/900-no_channel_switch.patch
  9. new file mode 100644
  10. index 0000000000000000000000000000000000000000..c6145156928ffa5a5195ca145b0655bb88c92091
  11. --- /dev/null
  12. +++ b/package/network/services/hostapd/patches/900-no_channel_switch.patch
  13. @@ -0,0 +1,68 @@
  14. +--- a/src/common/hw_features_common.c
  15. ++++ b/src/common/hw_features_common.c
  16. +@@ -171,7 +171,6 @@ int check_40mhz_5g(struct hostapd_hw_mod
  17. + struct wpa_scan_results *scan_res, int pri_chan,
  18. + int sec_chan)
  19. + {
  20. +- int pri_freq, sec_freq, pri_bss, sec_bss;
  21. + int bss_pri_chan, bss_sec_chan;
  22. + size_t i;
  23. + int match;
  24. +@@ -180,57 +179,6 @@ int check_40mhz_5g(struct hostapd_hw_mod
  25. + pri_chan == sec_chan)
  26. + return 0;
  27. +
  28. +- pri_freq = hw_get_freq(mode, pri_chan);
  29. +- sec_freq = hw_get_freq(mode, sec_chan);
  30. +-
  31. +- /*
  32. +- * Switch PRI/SEC channels if Beacons were detected on selected SEC
  33. +- * channel, but not on selected PRI channel.
  34. +- */
  35. +- pri_bss = sec_bss = 0;
  36. +- for (i = 0; i < scan_res->num; i++) {
  37. +- struct wpa_scan_res *bss = scan_res->res[i];
  38. +- if (bss->freq == pri_freq)
  39. +- pri_bss++;
  40. +- else if (bss->freq == sec_freq)
  41. +- sec_bss++;
  42. +- }
  43. +- if (sec_bss && !pri_bss) {
  44. +- wpa_printf(MSG_INFO,
  45. +- "Switch own primary and secondary channel to get secondary channel with no Beacons from other BSSes");
  46. +- return 2;
  47. +- }
  48. +-
  49. +- /*
  50. +- * Match PRI/SEC channel with any existing HT40 BSS on the same
  51. +- * channels that we are about to use (if already mixed order in
  52. +- * existing BSSes, use own preference).
  53. +- */
  54. +- match = 0;
  55. +- for (i = 0; i < scan_res->num; i++) {
  56. +- struct wpa_scan_res *bss = scan_res->res[i];
  57. +- get_pri_sec_chan(bss, &bss_pri_chan, &bss_sec_chan);
  58. +- if (pri_chan == bss_pri_chan &&
  59. +- sec_chan == bss_sec_chan) {
  60. +- match = 1;
  61. +- break;
  62. +- }
  63. +- }
  64. +- if (!match) {
  65. +- for (i = 0; i < scan_res->num; i++) {
  66. +- struct wpa_scan_res *bss = scan_res->res[i];
  67. +- get_pri_sec_chan(bss, &bss_pri_chan, &bss_sec_chan);
  68. +- if (pri_chan == bss_sec_chan &&
  69. +- sec_chan == bss_pri_chan) {
  70. +- wpa_printf(MSG_INFO, "Switch own primary and "
  71. +- "secondary channel due to BSS "
  72. +- "overlap with " MACSTR,
  73. +- MAC2STR(bss->bssid));
  74. +- return 2;
  75. +- }
  76. +- }
  77. +- }
  78. +-
  79. + return 1;
  80. + }
  81. +