2005-02-06 02:52:16 +02:00
|
|
|
#!/bin/sh
|
2005-05-30 12:09:58 +03:00
|
|
|
. /etc/functions.sh
|
2005-07-21 17:02:53 +03:00
|
|
|
. /etc/network.overrides
|
|
|
|
[ -e /etc/config/network] && . /etc/config/network
|
2005-05-30 12:09:58 +03: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 21:28:51 +03:00
|
|
|
(
|
|
|
|
# check for existing DHCP server
|
|
|
|
udhcpc -n -q -R -s /dev/zero -i $ifname >&- || {
|
2005-05-30 12:09:58 +03:00
|
|
|
|
2005-06-01 21:28:51 +03: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}
|
|
|
|
) &
|