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>
This commit is contained in:
Jo-Philipp Wich 2022-11-10 22:49:07 +01:00
parent 1da816ddf2
commit 2cbfd64dcb

View file

@ -159,11 +159,15 @@ const methods = {
call: function() { call: function() {
const uci = cursor(); const uci = cursor();
let helpers = []; let helpers = [];
let package;
uci.load('/usr/share/firewall4/helpers'); if (uci.load('/usr/share/firewall4/helpers'))
uci.load('/usr/share/fw3/helpers.conf'); package = 'helpers';
else if (uci.load('/usr/share/fw3/helpers.conf'))
package = 'helpers.conf';
uci.foreach('helpers', 'helper', (s) => { if (package) {
uci.foreach(package, 'helper', (s) => {
push(helpers, { push(helpers, {
name: s.name, name: s.name,
description: s.description, description: s.description,
@ -173,6 +177,7 @@ const methods = {
port: s.port port: s.port
}); });
}); });
}
return { result: helpers }; return { result: helpers };
} }