0004-gluon-core-make-wifi-rates-configurable-by-site.conf.patch 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. From: Karsten Böddeker <freifunk@kb-light.de>
  2. Date: Thu, 30 Jun 2016 23:39:08 +0200
  3. Subject: [PATCH 2/2] gluon-core: make wifi rates configurable by site.conf
  4. and add documentation
  5. ---
  6. docs/site-example/site.conf | 8 ++++++++
  7. docs/user/site.rst | 8 ++++++++
  8. package/gluon-core/check_site.lua | 8 ++++++++
  9. package/gluon-core/files/lib/gluon/upgrade/200-wireless | 8 ++++++++
  10. 4 files changed, 32 insertions(+)
  11. diff --git a/docs/site-example/site.conf b/docs/site-example/site.conf
  12. index b58f525..19fe740 100644
  13. --- a/docs/site-example/site.conf
  14. +++ b/docs/site-example/site.conf
  15. @@ -35,6 +35,14 @@
  16. -- Wireless channel.
  17. channel = 1,
  18. + -- List of supported wifi rates (optional, implies basic_rate)
  19. + -- Example removes 802.11b compatibility for better performance
  20. + -- supported_rates = {6000, 9000, 12000, 18000, 24000, 36000, 48000, 54000},
  21. +
  22. + -- List of basic wifi rates (optional)
  23. + -- Example removes 802.11b compatibility for better performance
  24. + -- basic_rate = {6000, 9000, 18000, 36000, 54000},
  25. +
  26. -- ESSID used for client network.
  27. ap = {
  28. ssid = 'entenhausen.freifunk.net',
  29. diff --git a/docs/user/site.rst b/docs/user/site.rst
  30. index b26a28a..e449bcb 100644
  31. --- a/docs/user/site.rst
  32. +++ b/docs/user/site.rst
  33. @@ -95,6 +95,12 @@ wifi24 : optional
  34. This will only affect new installations.
  35. Upgrades will not changed the disabled state.
  36. + Additionally it is possible to configure the ``supported_rates`` and ``basic_rate``
  37. + of each radio. Booth are optional and defaults to hostapd/driver default. But
  38. + ``supported_rates`` implies ``basic_rate``, because ``basic_rate`` has to be a subset
  39. + of ``supported_rates``.
  40. + The example below disables 802.11b rates.
  41. +
  42. ``ap`` requires a single parameter, a string, named ``ssid`` which sets the
  43. interface's ESSID.
  44. @@ -109,6 +115,8 @@ wifi24 : optional
  45. wifi24 = {
  46. channel = 11,
  47. + supported_rates = {6000, 9000, 12000, 18000, 24000, 36000, 48000, 54000},
  48. + basic_rate = {6000, 9000, 18000, 36000, 54000},
  49. ap = {
  50. ssid = 'entenhausen.freifunk.net',
  51. },
  52. diff --git a/package/gluon-core/check_site.lua b/package/gluon-core/check_site.lua
  53. index 1647d77..555360a 100644
  54. --- a/package/gluon-core/check_site.lua
  55. +++ b/package/gluon-core/check_site.lua
  56. @@ -28,5 +28,13 @@ for _, config in ipairs({'wifi24', 'wifi5'}) do
  57. need_string('regdom') -- regdom is only required when wifi24 or wifi5 is configured
  58. need_number(config .. '.channel')
  59. +
  60. + local rates={1000, 2000, 5500, 6000, 9000, 11000, 12000, 18000, 24000, 36000, 48000, 54000}
  61. + local supported_rates = need_var_in_array(config .. '.supported_rates', rates, false)
  62. + if supported_rates then
  63. + need_var_in_array(config .. '.basic_rate', supported_rates, true)
  64. + else
  65. + need_var_in_array(config .. '.basic_rate', rates, false)
  66. + end
  67. end
  68. end
  69. diff --git a/package/gluon-core/files/lib/gluon/upgrade/200-wireless b/package/gluon-core/files/lib/gluon/upgrade/200-wireless
  70. index 5a98a70..a469683 100755
  71. --- a/package/gluon-core/files/lib/gluon/upgrade/200-wireless
  72. +++ b/package/gluon-core/files/lib/gluon/upgrade/200-wireless
  73. @@ -17,6 +17,14 @@ local function configure_radio(radio, index, config)
  74. uci:set('wireless', radio, 'channel', config.channel)
  75. uci:set('wireless', radio, 'htmode', 'HT20')
  76. uci:set('wireless', radio, 'country', site.regdom)
  77. +
  78. + if config.supported_rates then
  79. + uci:set_list('wireless', radio, 'supported_rates', config.supported_rates)
  80. + end
  81. +
  82. + if config.basic_rate then
  83. + uci:set_list('wireless', radio, 'basic_rate', config.basic_rate)
  84. + end
  85. end
  86. end
  87. --
  88. 2.1.4