summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Buechler <cmb@pfsense.org>2014-08-22 07:26:43 -0500
committerChris Buechler <cmb@pfsense.org>2014-08-22 07:28:26 -0500
commitb075c1e2e95891d1ded35b81581f20b897696987 (patch)
tree9106e6da51fe6143df3c55b0d4a8e24e56914bd6
parent61b2ed1c59430f2e0b902a6ed7671f3fb1dd2705 (diff)
downloadpfsense-b075c1e2e95891d1ded35b81581f20b897696987.zip
pfsense-b075c1e2e95891d1ded35b81581f20b897696987.tar.gz
delete the dhcpd.pid file before starting dhcpd. Fixes bug where on rare occasions a stale PID file could prevent dhcpd from starting until it's manually deleted.
-rw-r--r--etc/inc/services.inc8
1 files changed, 8 insertions, 0 deletions
diff --git a/etc/inc/services.inc b/etc/inc/services.inc
index b3c6d33..3099b62 100644
--- a/etc/inc/services.inc
+++ b/etc/inc/services.inc
@@ -893,6 +893,10 @@ EOD;
if (!file_exists("{$g['dhcpd_chroot_path']}/var/db/dhcpd.leases"))
@touch("{$g['dhcpd_chroot_path']}/var/db/dhcpd.leases");
+ /* make sure there isn't a stale dhcpd.pid file, which can make dhcpd fail to start. */
+ /* if we get here, dhcpd has been killed and is not started yet */
+ unlink_if_exists("{$g['dhcpd_chroot_path']}{$g['varrun_path']}/dhcpd.pid");
+
/* fire up dhcpd in a chroot */
if (count($dhcpdifs) > 0) {
mwexec("/usr/local/sbin/dhcpd -user dhcpd -group _dhcp -chroot {$g['dhcpd_chroot_path']} -cf /etc/dhcpd.conf -pf {$g['varrun_path']}/dhcpd.pid " .
@@ -1300,6 +1304,10 @@ EOD;
if (!file_exists("{$g['dhcpd_chroot_path']}/var/db/dhcpd6.leases"))
@touch("{$g['dhcpd_chroot_path']}/var/db/dhcpd6.leases");
+ /* make sure there isn't a stale dhcpdv6.pid file, which may make dhcpdv6 fail to start. */
+ /* if we get here, dhcpdv6 has been killed and is not started yet */
+ unlink_if_exists("{$g['dhcpd_chroot_path']}{$g['varrun_path']}/dhcpdv6.pid");
+
/* fire up dhcpd in a chroot */
if (count($dhcpdv6ifs) > 0) {
mwexec("/usr/local/sbin/dhcpd -6 -user dhcpd -group _dhcp -chroot {$g['dhcpd_chroot_path']} -cf /etc/dhcpdv6.conf -pf {$g['varrun_path']}/dhcpdv6.pid " .
OpenPOWER on IntegriCloud