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:
parent
1da816ddf2
commit
2cbfd64dcb
1 changed files with 16 additions and 11 deletions
|
@ -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 };
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue