luci-mod-network: show "dhcpv4" option for dnsmasq
authorLiangbin Lian <jjm2473@gmail.com>
Tue, 23 Dec 2025 07:14:46 +0000 (15:14 +0800)
committerPaul Donald <newtwen+github@gmail.com>
Tue, 23 Dec 2025 12:22:01 +0000 (13:22 +0100)
For odhcpd, an empty "dhcpv4" is equivalent to "disabled",
but for dnsmasq, an empty "dhcpv4" is equivalent to "enabled",
so an empty "dhcpv4" is ambiguous.

Fixes https://github.com/openwrt/openwrt/issues/21220

Signed-off-by: Liangbin Lian <jjm2473@gmail.com>
modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js

index 6312e4efe2caadc1934b5cc378030899414a4f3a..d184655e69c7566ba51d1f3c473e429c8b545597 100644 (file)
@@ -738,15 +738,17 @@ return view.extend({
                                                                _('As DHCP-Options; send unsolicited (dnsmasq only).'));
                                                }
 
-                                               if (L.hasSystemFeature('odhcpd', 'dhcpv4')) {
+                                               if (L.hasSystemFeature('odhcpd', 'dhcpv4') || L.hasSystemFeature('dnsmasq')) {
                                                        so = ss.taboption('ipv4', form.RichListValue, 'dhcpv4', _('DHCPv4 Service'),
-                                                                         _('Enable or disable DHCPv4 services on this interface (odhcpd only).'));
+                                                                         _('Enable or disable DHCPv4 services on this interface.'));
                                                        so.optional = true;
-                                                       so.value('', _('disabled'),
+                                                       so.value('disabled', _('disabled'),
                                                                 _('Do not provide DHCPv4 services on this interface.'));
                                                        so.value('server', _('enabled'),
                                                                 _('Provide DHCPv4 services on this interface.'));
+                                               }
 
+                                               if (L.hasSystemFeature('odhcpd', 'dhcpv4')) {
                                                        so = ss.taboption('ipv4', form.Value, 'ipv6_only_preferred', _('IPv6-Only Preferred'),
                                                                _('Specifies how often (in seconds) clients should check whether IPv6-only mode is still preferred (see %s, odhcpd only).')
                                                                .format('<a href="%s" target="_blank">RFC8925</a>').format('https://www.rfc-editor.org/rfc/rfc8925'));