libremesh / lime-packages

LibreMesh packages configuring OpenWrt for wireless mesh networking
https://libremesh.org/
GNU Affero General Public License v3.0
276 stars 95 forks source link

wifi-unstuck-wa: allow parametrizable values for interval and timeout #1039

Closed a-gave closed 10 months ago

a-gave commented 11 months ago

This close #1034

codecov-commenter commented 11 months ago

Codecov Report

Merging #1039 (6d48aa7) into master (bf158a1) will increase coverage by 0.46%. Report is 39 commits behind head on master. The diff coverage is 100.00%.

:exclamation: Current head 6d48aa7 differs from pull request most recent head e41d259. Consider uploading reports for the commit e41d259 to get more accurate results

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##           master    #1039      +/-   ##
==========================================
+ Coverage   79.27%   79.74%   +0.46%     
==========================================
  Files          53       53              
  Lines        4444     4532      +88     
==========================================
+ Hits         3523     3614      +91     
+ Misses        921      918       -3     
Files Changed Coverage Δ
...ages/lime-system/files/usr/lib/lua/lime/config.lua 97.72% <100.00%> (+0.03%) :arrow_up:
...ges/lime-system/files/usr/lib/lua/lime/network.lua 78.39% <100.00%> (+0.20%) :arrow_up:
...tuck-wa/files/usr/lib/lua/lime/wifi_unstuck_wa.lua 100.00% <100.00%> (ø)
tests/fakes/iwinfo.lua 98.13% <100.00%> (+1.02%) :arrow_up:

... and 3 files with indirect coverage changes

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

pony1k commented 11 months ago

Instead of modifying the source code with sed inside an uci-defaults script, maybe it would be better to put the content of the hook_wireless.lua.txt file directly in wireless.lua and sourround it with something like

if utils.is_installed("wifi-unstuck-wa") then
    ...
end

? Though it moves something that conceptionally belongs to the package wifi-unstuck-wa into the lime-system package. Alternatively you could put just after the line https://github.com/libremesh/lime-packages/blob/861f7bd1f3c785b71faf50267374854859cc0a1c/packages/lime-system/files/usr/lib/lua/lime/config.lua#L204-L205 something like

if utils.isModuleAvailable("wifi_unstuck_wa") then
    table.insert(modules_name, "wifi_unstuck_wa")
end

and equip the wifi_unstuck_wa.lua file with a wu.configure() and a wu.cleanup() function and put the content of hook_wireless.lua.txt inside the wu.configure() function. Then move the file into /usr/lib/lua/lime. That is the cleanest solution I can think of. Just my two cents. Hope this helps!

a-gave commented 10 months ago

Tested on openwrt-22.03.5-ath79-generic-tplink_cpe510-v3