Forum Discussion
Eric_Werner_283
Nimbostratus
Aug 12, 2010Use of pipe in if statement
I'm trying to find out if I can configure an if statement that checks for one of a series of possible values, like this:
if { $avp_code == 304|305|309} {
do stuff
}
Is the syntax correct, or wou...
Eric_Werner_283
Nimbostratus
Aug 25, 2010Posted By Colin Walker on 08/25/2010 03:02 PM
As far as the beast above, I noticed that you're doing a lot of setting statics and math in the CLIENT_ACCEPTED event that could be done in RULE_INIT rather than for every single connection. Is there a reason for that?
For instance all of this code could easily be moved to RULE_INIT where it would be run once at load time, rather than for every single connection. Unless I'm missing something, these are all static values that are either being set or computations based on static values that could be set once and then left alone...right?
set maxloop 20
set timeout 11100
set DWA_head 010000400000011800000000
set DWA_avp 0000010c4000000c000007d1000001084000000e4249472d495000000000012840000010746573742e636f6d
set DPA_head 0100004c0000011a00000000
set DPA_avp 0000010c4000000c000007d1000001084000000e4249472d495000000000012840000010746573742e636f6d0000010c4000000c000007d1
set ohostval "lb.site.com"
set ohostdlen [string len $ohostval]
set ohostlen {expr $ohostdlen + 8}
set ohostpad {expr (4 - ( ${ohostdlen} % 4) )%4 }
set ohostlen_pad {expr $ohostlen + $ohostpad }
set my_ohostavp {binary format IIa${ohostdlen}H[expr 2 * ${ohostpad}] 264 [expr (0x40<<24)| ${ohostlen}] $ohostval 000000}
binary scan $my_ohostavp H* ohosthex
That's an immense amount of overhead that you could carve out of each connection with about 30 seconds worth of changes to variable names and one new EVENT declaration.
Just a thought.
Colin
I'll be honest, this is just what was presented to me, so I'm not sure what the reasoning was to put all this into the CLIENT_ACCEPTED. Assuming that all connections get the default settings, if that mass can be moved to a better location, I'm all for it. As I mentioned in the thread, the overhead on this was pretty shocking. More efficiency is always appreciated.
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
