Forum Discussion

collinz1_17223's avatar
collinz1_17223
Icon for Nimbostratus rankNimbostratus
Jan 18, 2011

iRule using findstr in TCP payload

I am trying to create an irule that will search the TCP response from a server for the userData: value and them persist based on that. The irule is below, which i have associated with a Universal persistence profile, but when i try to initiate a connection, no connection is being established to one of the load balanced servers. If i remove the persistence profile i am load balanced fine:

 

 

when SERVER_CONNECTED {

 

TCP::collect 1500

 

}

 

when SERVER_DATA {

 

set usrid [findstr [TCP::payload] "userData:" 9]

 

if {$usrid ne ""} {

 

persist uie $usrid

 

}

 

}

 

 

2 Replies

  • Are you sure the failure is that no serverside connection is attempted or established? The iRule shouldn't take any effect until then.

     

     

    Can you add TCP::release to SERVER_DATA and retest?

     

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/tcp__release

     

     

    Aaron
  • It appears that if i reduce the TCP::collect value, i get connected. However i only get connected if i set the value to 19 or below:

     

     

    TCP::collect 19

     

     

     

    Which is fine as far as connecting goes, however i guess this means that the irule is only collecting 19 bytes of data, which isn't enough to find my search string.