Forum Discussion
janholtz
Altostratus
Jul 20, 2010Simplist irule v9.x to v10.1
Hi all
I have an extremely simple irule that currently uses datagroups:
-------------------------------------------------------------------------------------------------
when CLIENT_ACCEPTED {
if { [matchclass [IP::client_addr] eq $::sourcegroup] && [matchclass [IP::local_addr] eq $::destinationgroup] } {
pool pool_exceptionpool
}
}
-------------------------------------------------------------------------------------------------
This is obviously not CMP friendly.
If I wish to make it CMP friendly on V10.1, would my replacement rule simply be:
-------------------------------------------------------------------------------------------------
when CLIENT_ACCEPTED {
if { [matchclass [IP::client_addr] eq $static::sourcegroup] && [matchclass [IP::local_addr] eq $static::destinationgroup] } {
pool pool_exceptionpool
}
}
The contents of the datagroups are static.
Best Regards
Jan
2 Replies
- hoolio
Cirrostratus
Hi Jan,
Datagroups can be accessed by name without the $:: prefix using the class commands. matchclass and findclass have been deprecated in v10.when CLIENT_ACCEPTED { if { [class match [IP::client_addr] eq sourcegroup] && [class match [IP::local_addr] eq destinationgroup] } { pool pool_exceptionpool } }
http://devcentral.f5.com/wiki/default.aspx/iRules/class
Aaron - hoolio
Cirrostratus
$static::variable_name should only be used as global variable replacements that aren't changed after RULE_INIT runs. Their value isn't synchronized across TMMs after RULE_INIT. An example case for using static:: variables is setting a debug value (set static::my_rule_debug 1) or other configuration options that apply for all connections and don't need to change over the course of connections.
As far as I'm aware, static::class_name wouldn't work for accessing a datagroup (aka class).
We had a discussion on variable scope in v10 in the thread below. SMP and Jason provided some good info in it.
v10 - local vs. global vars
http://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/50/afv/topic/aft/1172260/aff/5/showtab/groupforums/Default.aspx
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