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
This commit is contained in:
Ben Smithurst 2025-01-04 19:28:31 +00:00 committed by GitHub
parent 4836083503
commit b962ccd3ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);