curl: bump to 7.57.0 (3 CVEs)
[openwrt/openwrt.git] / package / network / services / dnsmasq / files / dnsmasq.init
index 0149643959761f46fa1e59ab8609c4e7f2c93a3f..2fd56ed4abe6eb13bb3229cf1794f09e181d6880 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"
@@ -273,7 +277,7 @@ dhcp_match_add() {
 
 dhcp_host_add() {
        local cfg="$1"
-       local hosttag nametime addrs duids
+       local hosttag nametime addrs duids macs tags
 
        config_get_bool force "$cfg" force 0
 
@@ -301,7 +305,6 @@ dhcp_host_add() {
        if [ -n "$mac" ]; then
                # --dhcp-host=00:20:e0:3b:13:af,192.168.0.199,lap
                # many MAC are possible to track a laptop ON/OFF dock
-               macs=""
                for m in $mac; do append macs "$m" ","; done
        fi
 
@@ -322,7 +325,6 @@ dhcp_host_add() {
                hex_to_hostid hostid "$hostid"
        fi
 
-       tags=""
        if [ -n "$tag" ]; then
                for t in $tag; do append tags "$t" ",set:"; done
        fi
@@ -755,9 +757,14 @@ dnsmasq_start()
        echo "# auto-generated config file from /etc/config/dhcp" > $CONFIGFILE_TMP
        echo "# auto-generated config file from /etc/config/dhcp" > $HOSTFILE
 
+       local dnsmasqconffile="/etc/dnsmasq.${cfg}.conf"
+       if [ ! -r "$dnsmasqconffile" ]; then
+               dnsmasqconffile=/etc/dnsmasq.conf
+       fi
+
        # if we did this last, we could override auto-generated config
-       [ -f /etc/dnsmasq.conf ] && {
-               xappend "--conf-file=/etc/dnsmasq.conf"
+       [ -f "${dnsmasqconffile}" ] && {
+               xappend "--conf-file=${dnsmasqconffile}"
        }
 
        $PROG --version | grep -osqE "^Compile time options:.* DHCPv6( |$)" && DHCPv6CAPABLE=1 || DHCPv6CAPABLE=0
@@ -835,6 +842,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
@@ -1012,11 +1020,6 @@ dnsmasq_start()
        [ -n "$user_dhcpscript" ] && procd_set_param env USER_DHCPSCRIPT="$user_dhcpscript"
        procd_set_param respawn
 
-       local dnsmasqconffile="/etc/dnsmasq.${cfg}.conf"
-       if [ ! -r "$dnsmasqconffile" ]; then
-               dnsmasqconffile=/etc/dnsmasq.conf
-       fi
-
        procd_add_jail dnsmasq ubus log
        procd_add_jail_mount $CONFIGFILE $TRUSTANCHORSFILE $HOSTFILE $RFC6761FILE /etc/passwd /etc/group /etc/TZ /dev/null /dev/urandom $dnsmasqconffile $dnsmasqconfdir $resolvfile $user_dhcpscript /etc/hosts /etc/ethers /sbin/hotplug-call $EXTRA_MOUNT $DHCPSCRIPT
        procd_add_jail_mount_rw /var/run/dnsmasq/ $leasefile