Forum Discussion

Chris_Wentland2's avatar
Chris_Wentland2
Icon for Nimbostratus rankNimbostratus
Nov 16, 2006

Trying 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!
  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    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