From fa9b8df86a49a57b4348de9c74437b8f68d190c4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20H=C3=A4rdeman?= Date: Wed, 15 Oct 2025 17:35:42 +0200 Subject: [PATCH] luci-mod-network: organize "general" tab in dhcp/dns views MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Sort the options in the "general" tab so that they are all grouped together in the order they appear in the UI and delete ones that are specific to DNS from dhcp.js and vice versa. Note that this means that the "domain" option is present in both views. Signed-off-by: David Härdeman --- .../resources/view/network/dhcp.js | 72 +++--------- .../luci-static/resources/view/network/dns.js | 109 ++++++++---------- 2 files changed, 66 insertions(+), 115 deletions(-) diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js index 074dcfe95d..a6cc96b934 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js @@ -405,6 +405,21 @@ return view.extend({ s.tab('relay', _('Relay')); s.tab('pxe_tftp', _('PXE/TFTP')); + // Begin general + s.taboption('general', form.Flag, 'authoritative', + _('Authoritative'), + _('This is the only DHCP server in the local network.')); + + s.taboption('general', form.Value, 'domain', + _('Local domain'), + _('Local domain suffix appended to DHCP names and hosts file entries.')); + + o = s.taboption('general', form.Flag, 'sequential_ip', + _('Allocate IPs sequentially'), + _('Allocate IP addresses sequentially, starting from the lowest available address.')); + o.optional = true; + // End general + o = s.taboption('cache', form.MultiValue, 'cache_rr', _('Cache arbitrary RR'), _('By default, dnsmasq caches A, AAAA, CNAME and SRV DNS record types.') + '
' + _('This option adds additional record types to the cache.')); @@ -421,22 +436,6 @@ return view.extend({ _('Never forward DNS queries which lack dots or domain parts.') + '
' + customi18n(_('Names not in {etc_hosts} are answered {not_found}.') ) ); - s.taboption('general', form.Flag, 'authoritative', - _('Authoritative'), - _('This is the only DHCP server in the local network.')); - - o = s.taboption('general', form.Value, 'local', - _('Resolve these locally'), - _('Never forward these matching domains or subdomains; resolve from DHCP or hosts files only.')); - o.placeholder = '/internal.example.com/private.example.com/example.org'; - - s.taboption('general', form.Value, 'domain', - _('Local domain'), - _('Local domain suffix appended to DHCP names and hosts file entries.')); - - s.taboption('general', form.Flag, 'expandhosts', - _('Expand hosts'), - _('Add local domain suffix to names served from hosts files.')); o = s.taboption('logging', form.Flag, 'logqueries', _('Log queries'), @@ -478,37 +477,6 @@ return view.extend({ o.placeholder = '/*.example.org/10.1.2.3'; o.validate = validateServerSpec; - o = s.taboption('general', form.DynamicList, 'address', - _('Addresses'), - _('Resolve specified FQDNs to an IP.') + '
' + - customi18n(_('Syntax: {code_syntax}.'), - {code_syntax: '/fqdn[/fqdn…]/[ipaddr]'}) + '
' + - customi18n(_('{example_nx} returns {nxdomain}.', - 'hint: /example.com/ returns NXDOMAIN.'), - {example_nx: '/example.com/', nxdomain: 'NXDOMAIN'}) + '
' + - customi18n(_('{any_domain} matches any domain (and returns {nxdomain}).', - 'hint: /#/ matches any domain (and returns NXDOMAIN).'), - {any_domain:'/#/', nxdomain: 'NXDOMAIN'}) + '
' + - customi18n( - _('{example_null} returns {null_addr} addresses ({null_ipv4}, {null_ipv6}) for {example_com} and its subdomains.', - 'hint: /example.com/# returns NULL addresses (0.0.0.0, ::) for example.com and its subdomains.'), - { example_null: '/example.com/#', - null_addr: 'NULL', - null_ipv4: '0.0.0.0', - null_ipv6: '::', - example_com: 'example.com', - } - ) - ); - o.optional = true; - o.placeholder = '/router.local/router.lan/192.168.0.1'; - - o = s.taboption('general', form.DynamicList, 'ipset', - _('IP sets'), - _('List of IP sets to populate with the IPs of DNS lookup results of the FQDNs also specified here.')); - o.optional = true; - o.placeholder = '/example.org/ipset,ipset6'; - o = s.taboption('filteropts', form.Flag, 'rebind_protection', _('Rebind protection'), customi18n(_('Discard upstream responses containing {rfc_1918_link} addresses.') ) + '
' + @@ -675,11 +643,6 @@ return view.extend({ o.optional = true; o.depends('logdhcp', '0'); - o = s.taboption('general', form.Flag, 'sequential_ip', - _('Allocate IPs sequentially'), - _('Allocate IP addresses sequentially, starting from the lowest available address.')); - o.optional = true; - o = s.taboption('filteropts', form.Flag, 'boguspriv', _('Filter private'), customi18n( @@ -773,11 +736,6 @@ return view.extend({ _('Remove subnet address before forwarding query'), _('Remove any subnet address already present in a downstream query before forwarding it upstream.')); - o = s.taboption('general', form.Flag, 'allservers', - _('All servers'), - _('Query all available upstream resolvers.') + ' ' + _('First answer wins.')); - o.optional = true; - o = s.taboption('filteropts', form.DynamicList, 'bogusnxdomain', customi18n(_('IPs to override with {nxdomain}') ), customi18n(_('Transform replies which contain the specified addresses or subnets into {nxdomain} responses.') ) diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dns.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dns.js index 074dcfe95d..b5bb26066c 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dns.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dns.js @@ -405,6 +405,57 @@ return view.extend({ s.tab('relay', _('Relay')); s.tab('pxe_tftp', _('PXE/TFTP')); + // Begin general + o = s.taboption('general', form.Value, 'local', + _('Resolve these locally'), + _('Never forward these matching domains or subdomains; resolve from DHCP or hosts files only.')); + o.placeholder = '/internal.example.com/private.example.com/example.org'; + + s.taboption('general', form.Value, 'domain', + _('Local domain'), + _('Local domain suffix appended to DHCP names and hosts file entries.')); + + s.taboption('general', form.Flag, 'expandhosts', + _('Expand hosts'), + _('Add local domain suffix to names served from hosts files.')); + + o = s.taboption('general', form.DynamicList, 'address', + _('Addresses'), + _('Resolve specified FQDNs to an IP.') + '
' + + customi18n(_('Syntax: {code_syntax}.'), + {code_syntax: '/fqdn[/fqdn…]/[ipaddr]'}) + '
' + + customi18n(_('{example_nx} returns {nxdomain}.', + 'hint: /example.com/ returns NXDOMAIN.'), + {example_nx: '/example.com/', nxdomain: 'NXDOMAIN'}) + '
' + + customi18n(_('{any_domain} matches any domain (and returns {nxdomain}).', + 'hint: /#/ matches any domain (and returns NXDOMAIN).'), + {any_domain:'/#/', nxdomain: 'NXDOMAIN'}) + '
' + + customi18n( + _('{example_null} returns {null_addr} addresses ({null_ipv4}, {null_ipv6}) for {example_com} and its subdomains.', + 'hint: /example.com/# returns NULL addresses (0.0.0.0, ::) for example.com and its subdomains.'), + { example_null: '/example.com/#', + null_addr: 'NULL', + null_ipv4: '0.0.0.0', + null_ipv6: '::', + example_com: 'example.com', + } + ) + ); + o.optional = true; + o.placeholder = '/router.local/router.lan/192.168.0.1'; + + o = s.taboption('general', form.DynamicList, 'ipset', + _('IP sets'), + _('List of IP sets to populate with the IPs of DNS lookup results of the FQDNs also specified here.')); + o.optional = true; + o.placeholder = '/example.org/ipset,ipset6'; + + o = s.taboption('general', form.Flag, 'allservers', + _('All servers'), + _('Query all available upstream resolvers.') + ' ' + _('First answer wins.')); + o.optional = true; + // End general + o = s.taboption('cache', form.MultiValue, 'cache_rr', _('Cache arbitrary RR'), _('By default, dnsmasq caches A, AAAA, CNAME and SRV DNS record types.') + '
' + _('This option adds additional record types to the cache.')); @@ -421,23 +472,6 @@ return view.extend({ _('Never forward DNS queries which lack dots or domain parts.') + '
' + customi18n(_('Names not in {etc_hosts} are answered {not_found}.') ) ); - s.taboption('general', form.Flag, 'authoritative', - _('Authoritative'), - _('This is the only DHCP server in the local network.')); - - o = s.taboption('general', form.Value, 'local', - _('Resolve these locally'), - _('Never forward these matching domains or subdomains; resolve from DHCP or hosts files only.')); - o.placeholder = '/internal.example.com/private.example.com/example.org'; - - s.taboption('general', form.Value, 'domain', - _('Local domain'), - _('Local domain suffix appended to DHCP names and hosts file entries.')); - - s.taboption('general', form.Flag, 'expandhosts', - _('Expand hosts'), - _('Add local domain suffix to names served from hosts files.')); - o = s.taboption('logging', form.Flag, 'logqueries', _('Log queries'), _('Write received DNS queries to syslog.') + ' ' + _('Dump cache on SIGUSR1, include requesting IP.')); @@ -478,37 +512,6 @@ return view.extend({ o.placeholder = '/*.example.org/10.1.2.3'; o.validate = validateServerSpec; - o = s.taboption('general', form.DynamicList, 'address', - _('Addresses'), - _('Resolve specified FQDNs to an IP.') + '
' + - customi18n(_('Syntax: {code_syntax}.'), - {code_syntax: '/fqdn[/fqdn…]/[ipaddr]'}) + '
' + - customi18n(_('{example_nx} returns {nxdomain}.', - 'hint: /example.com/ returns NXDOMAIN.'), - {example_nx: '/example.com/', nxdomain: 'NXDOMAIN'}) + '
' + - customi18n(_('{any_domain} matches any domain (and returns {nxdomain}).', - 'hint: /#/ matches any domain (and returns NXDOMAIN).'), - {any_domain:'/#/', nxdomain: 'NXDOMAIN'}) + '
' + - customi18n( - _('{example_null} returns {null_addr} addresses ({null_ipv4}, {null_ipv6}) for {example_com} and its subdomains.', - 'hint: /example.com/# returns NULL addresses (0.0.0.0, ::) for example.com and its subdomains.'), - { example_null: '/example.com/#', - null_addr: 'NULL', - null_ipv4: '0.0.0.0', - null_ipv6: '::', - example_com: 'example.com', - } - ) - ); - o.optional = true; - o.placeholder = '/router.local/router.lan/192.168.0.1'; - - o = s.taboption('general', form.DynamicList, 'ipset', - _('IP sets'), - _('List of IP sets to populate with the IPs of DNS lookup results of the FQDNs also specified here.')); - o.optional = true; - o.placeholder = '/example.org/ipset,ipset6'; - o = s.taboption('filteropts', form.Flag, 'rebind_protection', _('Rebind protection'), customi18n(_('Discard upstream responses containing {rfc_1918_link} addresses.') ) + '
' + @@ -675,11 +678,6 @@ return view.extend({ o.optional = true; o.depends('logdhcp', '0'); - o = s.taboption('general', form.Flag, 'sequential_ip', - _('Allocate IPs sequentially'), - _('Allocate IP addresses sequentially, starting from the lowest available address.')); - o.optional = true; - o = s.taboption('filteropts', form.Flag, 'boguspriv', _('Filter private'), customi18n( @@ -773,11 +771,6 @@ return view.extend({ _('Remove subnet address before forwarding query'), _('Remove any subnet address already present in a downstream query before forwarding it upstream.')); - o = s.taboption('general', form.Flag, 'allservers', - _('All servers'), - _('Query all available upstream resolvers.') + ' ' + _('First answer wins.')); - o.optional = true; - o = s.taboption('filteropts', form.DynamicList, 'bogusnxdomain', customi18n(_('IPs to override with {nxdomain}') ), customi18n(_('Transform replies which contain the specified addresses or subnets into {nxdomain} responses.') ) -- 2.30.2