Need vendor class identifier advice

Peter Rathlev peter at rathlev.dk
Wed Sep 18 05:30:45 UTC 2013


On Fri, 2013-09-13 at 14:13 -0700, Doug Barton wrote:
> I could create 2 match classes and put 'deny class members of' options
> in for both of them, but that seems inefficient. :)  I'm trying to write
> a custom boolean match like this:
> 
> match if substring (option vendor-class-identifier,0,28) = "Cisco
> Systems, Inc. IP Phone" or substring (option
> vendor-class-identifier,0,14) = "Cisco IP Phone";

Looks right as Keith points out.

> But I haven't been able to figure out a syntax for this kind of match
> that will actually work. I also tried this:
> 
> match if option vendor-class-identifier =~ "Cisco *IP Phone";

It's "~=" and not "=~". And it's a regexp match, not a glob match. So
the " *" part means "any number of spaces". You would want something
more link "^Cisco .*IP Phone$".

Regexp matching is expensive though. The most efficient way is probably
the two-class (with subclassing) approach with two allow statements.

-- 
Peter




More information about the dhcp-users mailing list