luci-app-firewall: explicitely set 'DNAT' target on new forwards
authorJo-Philipp Wich <jo@mein.io>
Fri, 26 Jul 2019 10:36:04 +0000 (12:36 +0200)
committerJo-Philipp Wich <jo@mein.io>
Fri, 26 Jul 2019 10:36:04 +0000 (12:36 +0200)
Fixes: #2920
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/forwards.js

index ffbfe3ccd07bb6bf08a5d158a9d42a1bbb0f8b66..63af69f8a939609c38c360300c6ae3ee252ad39e 100644 (file)
@@ -107,6 +107,16 @@ return L.view.extend({
                        return uci.get('firewall', section_id, 'name') || _('Unnamed forward');
                };
 
+               s.handleAdd = function(ev) {
+                       var config_name = this.uciconfig || this.map.config,
+                           section_id = uci.add(config_name, this.sectiontype);
+
+                       uci.set(config_name, section_id, 'target', 'DNAT');
+
+                       this.addedSection = section_id;
+                       this.renderMoreOptionsModal(section_id);
+               };
+
                o = s.taboption('general', form.Value, 'name', _('Name'));
                o.placeholder = _('Unnamed forward');
                o.modalonly = true;