Forum Discussion
Deb_Allen_18
Mar 01, 2006Historic F5 Account
Using matchclass with network classes
I'm pretty comfortable with matchclass in general, but I was wondering if there are some subtleties for IP classes containing subnets (which I have not used with matchclass much).
I'm building a...
It is somewhat inconvenient. You could try something like setting a single local variable (not in RULE_INIT) in each rule to something unique and then build the variable names in that particular rule based on the first variable. Maybe an example would be easier to demonstrate:
rule rule1 {
when CLIENT_ACCEPTED {
set var_prefix "rule1"
set ${var_prefix}var1 "this is rule1's var1 value"
log local0. "$var_prefix variable name ${var_prefix}var1, variable value: [set [subst ${var_prefix}var1]]"
}
}
rule rule2 {
when CLIENT_ACCEPTED {
set var_prefix "rule2"
set ${var_prefix}var1 "this is rule2's var1 value"
log local0. "$var_prefix variable name ${var_prefix}var1, variable value: [set [subst ${var_prefix}var1]]"
}
}
Here is the sample output from a request to a vip with both rule1 and rule2 added:
Rule test_rule1 : rule1 variable name rule1var1, variable value: this is rule1's var1 value
Rule test_rule2 : rule2 variable name rule2var1, variable value: this is rule2's var1 value
I guess you could put in a feature request with F5 support asking for the scope of local variables to be limited to the rule they're set in, but I'm guessing there is a good reason for the way it is now.
Aaron
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