8e73b0eeec2d4c75c7e9aa81017d2d604275ba7a
[openwrt.git] / openwrt / target / default / target_skeleton / 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 # check for existing DHCP server
12 udhcpc -n -q -R -s /dev/zero -i $ifname >&- || {
13
14 ipaddr=$(ip2int $ipaddr)
15 netmask=$(ip2int ${netmask:-255.255.255.0})
16 network=$((ipaddr&netmask))
17
18 start=$(nvram get dhcp_start)
19 start=$((network+${start:-100}))
20 end=$(nvram get dhcp_num)
21 end=$((start+${end:-150}))
22
23 args="-K -F $(int2ip $start),$(int2ip $end),$(int2ip $netmask),12h"
24 }
25 dnsmasq ${args}
This page took 0.0582859999999999 seconds and 3 git commands to generate.