Hi Tim, On Sun, Jan 14, Tim Düsterhus wrote: > > Have you tested that req.hdr_ip / stick tables work w/both masks ? I > > used something like: > > http-request track-sc0 req.hdr_ip(X,1),ipmask(24,64) table test_be > > http-request set-var(sess.myx) req.hdr_ip(X,1),ipmask(24,64) > > http-response set-header X-MY %[var(sess.myx)] > > > > backend test_be > > stick-table type ipv6 size 20 expire 180s store gpc0,conn_cnt > > I must admit that I never used stick tables in haproxy before. The use > case that lead me to implement this patch is privacy reasons (mask off > the lower bits for the logs). I verified my patch using the haproxy.cfg > given in the commit message and don't see a reason why it should not > work in other places. > I'd be grateful if you could verify the correct workings of stick > tables, as you already know how they are supposed to work.
I'll try to test later (might be couple of days). I'll get a compilation error on centos7: src/sample.c: In function ‘sample_conv_ipmask’: src/sample.c:1623:3: error: ‘for’ loop initial declarations are only allowed in C99 mode for (size_t i = 0; i < 16; i++) ^ src/sample.c:1623:3: note: use option -std=c99 or -std=gnu99 to compile your code So maybe move size_t i outside of loop or unroll loop, something like + *(uint32_t*)&smp->data.u.ipv6.s6_addr[0] &= *(uint32_t*)&arg_p[1].data.ipv6.s6_addr[0]; + *(uint32_t*)&smp->data.u.ipv6.s6_addr[4] &= *(uint32_t*)&arg_p[1].data.ipv6.s6_addr[4]; + *(uint32_t*)&smp->data.u.ipv6.s6_addr[8] &= *(uint32_t*)&arg_p[1].data.ipv6.s6_addr[8]; + *(uint32_t*)&smp->data.u.ipv6.s6_addr[12] &= *(uint32_t*)&arg_p[1].data.ipv6.s6_addr[12]; might work. -Jarno -- Jarno Huuskonen

