Forum Discussion
brahim94_11525
Aug 22, 2011Nimbostratus
Apply multiple Irule on VS with the same trigger event
Hi,
I have something strange on my VS configuration. Indeed, I can apply multiple Irule with the same event (CLIENT_ACCEPTED) on one VS.
It's working without error and warning. Is it normal ? Because I know we cant use several Irule with the same Event on a VS.
Below the irule:
IRULE_1:
when CLIENT_ACCEPTED {
set ::var_test "toto"
}
IRULE_2:
when CLIENT_ACCEPTED {
set dn_str [class match -value [IP::local_addr] equals $::var_test ]
if { $dn_str eq "" } {
log local0. "Error"
forward
} else {
if { $dn_type eq "toto" } {
log local0. "node"
set ip "192.168.1.1"
node $ip
} elseif { $dn_type eq "tata" } {
log local0. "pool"
pool ::var_test
} else {
log local0. "invalid"
}}
}
Thank you
- HamishCirrocumulusYes. Working as designed and fully supported. In fact as you've found out already, the variables even get shared across the iRules as well (So watch out if you're using some standard naming for variables and they accidentally are the same where you expected the lexical scope to be different :)
- hoolioCirrostratusAnother note on performance: you should try to avoid using global variables (like $::var_test) as they prevent the iRule from executing on more than one TMM instance. As Hamish said, even local variables are shared across iRules on the same virtual server. So you should be able to use a local variable if you want to share it. If you don't want to share the variable across multiple iRules, use unique variable names.
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