From 2cbfd64dcb63cf82102cc4dc2963a2f9da91e477 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 10 Nov 2022 22:49:07 +0100 Subject: [PATCH] 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 --- .../luci-base/root/usr/share/rpcd/ucode/luci | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 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 = []; + let package; - uci.load('/usr/share/firewall4/helpers'); - uci.load('/usr/share/fw3/helpers.conf'); + if (uci.load('/usr/share/firewall4/helpers')) + package = 'helpers'; + else if (uci.load('/usr/share/fw3/helpers.conf')) + package = '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 + 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 }; }