1
0

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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. From: Karsten Böddeker <freifunk@kb-light.de>
  2. Date: Fri, 1 Jul 2016 14:53:39 +0200
  3. Subject: [PATCH] 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 | 12 ++++++++++++
  10. 4 files changed, 36 insertions(+)
  11. diff --git a/docs/site-example/site.conf b/docs/site-example/site.conf
  12. index b58f525..1f67aab 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..1ba9b4a 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. Both are optional, by default hostapd/driver dictate the rates.
  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..d217428 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,18 @@ 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. + else
  81. + uci:delete('wireless', radio, 'supported_rates')
  82. + end
  83. +
  84. + if config.basic_rate then
  85. + uci:set_list('wireless', radio, 'basic_rate', config.basic_rate)
  86. + else
  87. + uci:delete('wireless', radio, 'basic_rate')
  88. + end
  89. end
  90. end
  91. --
  92. 2.1.4