From b962ccd3edb0719b4159cdde6675e5d03a629ca9 Mon Sep 17 00:00:00 2001 From: Ben Smithurst Date: Sat, 4 Jan 2025 19:28:31 +0000 Subject: [PATCH] dhcpd6 prefixes script can fail to restart (#8109) * redirect sleep output to avoid it holding the pipe to daemon process open * add comment explaining the sleep * use daemon -m0 parameter to prevent restart failures This was changed from a simple redirect of the sleep command after discussion with Franco on https://github.com/opnsense/core/pull/8109 --- src/etc/inc/plugins.inc.d/dhcpd.inc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/etc/inc/plugins.inc.d/dhcpd.inc b/src/etc/inc/plugins.inc.d/dhcpd.inc index ed3d71588..71e4a96cd 100644 --- a/src/etc/inc/plugins.inc.d/dhcpd.inc +++ b/src/etc/inc/plugins.inc.d/dhcpd.inc @@ -1583,7 +1583,11 @@ EOD; if (count($dhcpdv6ifs) > 0) { mwexec('/usr/local/sbin/dhcpd -6 -user dhcpd -group dhcpd -chroot /var/dhcpd -cf /etc/dhcpdv6.conf -pf /var/run/dhcpdv6.pid ' . join(' ', $dhcpdv6ifs)); - mwexecf('/usr/sbin/daemon -f -p %s %s', ['/var/run/dhcpleases6.pid', '/usr/local/opnsense/scripts/dhcp/prefixes.sh']); + + # The -m0 parameter prevents the script keeping a pipe connection open + # to the daemon parent process, which can cause restart failures, due to + # the sleep process running for longer than the shell script. + mwexecf('/usr/sbin/daemon -m0 -f -p %s %s', ['/var/run/dhcpleases6.pid', '/usr/local/opnsense/scripts/dhcp/prefixes.sh']); } service_log("done.\n", $verbose);