Skip to content

Commit

Permalink
dnsmasq: Backend migration and add dhcp support for #8329
Browse files Browse the repository at this point in the history
missed a couple of spots, options specified but not implemented.
Also add dhcp-reply-delay for dhcp scope splits.
  • Loading branch information
AdSchellevis committed Mar 3, 2025
1 parent 16b2349 commit 968e5f9
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
4 changes: 4 additions & 0 deletions src/opnsense/mvc/app/models/OPNsense/Dnsmasq/Dnsmasq.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
21 changes: 18 additions & 3 deletions src/opnsense/service/templates/OPNsense/Dnsmasq/dnsmasq.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')}}
Expand Down Expand Up @@ -133,3 +146,5 @@ dhcp-match=set:{{match.set_tag.replace('-','')}},{{match.option}}{%if match.valu
{% if dnsmasq.no_ident == '1' %}
no-ident
{% endif %}


0 comments on commit 968e5f9

Please sign in to comment.