Forum Discussion
William_Benett1
Nimbostratus
Mar 28, 2007TCL capabilities in iRules
So i'm working on an iRule that will require me to do bitwise math in order to determine if the port number is odd or even. I believe I looked up the operator (&) but the iRuler gives me a syntax err...
Mar 28, 2007
The bitwise AND operator "&" is supported. Could you post the segment of your iRule that is causing the problem? Likely it is something else in your assigment. You might need to wrap the math in an "expr" command.
http://tmml.sourceforge.net/doc/tcl/expr.html
Click hereIf you could post your iRule, I'll take a look...
This should work:
when HTTP_REQUEST {
set port_is_odd [expr [TCP::local_port] & 1]
if { $port_is_odd } {
log local0. "Port [TCP::local_port] is odd"
} else {
log local0. "Port [TCP::local_port] is even"
}
}-Joe
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