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

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