Skip to content

Commit bfdf0d3

Browse files
committed
dnsmasq: Backend migration and add dhcp support for #8329
missed a couple of spots, options specified but not implemented. Also add dhcp-reply-delay for dhcp scope splits.
1 parent 16b2349 commit bfdf0d3

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

src/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/forms/general.xml

+6
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,12 @@
139139
<type>checkbox</type>
140140
<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>
141141
</field>
142+
<field>
143+
<id>dnsmasq.dhcp_reply_delay</id>
144+
<label>DHCP Reply delay</label>
145+
<type>text</type>
146+
<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>
147+
</field>
142148
<field>
143149
<id>dnsmasq.dhcp_default_fw_rules</id>
144150
<label>DHCP register firewall rules</label>

src/opnsense/mvc/app/models/OPNsense/Dnsmasq/Dnsmasq.xml

+4
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@
4545
<Required>Y</Required>
4646
<Default>1</Default>
4747
</dhcp_default_fw_rules>
48+
<dhcp_reply_delay type="IntegerField">
49+
<MinimumValue>0</MinimumValue>
50+
<MaximumValue>60</MaximumValue>
51+
</dhcp_reply_delay>
4852
<no_ident type="BooleanField">
4953
<Required>Y</Required>
5054
<Default>1</Default>

src/opnsense/service/templates/OPNsense/Dnsmasq/dnsmasq.conf

+17-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@ interface={{helpers.physical_interfaces(dnsmasq.interface.split(','))|join(',')}
2525
no-dhcp-interface={{helpers.physical_interfaces(dnsmasq.no_dhcp_interface.split(','))|join(',')}}
2626
{% endif %}
2727

28+
{% if dnsmasq.dhcp_lease_max %}
29+
dhcp-lease-max={{dnsmasq.dhcp_lease_max}}
30+
{% endif %}
31+
32+
{% if dnsmasq.dhcp_fqdn == '1' %}
33+
dhcp-fqdn
34+
{% endif %}
35+
36+
{% if dnsmasq.dhcp_reply_delay %}
37+
dhcp-reply-delay={{dhcp_reply_delay}}
38+
{% endif %}
39+
40+
2841
{% if dnsmasq.strictbind == '1' %}
2942
# On systems which support it, dnsmasq binds the wildcard address,
3043
# even when it is listening on only some interfaces. It then discards
@@ -104,8 +117,8 @@ dhcp-range={%
104117
endif
105118
%}{{dhcp_range.start_addr}},{%
106119
if dhcp_range.mode != ''
107-
%}{{dhcp_range.mode}},{%
108-
elif dhcp_range.end_addr
120+
%}{{dhcp_range.mode}},{% endif %}{%
121+
if dhcp_range.end_addr
109122
%}{{ dhcp_range.end_addr }},{%
110123
endif
111124
%}{{dhcp_range.lease_time|default('86400')}}
@@ -133,3 +146,5 @@ dhcp-match=set:{{match.set_tag.replace('-','')}},{{match.option}}{%if match.valu
133146
{% if dnsmasq.no_ident == '1' %}
134147
no-ident
135148
{% endif %}
149+
150+

0 commit comments

Comments
 (0)