<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8">
</head>
<body>
<div style="font-family:sans-serif"><div style="white-space:normal">
<p dir="auto">I haven't seen follow-up to this yet, so here is my tuppence-worth.</p>
<p dir="auto">On 18 Aug 2020, at 4:07, ksladic wrote:</p>
<blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px">
<p dir="auto">Regarding lease file cleanup:<br>
1. Does it remove all expired leases?</p>
</blockquote>
<p dir="auto">No, because removing them would not be consistence with the<br>
<a href="https://tools.ietf.org/html/rfc2131#section-2.2" style="color:#3983C4">service definition</a>:</p>
<p dir="auto">"The<br>
allocation mechanism (the collection of DHCP servers) guarantees not<br>
to reallocate that address within the requested time and <strong>attempts to<br>
return the same network address each time the client requests an<br>
address</strong>." (My emphasis)</p>
<p dir="auto">This means that an expired lease should be retained for use in case the<br>
client ever requests it again.</p>
<blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px">
<ol>
<li value="2">Does it remove duplicate leases ... keeping only last valid one?</li>
</ol>
</blockquote>
<p dir="auto">Yes, but a lease is identified for this purpose by its IP address,<br>
not by any property of the client, such as MAC address or UUID,<br>
or so I recall.</p>
<p dir="auto">It follows that an expired lease which, because of depletion of the<br>
lease pool, is assigned to a different client, may lose its association<br>
with an earlier client.</p>
<blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px">
<ol>
<li value="3">In general (before or after lease file cleanup) if I would like to find
the latest valid leased IP for a client, is it best to go through whole file
and pick valid lease with latest timestamp? Because as I understand I can
not rely on the order of leases in the file.</li>
</ol>
</blockquote>
<p dir="auto">It's easy but tedious to write a script to do this. I may have one which was<br>
once in production in some backup somewhere, but you can probably code one<br>
faster than I could find it again.</p>
<p dir="auto">I hope this helps.</p>
<p dir="auto">Niall O'Reilly</p>
</div>
</div>
</body>
</html>