On 2024/03/03 16:17, Kirill A. Korinsky wrote: > On Wed, 10 Jan 2024 21:21:22 +0100, > Stuart Henderson wrote: > > > > hrmmm, that doesn't make sense, if it can't write to /var/db/dhcpd.leases > > due to permissions, it shouldn't be able to write to /var/db/dhcpd.leases~ > > either.. > > > > I'll try and find some time to do a test install and figure out what's > > going on, but it won't be for a few days > > Any chance that this will be fixed in 7.5? > > -- > wbr, Kirill >
I don't think there's a good way to automate the move, so probably best to just warn people and allow startup to fail if the file is not present (i.e. remove the "touch" from rc script). At least if dhcpd fails to start it's more obvious and likely simpler to fix than if it starts and hands out addresses which are different from (possibly long-standing) leases. I added an install message showing people what to do and modified the path in CONFIGURE_ARGS rather than the startup script. So how does this look.. Index: Makefile =================================================================== RCS file: /cvs/ports/net/isc-dhcp/Makefile,v retrieving revision 1.66 diff -u -p -r1.66 Makefile --- Makefile 27 Sep 2023 14:18:12 -0000 1.66 +++ Makefile 3 Mar 2024 17:03:51 -0000 @@ -3,7 +3,7 @@ COMMENT-client= ISC DHCP Client COMMENT-omapi= ISC DHCP OMAPI VERSION= 4.4.3-P1 -REVISION= 0 +REVISION= 1 DISTNAME= isc-dhcp-${VERSION} PKGNAME-main= isc-dhcp-server-${VERSION:S/-P/pl/} @@ -32,7 +32,9 @@ COMPILER_LANGS= c USE_GMAKE= Yes CONFIGURE_STYLE= gnu CONFIGURE_ARGS+= --enable-early-chroot \ - --enable-paranoia + --enable-paranoia \ + --with-srv-lease-file=/var/db/isc-dhcp/dhcpd.leases \ + --with-srv6-lease-file=/var/db/isc-dhcp/dhcpd6.leases NO_TEST= Yes @@ -60,6 +62,8 @@ post-install: ${SETENV} ${MAKE_ENV} ${FAKE_SETUP} ${MAKE_PROGRAM} ${ALL_FAKE_FLAGS} install ${INSTALL_DATA_DIR} ${PREFIX}/${EXAMPLEDIR} ${INSTALL_SCRIPT} ${FILESDIR}/dhclient-script ${PREFIX}/sbin + ${INSTALL_SCRIPT} ${WRKSRC}/contrib/dhcp-lease-list.pl \ + ${PREFIX}/bin/dhcp-lease-list ${INSTALL_DATA} ${WRKSRC}/server/dhcpd.conf.example \ ${PREFIX}/${EXAMPLEDIR}/dhcpd.conf ${INSTALL_DATA} ${WRKSRC}/client/dhclient.conf.example \ Index: patches/patch-contrib_dhcp-lease-list_pl =================================================================== RCS file: patches/patch-contrib_dhcp-lease-list_pl diff -N patches/patch-contrib_dhcp-lease-list_pl --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-contrib_dhcp-lease-list_pl 3 Mar 2024 17:03:51 -0000 @@ -0,0 +1,51 @@ +Index: contrib/dhcp-lease-list.pl +--- contrib/dhcp-lease-list.pl.orig ++++ contrib/dhcp-lease-list.pl +@@ -27,12 +27,11 @@ use strict; + use warnings; + use POSIX qw(strftime); + +-my @LEASES = ('/var/db/dhcpd.leases', '/var/lib/dhcp/dhcpd.leases', '/var/lib/dhcp3/dhcpd.leases'); ++my @LEASES = ('/var/db/dhcpd/dhcpd.leases'); + my @all_leases; + my @leases; + +-my @OUIS = ('/usr/share/misc/oui.txt', '/usr/local/etc/oui.txt'); +-my $OUI_URL = 'http://standards-oui.ieee.org/oui.txt'; ++my @OUIS = ('/usr/local/share/arp-scan/ieee-oui.txt'); + my $oui; + + my %data; +@@ -47,8 +46,9 @@ sub get_manufactorer_for_mac($) { + my $manu = "-NA-"; + + if (defined $oui) { +- $manu = join('-', ($_[0] =~ /^(..):(..):(..):/)); +- $manu = `grep -i '$manu' $oui | cut -f3`; ++ # XXX only handles 24-bit (MA-L) entries, not MA-S/MA-M ++ $manu = join('', ($_[0] =~ /^(..):(..):(..):/)); ++ $manu = `grep -i '^$manu' $oui | cut -f2`; + $manu =~ s/^\s+|\s+$//g; + } + +@@ -66,8 +66,7 @@ sub check_oui_file() { + } + + if (not defined $oui) { +- print(STDERR "To get manufacturer names please download $OUI_URL "); +- print(STDERR "to /usr/local/etc/oui.txt\n"); ++ print(STDERR "To get manufacturer names, 'pkg_add mac-vendor'\n"); + } + } + +@@ -191,9 +190,7 @@ sub cli_processing() { + " --last prints the last (even if end<now) entry for every MAC\n". + " --all prints all entries i.e. more than one per MAC\n". + " --lease uses the next argument as the name of the lease file\n". +- " the default is to try /var/db/dhcpd.leases then\n". +- " /var/lib/dhcp/dhcpd.leases then\n". +- " /var/lib/dhcp3/dhcpd.leases\n". ++ " the default is to try /var/db/isc-dhcpd/dhcpd.leases\n". + "\n"); + exit(0); + } elsif ($arg eq '--parsable') { Index: pkg/MESSAGE-main =================================================================== RCS file: pkg/MESSAGE-main diff -N pkg/MESSAGE-main --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ pkg/MESSAGE-main 3 Mar 2024 17:03:51 -0000 @@ -0,0 +1,4 @@ +If updating from earlier than isc-dhcp-server-4.4.3pl1p1, move/copy old leases: +# cd /var/db/isc-dhcp; mv ../dhcpd.leases .; chown _isc_dhcp:_isc_dhcp * +If configuring from scratch, install an empty leases file: +# install -o _isc_dhcp -g _isc_dhcp /dev/null /var/db/isc-dhcp/dhcpd.leases Index: pkg/PLIST-main =================================================================== RCS file: /cvs/ports/net/isc-dhcp/pkg/PLIST-main,v retrieving revision 1.8 diff -u -p -r1.8 PLIST-main --- pkg/PLIST-main 8 Nov 2022 11:14:57 -0000 1.8 +++ pkg/PLIST-main 3 Mar 2024 17:03:51 -0000 @@ -4,6 +4,7 @@ @newuser _isc-dhcp:744:_isc-dhcp::ISC DHCP user:/nonexistent:/sbin/nologin @rcscript ${RCDIR}/isc_dhcpd @rcscript ${RCDIR}/isc_dhcrelay +bin/dhcp-lease-list @man man/man5/dhcp-eval.5 @man man/man5/dhcp-options.5 @man man/man5/dhcpd.conf.5 @@ -16,4 +17,12 @@ @bin sbin/keama share/examples/isc-dhcp/ share/examples/isc-dhcp/dhcpd.conf -@extra /var/db/dhcpd.leases +@mode 755 +@owner _isc-dhcp +@group _isc-dhcp +@sample /var/db/isc-dhcpd/ +@mode +@owner +@group +@extra /var/db/isc-dhcpd/dhcpd.leases +@extra /var/db/isc-dhcpd/dhcpd6.leases Index: pkg/isc_dhcpd.rc =================================================================== RCS file: /cvs/ports/net/isc-dhcp/pkg/isc_dhcpd.rc,v retrieving revision 1.4 diff -u -p -r1.4 isc_dhcpd.rc --- pkg/isc_dhcpd.rc 9 Mar 2022 18:09:53 -0000 1.4 +++ pkg/isc_dhcpd.rc 3 Mar 2024 17:03:51 -0000 @@ -7,8 +7,4 @@ daemon_flags="-user _isc-dhcp -group _is rc_reload=NO -rc_pre() { - touch /var/db/dhcpd.leases -} - rc_cmd $1