Forum Discussion
Chris_Wentland2
Nimbostratus
Nov 16, 2006Trying to parse a range of ports
Hello,
I'm trying to get a port range in an iRule working. We are evaluating the source of the request, then port, but this one is a little odd. We have one static port, and a range that need to be allowed through. This one passed the engine on the F5, but won't pass traffic on the range of ports. Any ideas???
when CLIENT_ACCEPTED {
if { [IP::addr [IP::client_addr] equals 10.122.0.0/16] or [IP::addr [IP::client_addr] equals 10.49.0.0/16] or [IP::addr [IP::client_addr] equals 192.168.38.103]} {
if { [[TCP::local_port] == 21210] or [[TCP::local_port] > 9999 and [TCP::local_port] < 10500] } {
pool Testpool1
}
else {
reject
}
}
else {
reject
}
}
Thanks a ton!
2 Replies
- hoolio
Cirrostratus
Try removing the outer braces around each test and adding parens to the port ranges:
if { [TCP::local_port] == 21210 or ([TCP::local_port] > 9999 and [TCP::local_port] < 10500) } {
The square braces act like backticks in unix to execute the command inside. The parens can be used to set the priority for comparisons.
Also, I assume the second 'else {reject}' is a typo?
Aaron - Chris_Wentland2
Nimbostratus
Perfefct!! Thank you Hoolio!
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