On Thu, Aug 18, 2022 at 08:53:51PM +0100, Jason McIntyre wrote:
> On Thu, Aug 18, 2022 at 07:29:42PM +0000, Klemens Nanni wrote:
> > There is dhcpleasectl(8) -l but that only works for currently
> > configured leases/interfaces and does not print all information
> > contained in the lease file (mostly tailored to fit the installer's
> > needs).
> > 
> > Feedback? OK?
> > 
> 
> hi.
> 
> - in general i like this. i didn;t know about it, and am currently
>   having to run dhcpleasectl to get the info (and generating a temp
>   file so a script can read it!)
> 
> - when you say dhcpleasectl only works "for currently configured
>   leases/interfaces" how does this differ? you mean it shows you the
>   last lease, even if one is not currently in use?

Lease file stay behind until manually removed or overwritten with fresh
leases, so you need to know what's what when parsing them:
        $ ls /var/db/dhcpleased/
        athn0    cdce0    em0      trunk0   urndis0

For example, there is no cdce0 or urndis0 right now on my box, those are
from past tethering situations and those lease files are useless now.

You can always parse those files but it does not always make sense and
nothing prevents you from dealing with old useless data.

dhcpleasectl on the other hand will check for autoconf set:
        $ dhcpleasectl -l athn0
        dhcpleasectl: non-autoconf interface athn0
        $ dhcpleasectl -l trunk0
        trunk0 [Bound]
                inet 192.168.0.109 netmask 255.255.255.0
                default gateway 192.168.0.1
                nameservers 192.168.0.1
                lease 1 hours
                dhcp server 192.168.0.1

> 
> - i prefer the wording "Interface specific lease files." but that's just
>   a suggestion.

Sure, why not.


Index: dhcpleased.8
===================================================================
RCS file: /cvs/src/sbin/dhcpleased/dhcpleased.8,v
retrieving revision 1.4
diff -u -p -r1.4 dhcpleased.8
--- dhcpleased.8        23 Aug 2021 18:09:05 -0000      1.4
+++ dhcpleased.8        18 Aug 2022 20:34:38 -0000
@@ -72,7 +72,7 @@ Multiple
 options increase the verbosity.
 .El
 .Sh FILES
-.Bl -tag -width "/dev/dhcpleased.sockXX" -compact
+.Bl -tag -width "/var/db/dhcpleased/<if>" -compact
 .It Pa /dev/dhcpleased.sock
 .Ux Ns -domain
 socket used for communication with
@@ -81,6 +81,8 @@ socket used for communication with
 Default
 .Nm
 configuration file.
+.It Pa /var/db/dhcpleased/ Ns Aq Ar if
+Interface specific lease files.
 .El
 .Sh SEE ALSO
 .Xr dhcpleased.conf 5 ,

Reply via email to