luci-app-firewall: fix setting unspecified zone on forwardings
authorJo-Philipp Wich <jo@mein.io>
Tue, 15 Feb 2022 23:20:55 +0000 (00:20 +0100)
committerJo-Philipp Wich <jo@mein.io>
Tue, 15 Feb 2022 23:27:37 +0000 (00:27 +0100)
Fixes: #5685
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/forwards.js
modules/luci-base/htdocs/luci-static/resources/tools/widgets.js

index 19274dfd3bbb458e2176ef89f8f0f12ea4ad0d04..cbd4362049a4df0baf9e68dd6b2507780a796007 100644 (file)
@@ -149,9 +149,10 @@ return view.extend({
                        var config_name = this.uciconfig || this.map.config,
                            section_id = uci.add(config_name, this.sectiontype);
 
+                       uci.set(config_name, section_id, 'dest', 'lan');
                        uci.set(config_name, section_id, 'target', 'DNAT');
 
-                       this.addedSection = section_id;
+                       m.addedSection = section_id;
                        this.renderMoreOptionsModal(section_id);
                };
 
@@ -229,7 +230,6 @@ return view.extend({
                o.modalonly = true;
                o.rmempty = true;
                o.nocreate = true;
-               o.default = 'lan';
 
                o = fwtool.addIPOption(s, 'general', 'dest_ip', _('Internal IP address'),
                        _('Redirect matched incoming traffic to the specified internal host'), 'ipv4', hosts);
index 10b65be8ecc1cc18c6ade09a2ec3ab3f28e8e18d..ae17d8197d5dd207df3165947ab4593eb1deb533 100644 (file)
@@ -187,9 +187,10 @@ var CBIZoneSelect = form.ListValue.extend({
                                                emptyval.setAttribute('data-value', '');
                                        }
 
-                                       L.dom.content(emptyval.querySelector('span'), [
-                                               E('strong', _('Device')), E('span', ' (%s)'.format(_('input')))
-                                       ]);
+                                       if (opt[0].allowlocal)
+                                               L.dom.content(emptyval.querySelector('span'), [
+                                                       E('strong', _('Device')), E('span', ' (%s)'.format(_('input')))
+                                               ]);
 
                                        L.dom.content(anyval.querySelector('span'), [
                                                E('strong', _('Any zone')), E('span', ' (%s)'.format(_('forward')))