add md5sum
[openwrt.git] / openwrt / package / dnsmasq / files / S50dnsmasq
1 #!/bin/sh
2 . /etc/functions.sh
3 . /etc/network.overrides
4 [ "$FAILSAFE" != "true" -a -e /etc/config/network ] && . /etc/config/network
5
6 # interface to use for DHCP
7 iface=lan
8
9 ifname=$(nvram get ${iface}_ifname)
10 ipaddr=$(nvram get ${iface}_ipaddr)
11 netmask=$(nvram get ${iface}_netmask)
12
13 # check for existing DHCP server
14 udhcpc -n -q -R -s /bin/true -i $ifname >&- || {
15
16 ipaddr=$(ip2int $ipaddr)
17 netmask=$(ip2int ${netmask:-255.255.255.0})
18 network=$((ipaddr&netmask))
19
20 start=$(nvram get dhcp_start)
21 start=$((network+${start:-100}))
22 end=$(nvram get dhcp_num)
23 end=$((start+${end:-150}))
24
25 wanproto=$(nvram get wan_proto)
26 [ -z "$wanproto" -o "$wanproto" = "none" ] || wanif=$(nvram get wan_ifname)
27
28 args="-K -F $(int2ip $start),$(int2ip $end),$(int2ip $netmask),12h ${wanif:+-I ${wanif} }"
29 }
30 dnsmasq ${args}
This page took 0.053349 seconds and 5 git commands to generate.