Class match

Simon Hobson dhcp at thehobsons.co.uk
Wed Mar 29 15:36:19 UTC 2006


Lars Jacobsen wrote:

>I have previusly tried to get help without luck, but there must be
>someone that can help me with class match.
>Im trying to write an expression that matches on circuit ID.
>
>I need to make a match on 3.and 4. character is "21" AND 5. and 6.
>character is between "01" and "16"
>
>Something like:
>
>
>match if  packet ( (option agent.circuit-id) , 3,2)  = "21" AND match if
>packet ( (option agent.circuit-id) , 5,2)  = "01" to "16" THEN class 
>"class one"
>
>This part works but it only test  for "21":
>match if  packet ( (option agent.circuit-id) , 3,2)  = "21"
>
>This part also works but tests only for "01" and not 01>16
>match if  packet ( (option agent.circuit-id) , 5,2)  = "01"
>
>I now that  "" means text and im realy matching numbers, but that for
>emphasising  what im tryng to match.
>And yes I now I can make 16, like this but......
>
>match if  packet ( (option agent.circuit-id) , 3,2)  = "21"
>AND
>match if  packet ( (option agent.circuit-id) , 5,2)  = "01" OR
>match if  packet ( (option agent.circuit-id) , 5,2)  = "02" OR
>match if  packet ( (option agent.circuit-id) , 5,2)  = "03" OR
>match if  packet ( (option agent.circuit-id) , 5,2)  = "04" OR
>match if  packet ( (option agent.circuit-id) , 5,2)  = "05" OR
>match if  packet ( (option agent.circuit-id) , 5,2)  = "06" OR
>match if  packet ( (option agent.circuit-id) , 5,2)  = "07" OR
>match if  packet ( (option agent.circuit-id) , 5,2)  = "08" OR
>match if  packet ( (option agent.circuit-id) , 5,2)  = "09" OR
>match if  packet ( (option agent.circuit-id) , 5,2)  = "10" OR
>match if  packet ( (option agent.circuit-id) , 5,2)  = "11" OR
>match if  packet ( (option agent.circuit-id) , 5,2)  = "12" OR
>match if  packet ( (option agent.circuit-id) , 5,2)  = "13" OR
>match if  packet ( (option agent.circuit-id) , 5,2)  = "14" OR
>match if  packet ( (option agent.circuit-id) , 5,2)  = "15" OR
>match if  packet ( (option agent.circuit-id) , 5,2)  = "16"
>THEN
>class = "cllass one"

ASAIK, this is the only way to do it. Don't forget to use parentheses 
to enforce the right ordering of comparisons :

if <test char3-4>
and
( <test char 5-6=01> OR
   <test char 5-6=02> OR
   ...
)


More information about the dhcp-users mailing list