Forum Discussion

kykong_107132's avatar
kykong_107132
Icon for Nimbostratus rankNimbostratus
Jan 26, 2007

cannot use if {not} with TCP::payload

Hi All,

 

 

I have an irule look like this

 

============================================================

 

when CLIENT_ACCEPTED {

 

TCP::collect 15

 

}

 

when CLIENT_DATA {

 

if { not [TCP::payload] contains "192.168.1.244:80"} {

 

persist uie "[IP::client_addr]:[TCP::client_port]"

 

pool Real_Proxy_Servers

 

}

 

=============================================================

 

I able to compile this irule and assign it to a virtual server. but somehow when i tried to access this virtual server, i get error message in /var/log/ltm. Error look like this.

 

 

===========================================================================

 

TCL error: Rule ky_virtual_192.168.6.12_select_pool_rule - can't use non-numeric string as operand of "!" while executing "if { not [TCP::payload 15] contains "192.168.1.244:8443"} ..."

 

=======================================================================

 

 

wondering can we use {if {not}} command together with [TCP::payload]? if cannot, how can we go about this.

 

 

thank.

2 Replies

  • I haven't tested this, but you could try wrapping the condition in parens and then not'ing it:

     

     

    if { not ( [TCP::payload] contains "192.168.1.244:80" ) }{

     

    ...

     

     

    Aaron
  • Hi All,

     

     

    thanks for your reply. i have tried your solution and it work.

     

     

    thx.