TWSD-1289 Load balancing of cookies where only the values ​​associated with the keys differ.

Review Request #1447 — Created March 18, 2026 and updated

tanya
APV10
TWSD-1289
mmiriam, pradeep, weikai

The http request cookies are places in the list when the cookie headers are parsed which causes them to be in the FILO order. But by protocol we should be looking in the same order as were in the cookie header i.e. FIFO. so this code changes storing from SLIST to TAILQ

Tested slb persistant cookie and http parser are tested and working as expected

Server1 gets picked when I send --- curl -v -H "Cookie: my_cookie=ID_Server1; my_cookie=ID_Server2" http://192.168.163.151/

Server2 gets picked when I send --- curl -v -H "Cookie: my_cookie=ID_Server2; my_cookie=ID_Server1" http://192.168.163.151/

here is the configuration for my test

slb configuration

slb real http "rs1" 192.168.163.152 8080 0 tcp 3 3
slb real http "rs2" 192.168.163.152 8090 0 tcp 3 3
slb group method "gr_PC" pc 0
slb group member "gr_PC" "rs1" "ID_Server1" 0
slb group member "gr_PC" "rs2" "ID_Server2" 0
slb virtual http "vs1" 192.168.163.151 80 arp 0
slb virtual health off
slb policy persistent cookie "pol_PC" "vs1" "gr_PC" "my_cookie" 1

In http2 mode tested that cookies extracted correctly
config for the http2 need to configure virt ssl host and enable http2 on the vs

slb real http "rs1" 192.168.163.152 8080 0 tcp 3 3
slb real http "rs2" 192.168.163.152 8090 0 tcp 3 3
slb group method "gr_PC" pc 0
slb group method "gr_RR" rr
slb group member "gr_PC" "rs1" "ID_Server1" 0
slb group member "gr_PC" "rs2" "ID_Server2" 0
slb group member "gr_RR" "rs1" 1 0
slb group member "gr_RR" "rs2" 1 0
slb virtual https "vs2" 192.168.163.151 443 arp 0
slb policy persistent cookie "pol_PC_vs2" "vs2" "gr_PC" "my_cookie" 1
slb policy default "vs2" "gr_RR"
http2 virtual on "vs2"

Description From Last Updated

need to replace with the new tailq function(h2_debug_print_cookie_tailq_node) I guess ?

mmiriammmiriam

I think it should be replace with h2_cookie_tailq_node_dtor function ?

mmiriammmiriam

here also tailq function (h2_debug_print_cookie_tailq_node)

mmiriammmiriam

here also it should be replaced with tailq function?

mmiriammmiriam

Is this structure still required? I can see it is been replaced with cookie_tailq_node structure.

mmiriammmiriam
tanya
tanya
mmiriam
  1. 
      
  2. need to replace with the new tailq function(h2_debug_print_cookie_tailq_node) I guess ?

    1. good catch. i added the separate h2_debug_print_cookie_tailq_node function but forgot to switch to using it. not sure why compile did not break. this applies to the next 2 corrections as well.

  3. I think it should be replace with h2_cookie_tailq_node_dtor function ?

  4. here also tailq function (h2_debug_print_cookie_tailq_node)

  5. here also it should be replaced with tailq function?

    1. custom_header_list and set_cookie list are still a lists. only cookie changed to queue

  6. Is this structure still required? I can see it is been replaced with cookie_tailq_node structure.

    1. yes this structure is still used for set_cookie and custom_header list

  7. 
      
tanya
tanya
tanya
Review request changed

Testing Done:

~  

Still working on the testing. http2 is left to test

  ~

Tested slb persistant cookie and http parser are tested and working as expected

-  
-  

but slb persistant cookie and http parser are tested and working as expected

   
   

Server1 gets picked when I send --- curl -v -H "Cookie: my_cookie=ID_Server1; my_cookie=ID_Server2" http://192.168.163.151/

   
   

Server2 gets picked when I send --- curl -v -H "Cookie: my_cookie=ID_Server2; my_cookie=ID_Server1" http://192.168.163.151/

   
   

here is the configuration for my test

   
   

slb configuration

   
   

slb real http "rs1" 192.168.163.152 8080 0 tcp 3 3

    slb real http "rs2" 192.168.163.152 8090 0 tcp 3 3
    slb group method "gr_PC" pc 0
    slb group member "gr_PC" "rs1" "ID_Server1" 0
    slb group member "gr_PC" "rs2" "ID_Server2" 0
    slb virtual http "vs1" 192.168.163.151 80 arp 0
    slb virtual health off
    slb policy persistent cookie "pol_PC" "vs1" "gr_PC" "my_cookie" 1

  +
  +

In http2 mode tested that cookies extracted correctly

  + config for the http2 need to configure virt ssl host and enable http2 on the vs

  +
  +

slb real http "rs1" 192.168.163.152 8080 0 tcp 3 3

  + slb real http "rs2" 192.168.163.152 8090 0 tcp 3 3
  + slb group method "gr_PC" pc 0
  + slb group method "gr_RR" rr
  + slb group member "gr_PC" "rs1" "ID_Server1" 0
  + slb group member "gr_PC" "rs2" "ID_Server2" 0
  + slb group member "gr_RR" "rs1" 1 0
  + slb group member "gr_RR" "rs2" 1 0
  + slb virtual https "vs2" 192.168.163.151 443 arp 0
  + slb policy persistent cookie "pol_PC_vs2" "vs2" "gr_PC" "my_cookie" 1
  + slb policy default "vs2" "gr_RR"
  + http2 virtual on "vs2"

Loading...