Editing dhcpd.conf without corrupting leases

Sean Kelly smkelly at rooster.creighton.edu
Mon Apr 13 16:32:33 UTC 2009


On Mon, Apr 13, 2009 at 09:28:18AM -0700, Mr. Jan Walter wrote:
> I think the easy answer to this one is to add some more logic, like lockfiles, to your dhcp updating scheme - as in, don't SIGHUP it when you know the file isn't complete. If you're having this problem, how do you know you're not processing two update requests simultaneously and then hopelessly corrupting the file?

Unless I'm missing something, there is no proper locking done of the lease
file now for me to leverage or become "smart" about. As for double updates,
my updaters on.y touch dhcpd.conf. The corruption is being seen on
dhcpd.leases, which I do not touch at all. I can't have two updates at once
because the update runs from cron, not triggered directly by a web
registration.

> ----- Original Message ----
> From: Sean Kelly <smkelly at rooster.creighton.edu>
> To: dhcp-users at lists.isc.org
> Sent: Monday, April 13, 2009 12:18:17 PM
> Subject: Editing dhcpd.conf without corrupting leases
> 
> Good morning.
> 
> We have a web application here that allows users to register their IPs and
> a process comes along and updates /etc/dhcpd.conf every minute or so and
> restarts dhcpd as needed. However, ew're starting to see issues where our
> dhcpd.leases file is truncated and dhcpd refuses to start back up.
> 
> My working theory is that the SIGTERM from `/etc/init.d/dhcpd restart` is
> happening in the middle of a lease file append, thus causing it to become a
> corrupt leasefile and then making dhcpd fail on restart. That is the
> easiest explanation I've been able to come up with.
> 
> What are people doing to prevent this sort of thing when automatically
> restarting dhcpd? There doesn't appear to be any locking of dhcpd.leases,
> so I can't have my restart process wait for an exclusive write lock to know
> the file is in a consistent state. I'm also not sure whether OMAPI is the
> right solution, or even supportd/maintained anymore. There is no SIGHUP to
> do a config file reload.
> 
> How can I reload dhcpd.conf without accidentally corrupting dhcpd.leases
> due to a restart? This is starting to be a bigger problem here.
> 
> Thanks.
> -- 
> Sean M. Kelly
> Associate Director
> Division of Information Technology
> Creighton University
> (402) 280-2264
> AIM: smkellyg5
> _______________________________________________
> dhcp-users mailing list
> dhcp-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/dhcp-users
> 
> 
> 
>       
> _______________________________________________
> dhcp-users mailing list
> dhcp-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/dhcp-users

-- 
Sean M. Kelly
Associate Director
Division of Information Technology
Creighton University
(402) 280-2264
AIM: smkellyg5



More information about the dhcp-users mailing list