2005-02-06 00:52:16 +00:00
|
|
|
#!/bin/sh
|
2005-05-30 09:09:58 +00:00
|
|
|
. /etc/functions.sh
|
2005-07-21 14:02:53 +00:00
|
|
|
. /etc/network.overrides
|
2005-08-25 11:57:56 +00:00
|
|
|
[ "$FAILSAFE" != "true" -a -e /etc/config/network ] && . /etc/config/network
|
2005-05-30 09:09:58 +00:00
|
|
|
|
|
|
|
# interface to use for DHCP
|
|
|
|
iface=lan
|
|
|
|
|
|
|
|
ifname=$(nvram get ${iface}_ifname)
|
|
|
|
ipaddr=$(nvram get ${iface}_ipaddr)
|
|
|
|
netmask=$(nvram get ${iface}_netmask)
|
|
|
|
|
2005-06-01 18:28:51 +00:00
|
|
|
(
|
|
|
|
# check for existing DHCP server
|
|
|
|
udhcpc -n -q -R -s /dev/zero -i $ifname >&- || {
|
2005-05-30 09:09:58 +00:00
|
|
|
|
2005-06-01 18:28:51 +00:00
|
|
|
ipaddr=$(ip2int $ipaddr)
|
|
|
|
netmask=$(ip2int ${netmask:-255.255.255.0})
|
|
|
|
network=$((ipaddr&netmask))
|
|
|
|
|
|
|
|
start=$(nvram get dhcp_start)
|
|
|
|
start=$((network+${start:-100}))
|
|
|
|
end=$(nvram get dhcp_num)
|
|
|
|
end=$((start+${end:-150}))
|
|
|
|
|
|
|
|
args="-l /tmp/dhcp.leases -K -F $(int2ip $start),$(int2ip $end),$(int2ip $netmask),12h"
|
|
|
|
}
|
|
|
|
dnsmasq ${args}
|
|
|
|
) &
|