Skip to content

Commit 890f2f4

Browse files
luci-app-upnp: update ACL options, migrate section
- Ignorable and cloneable ACL entries, always translated `Action` - Improve UI with direct editability, clearer help wording, and rename to `Access Control List` - Note that the ACL is now rejected by default, with no preset and accept extra ports. Add (ignored) ACL template entries on migration - Migrate ACL entries to the new section name `acl_entry` - The following ACL UCI options been added or changed, and the previous options are migrated on updating: acl_entry UCI options | Change | Previous name ----------------------------|----------------------------|-------------- action | New/updated values (1) | int_port | Remove colon separator (2) | int_ports ext_port | Remove colon separator (2) | ext_ports descr_filter | New option (3) | 1. Allow ignore, and update action option to use the nftables terms (allow/deny -> accept/reject). To avoid adding inverted actions when changing via LuCI, ensure any missing are set, as LuCI and UCI had not matching action defaults. Missing actions are now ignored/logged 2. Ensure that the hyphen (-) is only used as a port range separator by migration, as the colon (:) is not valid in LuCI 3. Add missing UCI option to set a regular expression to check for a UPnP IGD IPv4 port map description, and fix the current collision with the comment field which was not noticed due to a daemon bug https://redirect.github.com/openwrt/packages/pull/24495 https://redirect.github.com/miniupnp/miniupnp/pull/853 - Refactoring by adding a more universal usable `is_port_or_range` function instead of `upnpd_get_port_range` and check if it has a valid range, and removes a shellcheck warning - Rename `conf_rule_add` function to `upnpd_add_acl_entry` (to merge with prior) Signed-off-by: Self-Hosting-Group <selfhostinggroup-git+openwrt@shost.ing>
1 parent b0447ca commit 890f2f4

File tree

1 file changed

+28
-10
lines changed
  • applications/luci-app-upnp/htdocs/luci-static/resources/view/upnp

1 file changed

+28
-10
lines changed

applications/luci-app-upnp/htdocs/luci-static/resources/view/upnp/upnp.js

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,14 @@ return view.extend({
336336
o.editable = true;
337337
o.retain = true;
338338

339-
s = m.section(form.GridSection, 'perm_rule', _('Service Access Control List'),
340-
_('ACL specify which client addresses and ports can be mapped, IPv6 always allowed.'));
339+
s = m.section(form.GridSection, 'acl_entry', '<h5>' + _('Access Control List') + '</h5>',
340+
_('The access control list (ACL) specifies which IP addresses and ports can be mapped.') + ' ' +
341+
_('ACL entries are checked in order and rejected by default, with no preset. (should be part of extra tab)'));
341342
s.anonymous = true;
342343
s.addremove = true;
344+
s.cloneable = true;
343345
s.sortable = true;
346+
s.modaltitle = _('UPnP IGD & PCP') + ' - ' + _('Edit ACL Entry');
344347
// Preferably: ACL part of extra tab with depends for section as immediately, and network section part of service setup tab. Nice to have: Add button (+input) calls function and opens modal pre-filled
345348
let acl_used = false;
346349
for (let ifnr = 0; uci.get('upnpd', `@internal_network[${ifnr}]`, 'interface'); ifnr++) {
@@ -351,23 +354,38 @@ return view.extend({
351354
}
352355
s.disable = !acl_used;
353356

354-
s.option(form.Value, 'comment', _('Comment'));
357+
o = s.option(form.Value, 'comment', _('Comment'));
358+
o.default = _('unspecified');
355359

356360
o = s.option(form.Value, 'int_addr', _('IP address'));
357361
o.datatype = 'ip4addr';
358-
o.placeholder = '0.0.0.0/0';
362+
o.default = '0.0.0.0/0';
363+
o.editable = true;
364+
o.retain = true;
359365

360-
o = s.option(form.Value, 'int_ports', _('Port'));
366+
o = s.option(form.Value, 'int_port', _('Port'));
361367
o.datatype = 'portrange';
362-
o.placeholder = '1-65535';
368+
o.placeholder = '1-65535 (' + _('any port') + ')';
369+
o.editable = true;
370+
o.retain = true;
363371

364-
o = s.option(form.Value, 'ext_ports', _('External port'));
372+
o = s.option(form.Value, 'ext_port', _('External port'));
365373
o.datatype = 'portrange';
366-
o.placeholder = '1-65535';
374+
o.placeholder = '1-65535 (' + _('any port') + ')';
375+
o.editable = true;
376+
o.retain = true;
377+
378+
o = s.option(form.Value, 'descr_filter', _('Description filter'),
379+
_('A regular expression to check for a UPnP IGD IPv4 port map description'));
380+
o.placeholder = '^.*$ (' + _('any description') + ')';
381+
o.modalonly = true;
367382

368383
o = s.option(form.ListValue, 'action', _('Action'));
369-
o.value('allow', _('Allow'));
370-
o.value('deny', _('Deny'));
384+
o.value('accept', _('Accept'));
385+
o.value('reject', _('Reject'));
386+
o.value('ignore', _('Ignore'));
387+
o.editable = true;
388+
o.retain = true;
371389

372390
return m.render().then(L.bind(function(m, nodes) {
373391
if (uci.get('upnpd', 'settings', 'enabled') != '0') {

0 commit comments

Comments
 (0)