Browse Source

Merge pull request #11897 from pprindeville/fix-dhcpd-startup

Fix dhcpd startup
lilik-openwrt-22.03
Rosen Penev 5 years ago
committed by GitHub
parent
commit
2e49e6e776
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 11 deletions
  1. +1
    -1
      net/isc-dhcp/Makefile
  2. +37
    -10
      net/isc-dhcp/files/dhcpd.init

+ 1
- 1
net/isc-dhcp/Makefile View File

@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=isc-dhcp
UPSTREAM_NAME:=dhcp
PKG_VERSION:=4.4.1
PKG_RELEASE:=5
PKG_RELEASE:=6
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE


+ 37
- 10
net/isc-dhcp/files/dhcpd.init View File

@ -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
}

Loading…
Cancel
Save