header.pl: Fix parsing BOOTP leases

If the lease has been handed out over BOOTP, it will never expire.
However, the parser did not account for this case at all which is fixed
in this patch.

Fixes: #13689 - BOOTP breaks the list of DHCP leases due to erroneous parsing
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
This commit is contained in:
Michael Tremer
2024-05-15 13:20:03 +00:00
committed by Arne Fitzenreiter
parent 25b6a76646
commit 6515a27802

View File

@@ -454,12 +454,16 @@ END
$hostname = "";
}
if ($line =~ /^\s*ends/) {
$line =~ /(\d+)\/(\d+)\/(\d+) (\d+):(\d+):(\d+)/;
if ($line =~ /^\s*ends \d (\d+)\/(\d+)\/(\d+) (\d+):(\d+):(\d+)/) {
$endtime = timegm($6, $5, $4, $3, $2 - 1, $1 - 1900);
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $dst) = localtime($endtime);
$endtime_print = sprintf ("%02d/%02d/%d %02d:%02d:%02d",$mday,$mon+1,$year+1900,$hour,$min,$sec);
$expired = $endtime < time();
} elsif ($line =~ /^\s*ends never/) {
$endtime = 0;
$endtime_print = $Lang::tr{'never'};
$expired = 0;
}
if ($line =~ /^\s*hardware ethernet/) {