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() {
|
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) {
|
||||||
push(helpers, {
|
uci.foreach(package, 'helper', (s) => {
|
||||||
name: s.name,
|
push(helpers, {
|
||||||
description: s.description,
|
name: s.name,
|
||||||
module: s.module,
|
description: s.description,
|
||||||
family: s.family,
|
module: s.module,
|
||||||
proto: s.proto,
|
family: s.family,
|
||||||
port: s.port
|
proto: s.proto,
|
||||||
|
port: s.port
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
return { result: helpers };
|
return { result: helpers };
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue