- added "server" option list to delegate specific subdomains
[openwrt/svn-archive/archive.git] / package / dnsmasq / files / dnsmasq.init
index 79e57d5f3cee63590fe4606e0e5d1f3cea2c61b8..de9b92d52bc73e9e8b8dea3e8673d0a1512c47df 100644 (file)
@@ -36,6 +36,10 @@ append_parm() {
        append args "$switch $_loctmp"
 }
 
+append_server() {
+       append args "-S $1"
+}
+
 dnsmasq() {
        local cfg="$1"
        append_bool "$cfg" authoritative "-K"
@@ -52,6 +56,7 @@ dnsmasq() {
        append_bool "$cfg" dbus "-1"
        append_bool "$cfg" boguspriv "-b"
        append_bool "$cfg" expandhosts "-E"
+       append_bool "$cfg" enable_tftp "--enable-tftp"
 
        append_parm "$cfg" dnsforwardmax "-0"
        append_parm "$cfg" port "-p"
@@ -61,8 +66,11 @@ dnsmasq() {
        append_parm "$cfg" "queryport" "-Q"
        append_parm "$cfg" "domain" "-s"
        append_parm "$cfg" "local" "-S"
+       config_list_foreach "$cfg" "server" append_server
        append_parm "$cfg" "leasefile" "-l"
        append_parm "$cfg" "resolvfile" "-r"
+       append_parm "$cfg" "tftp_root" "--tftp-root"
+       append_parm "$cfg" "dhcp_boot" "--dhcp-boot"
 
        config_get leasefile $cfg leasefile
        [ -e "$leasefile" ] || touch "$leasefile"
@@ -242,13 +250,9 @@ dhcp_option_add() {
        local cfg="$1"
        local name="$2"
 
-       for count in $(seq 0 100); do
-               eval current_value=\$CONFIG_"$cfg"_dhcp"$count"
-               if [ -z "$current_value" ]; then
-                       let "count-=1"
-                       break
-               fi
-               append args "-O $name","$current_value"
+       config_get dhcp_option "$cfg" dhcp_option
+       for o in $dhcp_option; do
+               append args "-O $name","$o"
        done
 
 }
@@ -280,5 +284,10 @@ start() {
 }
 
 stop() {
+       [ -f /tmp/resolv.conf ] && {
+               rm -f /tmp/resolv.conf
+               ln -s /tmp/resolv.conf.auto /tmp/resolv.conf
+       }
        killall dnsmasq
+       return 0
 }