From: Michael Tremer Date: Wed, 15 May 2024 13:20:03 +0000 (+0000) Subject: header.pl: Fix parsing BOOTP leases X-Git-Tag: v2.29-core186~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6515a2780201e9209e370cd4562bef5cb771f1a5;p=ipfire-2.x.git 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 Signed-off-by: Arne Fitzenreiter --- diff --git a/config/cfgroot/header.pl b/config/cfgroot/header.pl index 5164e9731b..a67ff92ee1 100644 --- a/config/cfgroot/header.pl +++ b/config/cfgroot/header.pl @@ -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/) {