Specify different pxeclients "next-server" for different subnet?

Jeffrey Hutzelman jhutz at cmu.edu
Tue Jan 13 14:17:22 UTC 2009

--On Monday, January 12, 2009 09:19:37 AM -0800 "David W. Hankins" 
<David_Hankins at isc.org> wrote:

> On Mon, Jan 12, 2009 at 11:52:03AM -0500, Drew Weaver wrote:
>> Now that I think about it, the server might not accept an IP address
>> here;  in theory, the RHS of an assignment can be any expression type,
>> but I can't  remember if the parser is clever enough to do the right
>> thing with an IP  address.  Perhaps someone who touches the parser
>> internals more often than  I would like to comment (David?).
> I think anything on the right hand side of an '=' being used in
> assignment is a data expression, and data expressions are either
> functions that return data expressions, or colon-separated
> hexadecimal.

I had some time, so I went back and looked at the parser (though in a 
fairly old version).  What you say is true for option assignments; the RHS 
is always parsed as a data expression.  But variable references and 
function calls are polymorphic, and the type checking is deferred until the 
option cache is actually evaluated, quite late in the process.

Since variables are polymorphic, the RHS of a set statement can be any 
expression type, and so is parsed with context_any.  So far as I can tell, 
this means that something that looks like an IP address or hostname will 
fail to parse.  Unfortunately, while it's fairly easy to write a constant 
data expression corresponding to a particular IP address, there's no 
function that does a hostname lookup and returns the resulting address as a 
data expression.

> This is why if you over-ride the PRL with a concat() (whose arguments
> are defined as data expressions, and so parsed that way), you have to
> specify hex.

It may be interesting to define a function which is effectively a wrapper 
around parse_option_token, constructing a data expression based on an 
option syntax and an appropriate sequence of tokens, something like:

option dhcp-parameter-request-list =
  concat(option dhcp-parameter-request-list,
    option_value("BA", 208, 209, 210, 211));

Or maybe
  option_value_str("BA", "208, 209, 210, 211")

-- Jeff

More information about the dhcp-users mailing list