HI Willy,
2017-01-01 10:08 GMT+01:00 Willy Tarreau <w...@1wt.eu>: > Hi Olivier, > > You see that's always the same with contributors who say they don't > code in C, their first patches are always very clean :-) > > I have some comments below on the implementation itself however, as I > think it doesn't completely address the issue : > > On Wed, Dec 28, 2016 at 06:14:12PM +0100, Olivier Doucet wrote: > > when using "option prefer-last-server", we may not always stay on > > the same backend if we have one of the following option: > > balance uri > > balance url_param > > balance hdr() > > balance rdp-cookie > > Normally it should be true as well with "balance source" > > > ((s->txn && s->txn->flags & TX_PREFER_LAST) || > > ((s->be->options & PR_O_PREF_LAST) && > > + ((s->be->lbprm.algo & BE_LB_PARM) != BE_LB_HASH_URI && > (s->be->lbprm.algo & BE_LB_PARM) != BE_LB_HASH_PRM && > > + (s->be->lbprm.algo & BE_LB_PARM) != BE_LB_HASH_HDR && > (s->be->lbprm.algo & BE_LB_PARM) != BE_LB_HASH_RDP) && > > So I checked how BE_LB_SRC was defined and found that it's zero, meaning > it's the default value, so we have another flag to check to know we're > doing a hash. > > I found this one : > > #define BE_LB_KIND_HI 0x03000 /* hash of input (see hash inputs > above) */ > > And this is the mask to apply to get the family of LB algorithm : > > #define BE_LB_KIND 0x07000 /* mask to get/clear LB algorithm */ > > Thus I think that just this should work and cover all current (and possibly > future) hash-based algorithms : > > + (s->be->lbprm.algo & BE_LB_KIND) != BE_LB_KIND_HI && > > Could you please give it a try and adjust your patch accordingly if it's > OK ? > I confirm your modification is working and seems easier to maintain. I'm absolutely not familiar with all these internal flags ;) Find patch updated in my previous email. Olivier > Thanks! > Willy >