[Dnsmasq-discuss] DHCP Option 12 (Hostname) problem

Simon Kelley simon at thekelleys.org.uk
Wed May 9 09:50:00 BST 2012

On 09/05/12 02:57, Raymond Lillard wrote:
> Dear DNSMASQ'ers
> I am developing code for an embedded micro controller with
> a network interface.
> I am presently working on the DCHP client code where dnsmasq
> is both name server and dhcp server.  The dnsmasq OS environment
> is OpenBSD, although I doubt the OS is a factor here.
> While I am by no means new to network programming, I have
> never actually written code to make DHCP happen before so
> I am learning new details as I go.
> I am considering how to handle the case where the client
> (my controller) asks for a specific hostname in its DISCOVER
> and REQUEST messages and I know that specific name is not
> available because it is committed to an unexpired leaseholder.
> In no case is dnsmasq responding to my client's option 12
> in its OFFER or ACK messages.  By that I mean, in cases of
> a clear name being requested or in cases where the requested
> name is in conflict with an already committed name, I see
> nothing from dnsmasq on option 12.
> In cases where the name does not conflict, the DNS side of
> dnsmasq will resolve the requested name correctly.
> The only unusual dnsmasq thing is I am restricting the IP
> address range for my controllers as shown:
>     dhcp-range=tag:nburn,,,1h
>     dhcp-mac=set:nburn,00:03:f4:*:*:*
> I admit I have not tested against any other DNS/DHCP servers
> and I don't want to bring up the ISC bind/dhcp atrocity
> just to get another data point.
> I'm wishing some kind soul can slap me with a clue stick,
> for which I will be most grateful.  I can and will happily
> supply actual logs, configs and wire transcripts if needed.
> I'm hoping I've overlooked something and its only me that
> needs debugging and not dnsmasq.

OK, there are two things here, the value of option 12 (if any) returned
in DHCP replies, and the name associated with the IP address in the DNS.

option 12 in DHCP replies will be sent only if option 12 appears in the
option-request list. It's value is either the hostname send in the DHCP
request, or another hostname that comes from dnsmasq configuration
(--dhcp-host, /etc/ethers) if that overrides the client-supplied name.

The (name, address) pair that goes into the DNS is always the name that
would be supplied as option 12 if that is requested. New mappings
override old ones, so if a name is associated with a DHCP lease and
another DHCP lease comes along which uses the same name, the name will
be removed from the old lease and added to the new one.

I'm not sure that answers your question, but it provides a start to the



More information about the Dnsmasq-discuss mailing list