dhcp-lease-list lease ordering
Hi, I believe that the output ordering of dhcp-lease-list.pl ensured by this code (line 137-141):
if ($opt_keep eq 'all') {
push(@leases, \%entry);
} elsif (not defined $tmp_leases{$mac} or $tmp_leases{$mac}{'date_end'} gt $date_end) {
$tmp_leases{$mac} = \%entry;
}
is the exact opposite of what is stated in the script help (it will print the oldest lease).
I propose changing the comparison to lt:
if ($opt_keep eq 'all') {
push(@leases, \%entry);
} elsif (not defined $tmp_leases{$mac} or $tmp_leases{$mac}{'date_end'} gt $date_end) {
$tmp_leases{$mac} = \%entry;
}
to print the latest lease.