dnsmasq: Fix parameter 'limit'
authorFelix Fietkau <nbd@openwrt.org>
Wed, 26 Jan 2011 11:33:33 +0000 (11:33 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Wed, 26 Jan 2011 11:33:33 +0000 (11:33 +0000)
'limit' is actually the number of IP addresses to serve. See the use of ipcalc.sh.
For getting the expected number of IP addresses served, we have to decrement
limit by one.

Patch from: kentarou matsuyama <matsuyama@thinktube.com>

SVN-Revision: 25100

package/dnsmasq/files/dnsmasq.init

index 4acba5b8463e0c4f44b1cafd67eb96d9694c4c5c..ef1a8e98b554b650437c115e1f933ee64306e713 100644 (file)
@@ -300,6 +300,7 @@ dhcp_add() {
        leasetime="${leasetime:-12h}"
        start="$(dhcp_calc "${start:-100}")"
        limit="${limit:-150}"
        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}"
        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}"