From 6f5d8f0cce3c8eeab754f00ad2e367ffc83112b2 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Mon, 12 Sep 2016 20:20:08 +0100 Subject: [PATCH] Start unbound+DHCP bridge only when DHCP server is running Signed-off-by: Michael Tremer --- src/initscripts/init.d/dhcp | 12 ++++++++++++ src/initscripts/init.d/unbound | 14 -------------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/initscripts/init.d/dhcp b/src/initscripts/init.d/dhcp index 083a555a3..2182bc4b3 100644 --- a/src/initscripts/init.d/dhcp +++ b/src/initscripts/init.d/dhcp @@ -7,7 +7,9 @@ . /etc/sysconfig/rc . $rc_functions + eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings) +eval $(/usr/local/bin/readhash /var/ipfire/dhcp/settings) function flush_chains() { iptables -F DHCPGREENINPUT @@ -36,6 +38,12 @@ case "$1" in boot_mesg "Starting DHCP Server..." loadproc /usr/sbin/dhcpd -q ${devices} + # Start Unbound DHCP Lease Bridge unless RFC2136 is used + if [ "${DNS_UPDATE_ENABLED}" != on ]; then + boot_mesg "Starting Unbound DHCP Leases Bridge..." + loadproc /usr/sbin/unbound-dhcp-leases-bridge -d + fi + (sleep 5 && chmod 644 /var/run/dhcpd.pid) & # Fix because silly dhcpd creates its pid with mode 640 ;; @@ -52,6 +60,9 @@ case "$1" in echo_ok; exit 0 fi + + boot_mesg "Stopping Unbound DHCP Leases Bridge..." + killproc /usr/sbin/unbound-dhcp-leases-bridge ;; reload) @@ -67,6 +78,7 @@ case "$1" in status) statusproc /usr/sbin/dhcpd + statusproc /usr/sbin/unbound-dhcp-leases-bridge ;; *) diff --git a/src/initscripts/init.d/unbound b/src/initscripts/init.d/unbound index f3d35cf48..a29864a3b 100644 --- a/src/initscripts/init.d/unbound +++ b/src/initscripts/init.d/unbound @@ -3,9 +3,6 @@ # Description : Unbound DNS resolver boot script for IPfire # Author : Marcel Lorenz -# -# Comment : This init script additional starts the dhcpd watcher daemon -# if DNS-Update (RFC2136) in web interface enabled . /etc/sysconfig/rc . ${rc_functions} @@ -169,7 +166,6 @@ get_memory_amount() { case "$1" in start) eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings) - eval $(/usr/local/bin/readhash /var/ipfire/dhcp/settings) # Create control keys at first run if [ ! -r "/etc/unbound/unbound_control.key" ]; then @@ -186,18 +182,9 @@ case "$1" in # Update any known forwarding name servers update_forwarders - - # Start Unbound DHCP Lease Bridge unless RFC2136 is used - if [ "${DNS_UPDATE_ENABLED}" != on ]; then - boot_mesg "Starting Unbound DHCP Leases Bridge..." - loadproc /usr/sbin/unbound-dhcp-leases-bridge -d - fi ;; stop) - boot_mesg "Stopping Unbound DHCP Leases Bridge..." - killproc /usr/sbin/unbound-dhcp-leases-bridge - boot_mesg "Stopping Unbound DNS Proxy..." killproc /usr/sbin/unbound ;; @@ -210,7 +197,6 @@ case "$1" in status) statusproc /usr/sbin/unbound - statusproc /usr/sbin/unbound-dhcp-leases-bridge ;; update-forwarders)