From: | "Robert Wolf" <r.wolf.conf@gmail.com> |
To: | dhcp-bugs@isc.org |
Date: | Fri, 20 Oct 2017 16:17:25 +0200 (CEST) |
Subject: | A few fixes in dhcp-lease-list.pl |
Dear sirs,
I made simple updates to contrib/dhcp-lease-list.pl.
First change is to use perl hash array for searching manufacturer instead of
starting grep for every MAC address, which is too slow.
Second change is to output progress to STDERR instead of to STDOUT to not mix
with leases.
Third change is fix of condition:
} elsif (not defined $tmp_leases{$mac} or $tmp_leases{$mac}{'date_end'} gt $date_end) {
to
} elsif (not defined $tmp_leases{$mac} or $tmp_leases{$mac}{'date_end'} le $date_end) {
In original code, there is comparision "gt", I have changed to le. In my case,
there are some hosts in network, they change their name. They are VMs created
from template but finally renamed to final name. This script finds as first the
lease with template name and end time E1. There are other younger leases with
correct (new) name too, but they have newer/younger/later time E2 (E1<E2). But
this code sets \%entry to $tmp_leases{$mac} only if E1>E2. I.e. it prefers
older records:
- either it replaces newer record containing correct new/current name with
older record containing template name, which is IMHO incorrect.
- or if the oldest record containing template name is already stored, it will
not be updated to newer record containing new name, becase newer records has
greater end time than older record.
Therefore I have changed "$tmp_leases{$mac}{'date_end'} gt $date_end" to
"$tmp_leases{$mac}{'date_end'} le $date_end".
Do you agree with these fixes? Can you merge this patch to your repository?
Thank you very much.
Kind regards.
Robert Wolf.
Message body is not shown because sender requested not to inline it.