Does "option dhcp-message-type" work?

David W. Hankins David_Hankins at isc.org
Mon Jul 21 22:02:28 UTC 2008


On Mon, Jul 21, 2008 at 03:22:16PM -0400, Bret Schuhmacher wrote:
> if dhcp-message-type = 5 {
> log (info, concat(binary-to-ascii (10, 8, ".", leased-address), ",", 
> binary-to-ascii (10,32,"",encode-int (lease-time,32)), ",", 
> binary-to-ascii (16, 8, ":", substring (hardware, 1, 6)), "," , 
> binary-to-ascii(16, 8, ":", substring( option agent.remote-id, 0, 6))));
> }

i think 'dhcp-message-type' gets parsed as a variable name for a
'binding scope', whereas 'option dhcp-message-type' gets looked up in
the packet's option cache.

this actually is a terribly insidious and frighteningly longstanding
bug in our parser (example taken from our bug tracking system);

    authoritive;

is mispelled from what was intended by its author, but the parser
constructs it internally as a no-op executable statement, deriving
the value of the binding scope labeled 'authoritive', and then
discarding the result.

short of asking dhcpd.conf authors to 'foreword' all the binding
scope variable names they are going to be using, a solution has not
quite bubbled to the surface.

> If I comment out the "if" and run it I get 2 lines of logging, 
> presumably from the DHCPOFFER and the DHCPACK.  I only want to log the 
> ACK.  Is there another method I could try?

some folks have been known to use the 'on commit' config feature.

-- 
Ash bugud-gul durbatuluk agh burzum-ishi krimpatul.
Why settle for the lesser evil?	 https://secure.isc.org/store/t-shirt/
-- 
David W. Hankins	"If you don't do it right the first time,
Software Engineer		     you'll just have to do it again."
Internet Systems Consortium, Inc.		-- Jack T. Hankins


More information about the dhcp-users mailing list