move target/default/target_skeleton into package/base-files, put all the default...
[openwrt.git] / package / base-files / default / etc / init.d / S50dnsmasq
1 #!/bin/sh
2 . /etc/functions.sh
3
4 # interface to use for DHCP
5 iface=lan
6
7 ifname=$(nvram get ${iface}_ifname)
8 ipaddr=$(nvram get ${iface}_ipaddr)
9 netmask=$(nvram get ${iface}_netmask)
10
11 (
12 # check for existing DHCP server
13 udhcpc -n -q -R -s /dev/zero -i $ifname >&- || {
14
15 ipaddr=$(ip2int $ipaddr)
16 netmask=$(ip2int ${netmask:-255.255.255.0})
17 network=$((ipaddr&netmask))
18
19 start=$(nvram get dhcp_start)
20 start=$((network+${start:-100}))
21 end=$(nvram get dhcp_num)
22 end=$((start+${end:-150}))
23
24 args="-l /tmp/dhcp.leases -K -F $(int2ip $start),$(int2ip $end),$(int2ip $netmask),12h"
25 }
26 dnsmasq ${args}
27 ) &
This page took 0.043564 seconds and 5 git commands to generate.