@ -270,7 +270,16 @@ general_config() {
echo "nameserver 127.0.0.1" >> /tmp/resolv.conf
}
# base procd hooks
boot() {
DHCPD_BOOT=1
start "$@"
}
start_service() {
local domain dhcp_ifs authoritative
if [ -n "$DHCPD_BOOT" ] ; then
return 0
fi
@ -279,15 +288,13 @@ start_service() {
touch $lease_file
fi
local domain dhcp_ifs
if [ -e "/etc/dhcpd.conf" ] ; then
config_file="/etc/dhcpd.conf"
else
. /lib/functions/network.sh
config_load dhcp
local authoritative
general_config > $config_file
config_foreach dhcpd_add dhcp
@ -302,13 +309,33 @@ start_service() {
procd_close_instance
}
boot () {
DHCPD_BOOT=1
start "$@"
reload_service () {
rc_procd start_service "$@"
prodcd_send_signal dhcpd "$@"
}
service_triggers()
{
procd_add_reload_trigger "dhcp"
procd_add_raw_trigger "interface.*" 3000 /etc/init.d/dhcpd reload
add_interface_trigger() {
local cfg=$1
local trigger ignore
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
}