diff --git a/Makefile b/Makefile index cb763abd9..406dfa521 100644 --- a/Makefile +++ b/Makefile @@ -136,7 +136,6 @@ CORE_DEPENDS?= ca_root_nss \ choparp \ cpustats \ dhcp6c \ - dhcpleases \ dnsmasq \ dpinger \ expiretable \ diff --git a/plist b/plist index bcc9adc25..96f764a27 100644 --- a/plist +++ b/plist @@ -741,6 +741,7 @@ /usr/local/opnsense/scripts/dhcp/dnsmasq_watcher.py /usr/local/opnsense/scripts/dhcp/get_leases.py /usr/local/opnsense/scripts/dhcp/prefixes.php +/usr/local/opnsense/scripts/dhcp/prefixes.sh /usr/local/opnsense/scripts/dhcp/unbound_watcher.py /usr/local/opnsense/scripts/dns/query_dns.py /usr/local/opnsense/scripts/filter/delete_table.py diff --git a/src/etc/inc/plugins.inc.d/dhcpd.inc b/src/etc/inc/plugins.inc.d/dhcpd.inc index 99bc0c07b..9df42c9ab 100644 --- a/src/etc/inc/plugins.inc.d/dhcpd.inc +++ b/src/etc/inc/plugins.inc.d/dhcpd.inc @@ -1597,10 +1597,7 @@ EOD; /* fire up dhcpd in a chroot */ 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/local/sbin/dhcpleases6 -c %s -l %s', array( - '/usr/local/sbin/configctl dhcpd update prefixes', - '/var/dhcpd/var/db/dhcpd6.leases', - )); + mwexecf('/usr/sbin/daemon -f -p %s %s', ['/var/run/dhcpleases6.pid', '/usr/local/opnsense/scripts/dhcp/prefixes.sh']); } if ($verbose) { diff --git a/src/opnsense/scripts/dhcp/prefixes.sh b/src/opnsense/scripts/dhcp/prefixes.sh new file mode 100755 index 000000000..b6b8add5d --- /dev/null +++ b/src/opnsense/scripts/dhcp/prefixes.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +# Copyright (C) 2022 Franco Fichtner +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, +# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +INTERVAL=${1:-60} + +while :; do + sleep "${INTERVAL}" + configctl dhcpd update prefixes +done