diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-11-10 22:49:07 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2022-11-10 22:49:07 +0100 |
commit | 2cbfd64dcb63cf82102cc4dc2963a2f9da91e477 (patch) | |
tree | 2a3c68ecf293d29c37b9dd83b6301cbd8b094bd0 /modules/luci-base | |
parent | 1da816ddf2b811ae98b5c05f1dbf84653071873e (diff) |
luci-base: fix ubus luci/getConntrackHelpers reporting with firewall3
The uci package name used to iterate the loaded configuration sections
must correspond to the file name being loaded.
Fixes: https://github.com/openwrt/openwrt/issues/11215
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base')
-rw-r--r-- | modules/luci-base/root/usr/share/rpcd/ucode/luci | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/modules/luci-base/root/usr/share/rpcd/ucode/luci b/modules/luci-base/root/usr/share/rpcd/ucode/luci index cb00ff86d4..e237979352 100644 --- a/modules/luci-base/root/usr/share/rpcd/ucode/luci +++ b/modules/luci-base/root/usr/share/rpcd/ucode/luci @@ -159,20 +159,25 @@ const methods = { call: function() { const uci = cursor(); let helpers = []; - - uci.load('/usr/share/firewall4/helpers'); - uci.load('/usr/share/fw3/helpers.conf'); - - uci.foreach('helpers', 'helper', (s) => { - push(helpers, { - name: s.name, - description: s.description, - module: s.module, - family: s.family, - proto: s.proto, - port: s.port + let package; + + if (uci.load('/usr/share/firewall4/helpers')) + package = 'helpers'; + else if (uci.load('/usr/share/fw3/helpers.conf')) + package = 'helpers.conf'; + + if (package) { + uci.foreach(package, 'helper', (s) => { + push(helpers, { + name: s.name, + description: s.description, + module: s.module, + family: s.family, + proto: s.proto, + port: s.port + }); }); - }); + } return { result: helpers }; } |