append_bool "$cfg" enable_tftp "--enable-tftp"
append_bool "$cfg" nonwildcard "-z"
+ append_parm "$cfg" dhcpscript "-6"
append_parm "$cfg" cachesize "-c"
append_parm "$cfg" dnsforwardmax "-0"
append_parm "$cfg" port "-p"
config_get DOMAIN "$cfg" domain
config_get_bool readethers "$cfg" readethers
- [ "$readethers" = "1" ] && [ -e "/etc/ethers" ] || touch /etc/ethers
+ [ "$readethers" = "1" -a \! -e "/etc/ethers" ] && touch /etc/ethers
config_get leasefile $cfg leasefile
- [ -n "$leasefile" ] && [ -e "$leasefile" ] || touch "$leasefile"
+ [ -n "$leasefile" -a \! -e "$leasefile" ] && touch "$leasefile"
config_get_bool cachelocal "$cfg" cachelocal 1
config_get hostsfile "$cfg" dhcphostsfile
dhcp_host_add() {
local cfg="$1"
- config_get name "$cfg" name
-
config_get networkid "$cfg" networkid
[ -n "$networkid" ] && dhcp_option_add "$cfg" "$networkid"
+ config_get name "$cfg" name
config_get ip "$cfg" ip
- [ -n "$ip" ] || return 0
+ [ -n "$ip" ] || [ -n "$name" ] || return 0
macs=""
config_get mac "$cfg" mac
for m in $mac; do append macs "$m" ","; done
[ -n "$macs" ] || return 0
- append args "--dhcp-host=$macs,${networkid:+net:$networkid,}$ip${name:+,$name}"
+ append args "--dhcp-host=$macs${networkid:+,net:$networkid}${ip:+,$ip}${name:+,$name}"
}
dhcp_mac_add() {
leasetime="${leasetime:-12h}"
start="$(dhcp_calc "${start:-100}")"
limit="${limit:-150}"
+ [ "$limit" -gt 0 ] && limit=$((limit-1))
eval "$(ipcalc.sh $ipaddr $netmask $start $limit)"
if [ "$dynamicdhcp" = "0" ]; then END="static"; fi
append args "--dhcp-range=$networkid,$START,$END,$NETMASK,$leasetime${options:+ $options}"
rm -f /tmp/resolv.conf
ln -s /tmp/resolv.conf.auto /tmp/resolv.conf
}
- killall dnsmasq
+ service_kill dnsmasq /var/run/dnsmasq.pid
return 0
}