fix dnsmasq init script
[openwrt/svn-archive/archive.git] / openwrt / package / dnsmasq / files / S50dnsmasq
index 4f3721846b29259555ad79e84e2c2ec331ba34eb..e913b8be18a318e62599334cfaeb63d45118431c 100755 (executable)
@@ -1,5 +1,7 @@
 #!/bin/sh
 . /etc/functions.sh
+. /etc/network.overrides
+[ "$FAILSAFE" != "true" -a -e /etc/config/network ] && . /etc/config/network
 
 # interface to use for DHCP
 iface=lan
@@ -20,6 +22,9 @@ udhcpc -n -q -R -s /bin/true -i $ifname >&- || {
   end=$(nvram get dhcp_num)
   end=$((start+${end:-150}))
   
-  args="-l /tmp/dhcp.leases -K -F $(int2ip $start),$(int2ip $end),$(int2ip $netmask),12h"
+  wanproto=$(nvram get wan_proto)
+  [ -z "$wanproto" -o "$wanproto" = "none" ] || wanif=$(nvram get wan_ifname)
+  
+  args="-l /tmp/dhcp.leases -K -F $(int2ip $start),$(int2ip $end),$(int2ip $netmask),12h ${wanif:+-I ${wanif} }"
 }
 dnsmasq ${args}