luci-app-firewall: fix zone network default
authorJo-Philipp Wich <jo@mein.io>
Sat, 4 Jan 2020 17:46:04 +0000 (18:46 +0100)
committerJo-Philipp Wich <jo@mein.io>
Sat, 4 Jan 2020 17:49:10 +0000 (18:49 +0100)
When a `config zone` section lacks an `option network` or `list network`
setting, its contained interface list defaults to the name of the zone,
e.g. a zone named `foo` will implicitely contain the network `foo` unless
a deviating or empty `option network` is specified.

Adjust the zones.js model accordingly to reflect that implicit default.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit d60a1a13b091c622bc2d4d63321d2e3ea0437796)

applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js

index 8bf8d04861ac66be4c1f94362fd71025dcc51da8..4f8dad23d32ab54a010f34ae07cd4ba7af2bcb3a 100644 (file)
@@ -137,6 +137,9 @@ return L.view.extend({
                o = s.taboption('general', widgets.NetworkSelect, 'network', _('Covered networks'));
                o.modalonly = true;
                o.multiple = true;
+               o.cfgvalue = function(section_id) {
+                       return uci.get('firewall', section_id, 'network') || uci.get('firewall', section_id, 'name');
+               };
                o.write = function(section_id, formvalue) {
                        var name = uci.get('firewall', section_id, 'name'),
                            cfgvalue = this.cfgvalue(section_id);