Hi Jarno,
On Wed, Jun 07, 2017 at 08:18:55PM +0300, Jarno Huuskonen wrote:
> So something like:
> > > + { "ipmask", sample_conv_ipmask, ARG2(1,MSK4,MSK6), NULL, SMP_T_ADDR,
> > > SMP_T_ADDR },
>
> (using SMP_T_ADDR output type makes stick table complain:
> http-request track-sc0 req.hdr_ip(X,1),ipmask(24,64) table test_be
> ...stick-table 'test_be' uses a type incompatible with the 'track-sc0' rule.
Argh!
> Might work by adding ADDR->IPV4/IPV6 c_none casts to sample_casts
> (or using SMP_T_IPV4 or SMP_T_IPV6 output)).
Or probably that we're missing a case with SMP_T_ADDR in stick tables, as
it was introduced late and we never needed it. I remember there's already
one converter emitting SMP_T_ADDR, I think it's a map so we already have
this problem.
Looking at sample_casts[], it seems to me that we need a set of c_addr2*()
functions taking care of the input type. These ones could possibly even
replace the ip2* and ipv62* casts as it would superset them.
> (setting headers works with SMP_T_ADDR output:
> http-request set-var(sess.myx) req.hdr_ip(X,1),ipmask(24,64)
> http-response set-header X-MY %[var(sess.myx)]
> )
Nice!
Willy