need help understanding class matching

jeffrey j donovan donovan at beth.k12.pa.us
Tue Aug 30 12:40:24 UTC 2011


On Aug 30, 2011, at 3:05 AM, Simon Hobson wrote:

> 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
> 

thanks for your reply 

it was a combination of the " eight " and semi colon closing the string. This line works
_______________________

class "machines" {
         match if   substring (hardware, 1, 8) = "00:11:af"
         or substring (hardware, 1, 8) = "00:11:ba" 
         or substring (hardware, 1, 8) = "00:11:bb" 
         or substring (hardware, 1, 8) = "00:11:bc" ;
}

----------------------------------------



thanks again
-j








More information about the dhcp-users mailing list