Restarting DHCP safely whilst avoiding partner-down state

Terry Burton tez at terryburton.co.uk
Sun May 15 02:27:40 UTC 2016


On 14 May 2016 at 04:12, Chuck Anderson <cra at wpi.edu> wrote:
> On Fri, May 13, 2016 at 07:49:12PM +0100, Terry Burton wrote:
>> On 13 May 2016 at 19:26, Simon Hobson <dhcp1 at thehobsons.co.uk> wrote:
>> > Chuck Anderson <cra at WPI.EDU> wrote:
>> >
>> >> Is there a way to signal dhcpd to write out the lease file so it can
>> >> be checked?
>> >
>> > Surely a simple change would be to not act on a normal kill signal in the middle of a lease file write ? Capture that the signal arrived, and act on it as soon as the complete lease has been written.
>> > That one change alone would completely remove the "wrote half a lease to the file" issue.
>>
>> I couldn't agree more...
>
> Since the code to close a lease file and start appending to a new one
> already exists, it doesn't seem a stretch to just call that code in
> the SIGTERM handler...

Might be even more simple than that but haven't traced the process.

Using "gentle shutdown" it appears that the signal handler simply sets
a shutdown flag then returns control. Therefore in the case that the
leases db is midway through (or mid-printf) the routine (or libc
function) will resume to complete the write. The dispatcher later acts
on the shutdown flag bringing things to a controlled stop.
Short-circuiting the failover state transitions may be all that's
required to get the necessary operational semantics for a rapid
restart.


More information about the dhcp-users mailing list