1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter.git synced 2025-02-12 11:21:55 +00:00

Update dnsmasq init script

This commit is contained in:
Ycarus (Yannick Chabanois) 2023-12-20 19:26:24 +01:00
parent 65452f228b
commit 26e5327231

View file

@ -489,8 +489,13 @@ dhcp_add() {
# Do not support non-static interfaces for now
[ static = "$proto" ] || return 0
ipaddr="${subnet%%/*}"
prefix_or_netmask="${subnet##*/}"
# Override interface netmask with dhcp config if applicable
config_get netmask "$cfg" netmask "${subnet##*/}"
config_get netmask "$cfg" netmask
[ -n "$netmask" ] && prefix_or_netmask="$netmask"
#check for an already active dhcp server on the interface, unless 'force' is set
config_get_bool force "$cfg" force 0
@ -528,21 +533,20 @@ dhcp_add() {
limit=$((limit-1))
fi
eval "$(ipcalc.sh "${subnet%%/*}" $netmask $start $limit)"
# make sure the DHCP range is not empty
if [ "$dhcpv4" != "disabled" ] && eval "$(ipcalc.sh "$ipaddr/$prefix_or_netmask" "$start" "$limit")" ; then
[ "$dynamicdhcp" = "0" ] && END="static"
xappend "--dhcp-range=$tags$nettag$START,$END,$NETMASK,$leasetime${options:+ $options}"
fi
if [ "$dynamicdhcp" = "0" ] ; then
END="static"
dhcp6range="::,static"
else
dhcp6range="::1000,::ffff"
fi
if [ "$dhcpv4" != "disabled" ] ; then
xappend "--dhcp-range=$tags$nettag$START,$END,$NETMASK,$leasetime${options:+ $options}"
fi
if [ $DNSMASQ_DHCP_VER -eq 6 -a "$ra" = "server" ] ; then
# Note: dnsmasq cannot just be a DHCPv6 server (all-in-1)
# and let some other machine(s) send RA pointing to it.