Forum Discussion
chris_connell_1
Nimbostratus
Aug 10, 2009if/else vs case statement.
Hello
I'm wandering if its better to try and use a case statement for this irule, so if the dest ip is in the blacklist we discard, if the source is in $client_sources we send to ingress pool etc.
rule new-rule {
when CLIENT_ACCEPTED {
if { [matchclass [IP::local_addr] equals $::blacklist] } {
discard
} elseif { [matchclass [IP::remote_addr] equals $::client_sources] and [active_members Ingress] >= 48 } {
pool Ingress
} elseif { [matchclass [IP::remote_addr] equals $::client_test] } {
pool Ingress-test
} else {
forward
}
}
However with case statements I thought they are only useful if the variable is the same. So because I am using 2 different tests i.e. local_addr and remote_addr the case couldnt be used for this?
Thx
- The_Bhattman
Nimbostratus
As you mentioned you are using 2 different conditions which means switch statement will add no value in your code.
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