A Syntax issue with match

Martin McCormick martin at dc.cis.okstate.edu
Fri Nov 19 14:40:37 UTC 2010


Bruce Hudson writes:
> The dhcp-eval man page refers to "boolean-expr-1 and boolean-expr-2" so
> the obvious (although untested) answer is:
> 
>     class "and-test" {
>         match if ((substring (option host-name,0,6) = "ABCDEF") and
>                 (substring (hardware,0,4) = 1:AF:A5:A4));
>     }
> 
> This may have more parentheses than strictly required.
> --

I appreciate the response, but alas , that nice logical-looking example
produces the same errors that several of my attempts did. I am
really beginning to wonder if one can actually do that type of
conditional match. I have tried every reasonable combination of
parentheses and even thought that just maybe "match if" is
considered part of the boolean statement so I put another match
if after the & and the errors just got even more far off the
beam.

	Usually, they state that the right hand side of the
expression is needed or some other indication that the parser
totally misunderstands the two statements. I even tried no
parentheses at all which also does not work.

With parentheses, the error message would echo the first match
if statement and then put the ^ just after the start of the
second statement so it was obvious the parser was lost. 

	It is common in C to have an if clause test 2 or more
anded expressions and one usually only needs one if clause with
parentheses around each tested expression.

	The thing I am trying to do right now is deny booting to
all clients unless they both have the right OUI in their MAC
addresses and also have a unique string in their host-name. One
would think this anded test would be fairly straight-forward.

	Again, thanks for your suggestion.

Martin



More information about the dhcp-users mailing list