dnsmasq: add listen_address parameter
[openwrt/openwrt.git] / package / network / services / dnsmasq / files / dnsmasq.init
index 533945c2a4c0b5fbebc2186eb32c7a36799ae04b..3d3d83334e0073b1092320a25a553513ca25c3db 100644 (file)
@@ -142,6 +142,10 @@ append_interface() {
        xappend "--interface=$ifname"
 }
 
+append_listenaddress() {
+       xappend "--listen-address=$1"
+}
+
 append_notinterface() {
        network_get_device ifname "$1" || ifname="$1"
        xappend "--except-interface=$ifname"
@@ -319,7 +323,7 @@ dhcp_host_add() {
        fi
 
        if [ -n "$hostid" ]; then
-                       hex_to_hostid hostid "$hostid"
+               hex_to_hostid hostid "$hostid"
        fi
 
        tags=""
@@ -383,8 +387,8 @@ dhcp_this_host_add() {
                                for lanaddr6 in $lanaddrs6 ; do
                                        case "$lanaddr6" in
                                        "${ulaprefix%%:/*}"*)
-                                                       dhcp_domain_add "" "$routername" "$lanaddr6"
-                                                       ;;
+                                               dhcp_domain_add "" "$routername" "$lanaddr6"
+                                               ;;
                                        esac
                                done
                        fi
@@ -457,9 +461,7 @@ dhcp_add() {
        config_get networkid "$cfg" networkid
        [ -n "$networkid" ] || networkid="$net"
 
-       network_get_subnet subnet "$net" || return 0
        network_get_device ifname "$net" || return 0
-       network_get_protocol proto "$net" || return 0
 
        [ "$cachelocal" = "0" ] && network_get_dnsserver dnsserver "$net" && {
                DNS_SERVERS="$DNS_SERVERS $dnsserver"
@@ -471,6 +473,9 @@ dhcp_add() {
                return 0
        }
 
+       network_get_subnet subnet "$net" || return 0
+       network_get_protocol proto "$net" || return 0
+
        # Do not support non-static interfaces for now
        [ static = "$proto" ] || return 0
 
@@ -834,6 +839,7 @@ dnsmasq_start()
        append_parm "$cfg" "maxport" "--max-port"
        append_parm "$cfg" "domain" "--domain"
        append_parm "$cfg" "local" "--server"
+       config_list_foreach "$cfg" "listen_address" append_listenaddress
        config_list_foreach "$cfg" "server" append_server
        config_list_foreach "$cfg" "rev_server" append_rev_server
        config_list_foreach "$cfg" "address" append_address