Start unbound+DHCP bridge only when DHCP server is running

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Michael Tremer
2016-09-12 20:20:08 +01:00
parent a66c4880d9
commit 6f5d8f0cce
2 changed files with 12 additions and 14 deletions

View File

@@ -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
;;
*)

View File

@@ -3,9 +3,6 @@
# Description : Unbound DNS resolver boot script for IPfire
# Author : Marcel Lorenz <marcel.lorenz@ipfire.org>
#
# 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)