dnsmasq: Backend migration and add dhcp support for https://github.com/opnsense/core/issues/8329

missed a couple of spots, options specified but not implemented.
Also add dhcp-reply-delay for dhcp scope splits.
This commit is contained in:
Ad Schellevis 2025-03-03 20:54:15 +01:00
parent 16b23493f0
commit 968e5f9d9a
3 changed files with 28 additions and 3 deletions

View File

@ -139,6 +139,12 @@
<type>checkbox</type>
<help>Should be set when dnsmasq is definitely the only DHCP server on a network. For DHCPv4, it changes the behaviour from strict RFC compliance so that DHCP requests on unknown leases from unknown hosts are not ignored.</help>
</field>
<field>
<id>dnsmasq.dhcp_reply_delay</id>
<label>DHCP Reply delay</label>
<type>text</type>
<help>Delays sending DHCPOFFER and PROXYDHCP replies for at least the specified number of seconds. This can be practical for split dhcp solutions, to make sure the secondary server answers slower than the primary.</help>
</field>
<field>
<id>dnsmasq.dhcp_default_fw_rules</id>
<label>DHCP register firewall rules</label>

View File

@ -45,6 +45,10 @@
<Required>Y</Required>
<Default>1</Default>
</dhcp_default_fw_rules>
<dhcp_reply_delay type="IntegerField">
<MinimumValue>0</MinimumValue>
<MaximumValue>60</MaximumValue>
</dhcp_reply_delay>
<no_ident type="BooleanField">
<Required>Y</Required>
<Default>1</Default>

View File

@ -25,6 +25,19 @@ interface={{helpers.physical_interfaces(dnsmasq.interface.split(','))|join(',')}
no-dhcp-interface={{helpers.physical_interfaces(dnsmasq.no_dhcp_interface.split(','))|join(',')}}
{% endif %}
{% if dnsmasq.dhcp_lease_max %}
dhcp-lease-max={{dnsmasq.dhcp_lease_max}}
{% endif %}
{% if dnsmasq.dhcp_fqdn == '1' %}
dhcp-fqdn
{% endif %}
{% if dnsmasq.dhcp_reply_delay %}
dhcp-reply-delay={{dhcp_reply_delay}}
{% endif %}
{% if dnsmasq.strictbind == '1' %}
# On systems which support it, dnsmasq binds the wildcard address,
# even when it is listening on only some interfaces. It then discards
@ -103,9 +116,9 @@ dhcp-range={%
%}set:{{dhcp_range.set_tag|replace('-','')}},{%
endif
%}{{dhcp_range.start_addr}},{%
if dhcp_range.mode != ''
%}{{dhcp_range.mode}},{%
elif dhcp_range.end_addr
if dhcp_range.mode
%}{{dhcp_range.mode}},{% endif %}{%
if dhcp_range.end_addr
%}{{ dhcp_range.end_addr }},{%
endif
%}{{dhcp_range.lease_time|default('86400')}}
@ -133,3 +146,5 @@ dhcp-match=set:{{match.set_tag.replace('-','')}},{{match.option}}{%if match.valu
{% if dnsmasq.no_ident == '1' %}
no-ident
{% endif %}