Forum Discussion
chris_connell_1
Nimbostratus
Apr 21, 2009Quickest way to do this
I want to do this in my virtual server irule.
Could someone confirm if for my irule below
only 1 condition is met and i will get this behaviour:
i,e
if the destination address is in the blocked list, its rejected.
OR
if the source matches clients and active mebers are more than 48 forward to ingress pool
OR
if the source is in the testrange then forward to test pool
OR everythign else
forward
Is it better to use a switch/case for this? but there are a few variables here.
when CLIENT_ACCEPTED {
if { [matchclass [IP::local_addr] equals $::blocked]} {
reject
} elseif { [matchclass [IP::remote_addr] equals $::clients] and [active_members Ingress] >= 48 } {
pool Ingress
} elseif { [matchclass [IP::remote_addr] equals $::testpool] } {
pool Ingress-test
} else {
forward
}
}
3 Replies
- dennypayne
Employee
Hi,
Looks good to me. Switch statements are generally considered to be faster than if - elseif's but I doubt the difference would be measurable here unless you're expecting a very large amount of traffic.
Although I'm not sure what's going to happen if you just forward a packet that was destined for the vip in the first place?
Denny - chris_connell_1
Nimbostratus
Thanks, my understanding was switch statments are good if u are comparing one variable. but if you are looking for mulitple conditions as above, then its difficult and complicated. - hoolio
Cirrostratus
You're correct, you can't use a switch to check the condition of multiple variables.
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
