isc-dhcp: improve startup performance
On some platforms where interfaces come up very slowly, this can cause a race-condition with dhcpd coming up before all the interfaces have finished initializing. Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
This commit is contained in:
parent
56e9d83cf8
commit
8193eb5952
2 changed files with 38 additions and 11 deletions
|
@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
|
||||||
PKG_NAME:=isc-dhcp
|
PKG_NAME:=isc-dhcp
|
||||||
UPSTREAM_NAME:=dhcp
|
UPSTREAM_NAME:=dhcp
|
||||||
PKG_VERSION:=4.4.1
|
PKG_VERSION:=4.4.1
|
||||||
PKG_RELEASE:=5
|
PKG_RELEASE:=6
|
||||||
|
|
||||||
PKG_LICENSE:=BSD-3-Clause
|
PKG_LICENSE:=BSD-3-Clause
|
||||||
PKG_LICENSE_FILES:=LICENSE
|
PKG_LICENSE_FILES:=LICENSE
|
||||||
|
|
|
@ -270,7 +270,16 @@ general_config() {
|
||||||
echo "nameserver 127.0.0.1" >> /tmp/resolv.conf
|
echo "nameserver 127.0.0.1" >> /tmp/resolv.conf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# base procd hooks
|
||||||
|
|
||||||
|
boot() {
|
||||||
|
DHCPD_BOOT=1
|
||||||
|
start "$@"
|
||||||
|
}
|
||||||
|
|
||||||
start_service() {
|
start_service() {
|
||||||
|
local domain dhcp_ifs authoritative
|
||||||
|
|
||||||
if [ -n "$DHCPD_BOOT" ] ; then
|
if [ -n "$DHCPD_BOOT" ] ; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
@ -279,15 +288,13 @@ start_service() {
|
||||||
touch $lease_file
|
touch $lease_file
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local domain dhcp_ifs
|
|
||||||
|
|
||||||
if [ -e "/etc/dhcpd.conf" ] ; then
|
if [ -e "/etc/dhcpd.conf" ] ; then
|
||||||
config_file="/etc/dhcpd.conf"
|
config_file="/etc/dhcpd.conf"
|
||||||
else
|
else
|
||||||
. /lib/functions/network.sh
|
. /lib/functions/network.sh
|
||||||
|
|
||||||
config_load dhcp
|
config_load dhcp
|
||||||
local authoritative
|
|
||||||
general_config > $config_file
|
general_config > $config_file
|
||||||
|
|
||||||
config_foreach dhcpd_add dhcp
|
config_foreach dhcpd_add dhcp
|
||||||
|
@ -302,13 +309,33 @@ start_service() {
|
||||||
procd_close_instance
|
procd_close_instance
|
||||||
}
|
}
|
||||||
|
|
||||||
boot() {
|
reload_service() {
|
||||||
DHCPD_BOOT=1
|
rc_procd start_service "$@"
|
||||||
start "$@"
|
prodcd_send_signal dhcpd "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
service_triggers()
|
add_interface_trigger() {
|
||||||
{
|
local cfg=$1
|
||||||
procd_add_reload_trigger "dhcp"
|
local trigger ignore
|
||||||
procd_add_raw_trigger "interface.*" 3000 /etc/init.d/dhcpd reload
|
|
||||||
|
config_get trigger "$cfg" interface
|
||||||
|
config_get_bool ignore "$cfg" ignore 0
|
||||||
|
|
||||||
|
if [ -n "$trigger" -a $ignore -eq 0 ] ; then
|
||||||
|
procd_add_reload_interface_trigger "$trigger"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
service_triggers() {
|
||||||
|
if [ -n "$DHCPD_BOOT" ] ; then
|
||||||
|
# Make the first start robust to slow interfaces; wait a while
|
||||||
|
procd_add_raw_trigger "interface.*.up" 5000 /etc/init.d/dhcpd restart
|
||||||
|
|
||||||
|
else
|
||||||
|
# reload with normal parameters
|
||||||
|
procd_add_reload_trigger "network" "dhcp"
|
||||||
|
config_load dhcp
|
||||||
|
config_foreach add_interface_trigger dhcp
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue