SV: conf size limits and functions / scripts / class possibilities
Simon Hobson
dhcp at thehobsons.co.uk
Mon Apr 3 10:04:03 UTC 2006
Karl Bloch Andersen wrote:
>Yes I really mean interfaces in the form of hardware units with
>relay agents with 32 to 128 circuit ids, but then again it depends
>on how you define interfaces :)
>And yes all with different subnets.
>
>
>There's 2 of the following statements pr interface with only the
>first statement different
>
>As Lars wrote earlier (Wednesday)
>
>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 = "class one"
Thinking more about this ...
What you have above won't work correctly - you need parentheses
around the OR bits otherwise it will evaluate as :
(xx AND aa) OR bb OR cc ...
I think you also only need the one match if statement, as in :
match if packet ( (option agent.circuit-id) , 3,2) = "21" AND
( packet ( (option agent.circuit-id) , 5,2) = "01" OR
packet ( (option agent.circuit-id) , 5,2) = "02" OR
packet ( (option agent.circuit-id) , 5,2) = "03" OR
packet ( (option agent.circuit-id) , 5,2) = "04" OR
packet ( (option agent.circuit-id) , 5,2) = "05" OR
packet ( (option agent.circuit-id) , 5,2) = "06" OR
packet ( (option agent.circuit-id) , 5,2) = "07" OR
packet ( (option agent.circuit-id) , 5,2) = "08" OR
packet ( (option agent.circuit-id) , 5,2) = "09" OR
packet ( (option agent.circuit-id) , 5,2) = "10" OR
packet ( (option agent.circuit-id) , 5,2) = "11" OR
packet ( (option agent.circuit-id) , 5,2) = "12" OR
packet ( (option agent.circuit-id) , 5,2) = "13" OR
packet ( (option agent.circuit-id) , 5,2) = "14" OR
packet ( (option agent.circuit-id) , 5,2) = "15" OR
packet ( (option agent.circuit-id) , 5,2) = "16" )
If the software supported inequality operators then you could
simplify things as :
match if packet ( (option agent.circuit-id) , 3,2) = "21" AND
packet ( (option agent.circuit-id) , 5,2) >= "01" AND
packet ( (option agent.circuit-id) , 5,2) <= "16"
How hard would it be to add '>' '<' '>=' and '<=' operators ?
I'll finish with a query for people more familiar with expressions
and the internal workings :
Can we extract the packet bits into variables :
gate_card=packet ( (option agent.circuit-id) , 3,2)
gate_port=packet ( (option agent.circuit-id) , 5,2)
and then use these variables :
match if gate_card = "21" AND
( gate_port = "01" OR
gate_port = "02" OR
gate_port = "03" OR
gate_port = "04" OR
gate_port = "05" OR
gate_port = "06" OR
gate_port = "07" OR
gate_port = "08" OR
gate_port = "09" OR
gate_port = "10" OR
gate_port = "11" OR
gate_port = "12" OR
gate_port = "13" OR
gate_port = "14" OR
gate_port = "15" OR
gate_port = "16" )
And would this be more or less efficient in execution ?
Also, does the server do optimised logical operations ? Ie, in the
example above, if the card is not 21, does it skip the other 16
expressions ? This would make a huge difference in performance !
Simon
More information about the dhcp-users
mailing list