dnsmasq: restore ability to include/exclude raw device names
[openwrt/openwrt.git] / package / network / services / dnsmasq / files / dnsmasq.init
index d5177ecb0ca652f2f8100bf610885f2fcb386f1b..6f985b2417c10c311e232e63bdc4dfc5766d5b98 100644 (file)
@@ -125,6 +125,10 @@ append_server() {
        xappend "--server=$1"
 }
 
        xappend "--server=$1"
 }
 
+append_rev_server() {
+        xappend "--rev-server=$1"
+}
+
 append_address() {
        xappend "--address=$1"
 }
 append_address() {
        xappend "--address=$1"
 }
@@ -134,12 +138,12 @@ append_ipset() {
 }
 
 append_interface() {
 }
 
 append_interface() {
-       network_get_device ifname "$1" || return
+       network_get_device ifname "$1" || ifname="$1"
        xappend "--interface=$ifname"
 }
 
 append_notinterface() {
        xappend "--interface=$ifname"
 }
 
 append_notinterface() {
-       network_get_device ifname "$1" || return
+       network_get_device ifname "$1" || ifname="$1"
        xappend "--except-interface=$ifname"
 }
 
        xappend "--except-interface=$ifname"
 }
 
@@ -440,6 +444,7 @@ dhcp_add() {
        local cfg="$1"
        local dhcp6range="::"
        local nettag
        local cfg="$1"
        local dhcp6range="::"
        local nettag
+       local tags
 
        config_get net "$cfg" interface
        [ -n "$net" ] || return 0
 
        config_get net "$cfg" interface
        [ -n "$net" ] || return 0
@@ -491,6 +496,12 @@ dhcp_add() {
        dhcp_this_host_add "$net" "$ifname" "$ADD_LOCAL_FQDN"
 
        start="$( dhcp_calc "$start" )"
        dhcp_this_host_add "$net" "$ifname" "$ADD_LOCAL_FQDN"
 
        start="$( dhcp_calc "$start" )"
+
+       add_tag() {
+               tags="${tags}tag:$1,"
+       }
+       config_list_foreach "$cfg" tag add_tag
+
        nettag="${networkid:+set:${networkid},}"
 
        if [ "$limit" -gt 0 ] ; then
        nettag="${networkid:+set:${networkid},}"
 
        if [ "$limit" -gt 0 ] ; then
@@ -508,7 +519,7 @@ dhcp_add() {
 
 
        if [ "$dhcpv4" != "disabled" ] ; then
 
 
        if [ "$dhcpv4" != "disabled" ] ; then
-               xappend "--dhcp-range=$nettag$START,$END,$NETMASK,$leasetime${options:+ $options}"
+               xappend "--dhcp-range=$tags$nettag$START,$END,$NETMASK,$leasetime${options:+ $options}"
        fi
 
 
        fi
 
 
@@ -816,6 +827,7 @@ dnsmasq_start()
        append_parm "$cfg" "domain" "--domain"
        append_parm "$cfg" "local" "--server"
        config_list_foreach "$cfg" "server" append_server
        append_parm "$cfg" "domain" "--domain"
        append_parm "$cfg" "local" "--server"
        config_list_foreach "$cfg" "server" append_server
+       config_list_foreach "$cfg" "rev_server" append_rev_server
        config_list_foreach "$cfg" "address" append_address
        config_list_foreach "$cfg" "ipset" append_ipset
        config_list_foreach "$cfg" "interface" append_interface
        config_list_foreach "$cfg" "address" append_address
        config_list_foreach "$cfg" "ipset" append_ipset
        config_list_foreach "$cfg" "interface" append_interface