Forum Discussion

MIGUEL_MELENDEZ's avatar
MIGUEL_MELENDEZ
Icon for Nimbostratus rankNimbostratus
Jul 13, 2006

TCL error: Rule after convert irule with otcu

Hello everybody,

 

 

I am having problems with a irule converted with the utility OTCU ( from v4.5 to v9.2.3) and I am receiving the following message on /var/log/ltm

 

 

TCL error: Rule Rule-OSN-IN - Error: No serverside connection established (line 1) invoked from within "server_port"

 

 

But there is no error with the comand "b load".

 

 

This is the irule after OTCU ( irule for v9.2.3 )

 

 

rule Rule-OSN-IN {

 

when CLIENT_ACCEPTED {

 

if { [server_port] == 25 } {

 

use pool osn-in

 

}

 

elseif { [server_port] == 80 } {

 

use pool osn-in

 

}

 

elseif { [server_port] == 20 } {

 

use pool osn-in

 

}

 

elseif { [server_port] == 21 } {

 

use pool osn-in

 

}

 

elseif { [server_port] == 22 } {

 

use pool osn-in

 

}

 

elseif { [server_port] == 23 } {

 

use pool osn-in

 

}

 

elseif { [server_port] == 143 } {

 

use pool osn-in

 

}

 

elseif { [server_port] == 110 } {

 

use pool osn-in

 

}

 

elseif { [server_port] == 4201 } {

 

use pool osn-in

 

}

 

else {

 

use pool OSN-Salida_Directa

 

}

 

}

 

}

 

 

Could anybody help me ?

 

 

The port can be TCP or UDP.

 

 

Many thanks in advance.

6 Replies

  • I think the most efficient way to test the server port would be to use a switch statement. Also, the way to reference the server port in 9.x is TCP::local_port in the client side context.

    Here is an example rule:

    
    rule Rule-OSN-IN {
       when CLIENT_ACCEPTED {
          set vip_port [TCP::local_port]
          switch $vip_port {
             25 { pool osn-in }
             80 { pool osn-in }
             default  { pool default_pool }
          }
       }
    }

    Note that I haven't checked the exact syntax. You may need to break the switch cases up onto separate lines.

    If you run into any problems, try posting again here with the rule you tested and any errors.

    Aaron
  • Hi Hoolio,

     

     

    Many thanks for your reply.

     

     

    I am going to check and I tell you the results.

     

     

    Best regards.
  • Hi,

     

     

    I can not use that irule due to my traffic can be UDP or TCP.

     

     

    server_port ( version 4.5 ) can be used for both, but I can not see any other command on version 9 for the same result.

     

     

    I am using Performance (layer4 ) for my virtual server, any protocols, source_address persistance.

     

     

    Thanks in advance
  • uni's avatar
    uni
    Icon for Altostratus rankAltostratus
    How about something along these lines (untested):

    
    rule Rule-OSN-IN {
       when CLIENT_ACCEPTED {
          switch [IP::protocol] {
              6 { set vip_port [TCP::local_port] }
             17 { set vip_port [UDP::local_port] }
             default { event disable }
          }
          switch $vip_port {
             25 { pool osn-in }
             80 { pool osn-in }
             default  { pool default_pool }
          }
       }
    }
  • Many thanks,

     

     

    I have tried to use it, but ir is not possible due to dependind of the type of the VS I receive several errors.

     

     

     

    1.- VS Performance(L4)

     

     

    I tried to use this type due to I can receive UDP or TCP traffic, but I receive the following error:

     

     

    TCP::local_port in rule (Rule-OSN-IN) requires an associated TCP or FASTHTTP profile on the virtual server (vs_Control_AcUs_any).

     

     

    2.- VS Forwarding IP

     

     

    The same problem. I need a TCP/UDP profile. And in this case this VS type can not use persistance.

     

     

    3.- VS Standard

     

     

    If I configure TCP as profile LTM gives me the error :

     

     

    UDP::local_port in rule (Rule-OSN-IN) requires an associated UDP profile on the virtual server (vs_Control_AcUs_any).

     

     

     

     

    At the end I have created two VS ( standard ), one with TCP and one for UDP profile. And I have configured two Irules using your ideas.

     

     

    This one for TCP :

     

     

    rule Rule-OSN-IN {

     

     

    when CLIENT_ACCEPTED {

     

     

    switch [IP::protocol] {

     

     

    6 { set vip_port [TCP::local_port] }

     

     

    default { event disable }

     

     

    }

     

     

    switch $vip_port {

     

     

    25 { pool osn-in }

     

     

    80 { pool osn-in }

     

     

    default { pool default_pool }

     

     

    }

     

     

    }

     

     

    }

     

     

     

    Many thanks for your help.

     

     

     

  • create a udp virtual server and a tcp virtual server, then apply your rule accordingly to both. Both virtuals can be on the same IP address.