Martin_Woodhous
Mar 21, 2007Nimbostratus
if, elseif and adding comments within.
I'm trying to write a rule to redirect users based on source IP subnet.
i've come up with the following, but i'd like to be able to add comments to identify each subnet to a name (this could be in a comment field or otherwise) to make it easier to (human) read.
I don't seem to be able to add comments within the "if" statement. Is this right or am i just formatting it wrong?
Also, is this the most efficient way to write the rule? or can i create a table of some kind and reference that? There may be more than one subnet going to a particular pool.
Thanks in advance!
rule redirect-based-on-source {
when CLIENT_ACCEPTED {
if { [IP::addr [IP::client_addr] equals 10.212.249.0/255.255.255.224] } {
pool Pool-1}
elseif { [IP::addr [IP::client_addr] equals 172.20.208.160/255.255.255.224] } {
pool Pool-2}
elseif { [IP::addr [IP::client_addr] equals 173.20.208.160/255.255.255.224] } {
pool Pool-3}
else {
pool Pool4
}
}
}