Patch to integrate dhcpd 4.2.0 with SQL / libdbi (mysql, postgres etc.)

Alex Bligh alex at
Thu Dec 2 22:09:27 UTC 2010


--On 2 December 2010 23:01:11 +0100 Richard Pijnenburg 
<richard at> wrote:

> I've left a comment on your blog about it because i have some questions
> if i can use it in the way i need to.
> To share it with the rest i'll post it here to.
> at this moment i'm using the ldap patch for dhcp and because of this i'm
> looking to your patch for sql support.
> Is it still needed to configure shared networks in it ? ( i would assume
> so but not sure )
> Main thing is that i need to support multiple networks preferably fully
> dynamic.
> Certain settings will be general like DNS servers, others will be
> depending on the network ( like the gateway IP ) and others depending on
> the host it self ( the ip-address and next-server + filename )
> Can this be achieved with your patch?

Unlike the LDAP code, the SQL/DBI code is only triggered when looking up 
hosts, so you are effectively generating a host block. So what you can put 
in is limited to what you would put in a host block (indeed using the 
“entry” format, you can put anything in there that you could put in a 
host block). Given you can write your own query, you can return anything 
you like to go in that host block, and that could (for instance) be 
calculated. Currently I’m not passing more than the hardware address and 
client identifier in through % variables, so you if you wanted to support 
the same host on different networks, you would have to do that using the 
config file (as SQL would have no way of determining which network the MAC 
address is on). My understanding is that this is possible (though I 
haven’t tried it).

Things that don’t live in a host block need to come from somewhere else, 
and that would normally be the config file. I see no reason why one 
couldn’t retrieve some things from LDAP and some from SQL/DBI though that 
would be a bit perverse.

Alex Bligh

More information about the dhcp-users mailing list