luci-base: Enforce maximal firewall zone name length with fw3 only
authorPaul Donald <newtwen+github@gmail.com>
Fri, 10 Jan 2025 17:32:00 +0000 (18:32 +0100)
committerPaul Donald <newtwen+github@gmail.com>
Fri, 10 Jan 2025 17:41:28 +0000 (18:41 +0100)
firewall3 enforces the zone name length. firewall4 does not.

https://github.com/openwrt/luci/pull/7549#issuecomment-2583290810

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js
modules/luci-base/htdocs/luci-static/resources/tools/widgets.js

index c697d7597e8d8a86d15bad57ff5eea4eb50e2d95..99314bca5a106ac14b29f8c3173cc20f4fd95f8f 100644 (file)
@@ -130,7 +130,7 @@ return view.extend({
                o.placeholder = _('Unnamed zone');
                o.modalonly = true;
                o.rmempty = false;
-               o.datatype = 'and(uciname,maxlength(11))';
+               o.datatype = L.hasSystemFeature('firewall4') ? '' : 'and(uciname,maxlength(11))';
                o.write = function(section_id, formvalue) {
                        var cfgvalue = this.cfgvalue(section_id);
 
index 4c9cd6924e06ce80505c755011b8f412d1ea44c3..7368d6c523cdab407c79b166b25dc0f17217b351 100644 (file)
@@ -148,7 +148,7 @@ var CBIZoneSelect = form.ListValue.extend({
                        display_items: this.display_size || this.size || 3,
                        dropdown_items: this.dropdown_size || this.size || 5,
                        validate: L.bind(this.validate, this, section_id),
-                       datatype: 'and(uciname,maxlength(11))',
+                       datatype: L.hasSystemFeature('firewall4') ? '' : 'and(uciname,maxlength(11))',
                        create: !this.nocreate,
                        create_markup: '' +
                                '<li data-value="{{value}}">' +