Forum Discussion

rdc_gayu_110274's avatar
rdc_gayu_110274
Icon for Nimbostratus rankNimbostratus
Jul 06, 2005

Unable to retrieve data with session command over different UDP connections

Hi,

I need to maintain some data over different UDP connections.

I have two UDP virtual servers, namely VS1 and VS2.

The iRules associated with VS1 are:

 
 when CLIENT_ACCEPTED { 
   set key "700" 
   set data "testing" 
   session add uie $key $data 
   log "session entry $data with key $key added when the client is connected" 
 } 
  
 when SERVER_CONNECTED { 
   set key "700" 
   set data [session lookup uie $key] 
   log "found data $data for key $key" 
 } 
 

The iRules associated with VS2 are:

 
 when CLIENT_ACCEPTED { 
   set key "700" 
   set data [session lookup uie $key] 
   log "found data $data for key $key" 
 } 
 

And I set up UDP connection first towards VS1, then towards VS2. However, I cannot retrieve the data stored with session command. The logs in /var/log/ltm are:

Jul 7 05:45:39 tmm tmm[663]: 01220002:6: Rule test_session_add : session entry testing with key 700 added when the client is connected

Jul 7 05:45:39 tmm tmm[663]: 01220002:6: Rule test_session_add : found data testing for key 700

Jul 7 05:45:54 tmm tmm[663]: 01220002:6: Rule test_session_get : found data for key 700

Could anyone please tell me where goes wrong? Or maybe this is not the way session command is used? Then is there any way to keep data between/over different UDP or TCP connections?

Thanks in advance!

/rdcgayu
  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    Oh, also, I just checked the implementation of the session command and it allows you to specify that you want to look "across virtuals" like so:

     
     when CLIENT_ACCEPTED { 
        set key "700" 
        set data [session lookup uie {$key any virtual}] 
        log "found data $data for key $key" 
     } 
     
  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    I think I found your problem. I tested it and I happened to have different pools on my different virtuals which was causing it to not match. So, to make it ignore both the virtual and the pool, then you can try the following:

     
     when CLIENT_ACCEPTED { 
        set key "700" 
        set data [session lookup uie {$key any}] 
        log "found data $data for key $key" 
     } 
     

    Notice, I removed the "virtual" from "any virtual". Now, it simply means any record regardless of virtual, service, or pool. This is working for me now.
  • Hi,

     

    Still I cannot get it working. Could you please send your BIGIP configuration files such as /config/bigip.conf and /config/bigip_base.conf(or any other configuratino files that will help)? My email address is yu.sh.gao@ericsson.com . Thanks a lot!

     

     

    BRs,

     

    Gao Yu
  • david_wang_2073's avatar
    david_wang_2073
    Historic F5 Account
    perhaps you have to use [list $sss any] in "session add uie" for accross virtual, just like below

     

     

     

    if { [HTTP::cookie exists "JSESSIONID"] and $add_persist } {

     

    log local0. " response set cookie [HTTP::cookie "JSESSIONID"]"

     

    set sss [HTTP::cookie "JSESSIONID"]

     

    set lll [list $sss any]

     

    session add uie $lll [format "%s" [IP::remote_addr] ]

     

    log local0. "response $sss [format "%s" [IP::remote_addr] ]"

     

    set add_persist 0

     

    }

     

     

    }

     

    when HTTP_REQUEST {

     

    if { [HTTP::cookie exists "JSESSIONID"] } {

     

    set jsess [HTTP::cookie "JSESSIONID"]

     

    }

     

    else {

     

    set jsess [findstr [HTTP::uri] "jsessionid" 11 32]

     

    }

     

    if { $jsess != "" } {

     

    set lll [list $jsess any]

     

    log local0. "request include $jsess"

     

    set ppp [session lookup uie $lll]

     

    log local0. "request include $jsess --pool$ppp---"

     

    pool pool_[session lookup uie $lll]

     

    }

     

    else {

     

    log local0. "without jession"

     

    pool web_8080

     

    }

     

     

    }

     

    }
  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    That should be unnecessary. Note: that if for some reason you were to do this, you can also use the lset command: "lset lll $jsess any". This command is equivalent to: "set lll [list $jsess any]", but actually uses one less command (the list command) and so is a little more efficient.

     

     

    I believe your problem may more be related to the "datagram lb" attribute of the udp profile. Enabling this attribute causes the BigIP to load balance each UDP packet. The default (disabled) is that the BigIP will route all the subsequent UDP packets within the specified timeout to the same server bypassing the load-balancing.