need help understanding class matching

Simon Hobson dhcp1 at thehobsons.co.uk
Tue Aug 30 07:05:50 UTC 2011


jeffrey j donovan wrote:

>here is the code that fails;
>
>class "machines" {
>		match if substring (hardware, 1, 3) = "00:11:af";
>		or if substring (hardware, 1, 3) = "00:11:bg";
>}
>
>
>## error
>/etc/dhcpd.conf line 18: expecting a parameter or declaration
>		match if substring (hardware, 1, 3) = "00:11:af";
> 
>^
>Configuration file errors encountered -- exiting

The parser can be a little off at times in error messages.

At a rough guess, try this :

   match if   substring (hardware, 1, 3) = 00:11:af
           or substring (hardware, 1, 3) = 00:11:bg ;

I think what's happening is that the semicolon at the end of the 
first line is closing the "if" statement, and the parse then has no 
idea what "or if ..." means.

Also, note the lack of quotes round your match strings. "00:11:af" 
means an **eight** characters string "zero, zero, colon, one, one, 
colon, a, f" which will never match the three character string \x00, 
\x11, \xaf (or 00:11:af using the alternative, easier, syntax DHCPD 
provides.)

-- 
Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.



More information about the dhcp-users mailing list