For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Marc_Kurath_138's avatar
Marc_Kurath_138
Historic F5 Account
Dec 07, 2013

Trying to write information to a persistence cookie

I'm trying to write to the client SIP to the "unused" field in a persistence cookie I used the lines below to read info out of the cookie (from Dev Central)

 

scan [HTTP::cookie $current_cookie] {%[^\.].%d.%d} myIpE myPortE unused
log local0. "myIpD=$myIpE   myPortE=$myPortE  unused=$unused"

I tried the code below to write the client SIP but by all indications (looking inside the cookie) I have not broken the code..Any ideas would be welcome. The code I tried to write with is below. I commented a few of my attempts to get this working as they showed errors in the irule editor. I am able to encode the address...but I cant get it written to the cookie..

 

set addr "$clientip"
scan $addr "%u.%u.%u.%u" a b c d
log local0. "the Decimal Client IP and port is $addr"
set cookie_SIP "[expr ($d<<24)|($c<<16)|($b<<8)|$a]"
log local0. "the Hashed Value for the Client IP is $cookie_SIP"   --
HTTP::cookie insert name "BIGipServerFP_pool" value $cookie path "/"
HTTP::cookie $current_cookie insert $client1p "/unused"

1 Reply

  • At the very least the HTTP::cookie insert syntax on the last line is incorrect. It should be something like this:

    HTTP::cookie insert name [cookie name] value [cookie value] path [cookie path]
    
    ex.
    HTTP::cookie insert name MYCOOKIE value "blah" path "/"