Forum Discussion
sre_81614
Nimbostratus
May 06, 2009My iRule Impressions & Optimiziation-Request-"Contest" (IP to STOREID)
Hello community,
first of all I have to say two 4 words: I love our BIGIPs! :-)
But when it comes to "iRule-Scripting", I see some disadvantages not regarding tcl itself, but the...
Nat_Thirasuttakorn
Employee
May 14, 2009and if you want something that easily to scale ... try this...
(if you dont plan to have more store subnet, probably dont need this...
timing on
when RULE_INIT {
set static::list_net_start "172.20.0.0 10.192.0.0"
array set static::array_net_maskbit {
"172.20.0.0" 14
"10.192.0.0" 10
}
array set static::array_net_mask {
"172.20.0.0" "0.3.255.224"
"10.192.0.0" "0.63.254.0"
}
array set static::array_net_segment_bit {
"172.20.0.0" 5
"10.192.0.0" 9
}
}
when CLIENT_ACCEPTED {
set ip 10.192.18.0
foreach net_start $static::list_net_start {
if { [IP::addr $ip/$static::array_net_maskbit($net_start) equals $net_start] }{
log local0. "net $net_start found."
scan [IP::addr $ip mask $static::array_net_mask($net_start)] "%d.%d.%d.%d" a b c d
set VKSTID [expr ( {$a} << 24 | {$b} << 16 | {$c} << 8 | {$d} ) >> {$static::array_net_segment_bit($net_start)} ]
log local0. "VKSTID = $VKSTID"
}
}
}
actually, you already use foreach with publications variable. this is same. (I just prefer to use array than list)
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