Hi Cyril,

On Wed, Oct 24, 2012 at 01:19:11AM +0200, Cyril Bonté wrote:
> Hi Willy,
> 
> The documentation part from commit ceb4ac9c[1] states that hdr_ip, 
> url_ip and urlp_ip now support IPv6 values, but the code doesn't support 
> it :
> smp_fetch_hdr_ip() and smp_fetch_url_ip() only accept IPv4 string values.
> 
> I wonder if it's a documentation bug, or if you have already written the 
> code which was never merged, or even if you have this in the TODO list.

That's embarrassing. Considering the advanced hour in the night for this
commit and the fact that no more patch was emitted for more than one week,
I think that either I got stuck on something preventing me from going
forward without changing something else, or that I got disturbed for the
whole week and lost what I started doing :-(

Either way, now the doc does not reflect reality, so we must address the
issue. I don't think that anything is missing anymore to have the IPv6
address parser to fill the gap. The smp_fetch_hdr() function was rewritten
precisely to address this need, inet_pton and a few skips of square
brakets should be all that's needed. Hmmm I think I get it now. inet_pton
needs a zero-terminated string and for this we needed to copy the address
to the sample trash chunk (using sample_get_trash_chunk()), trim it, and
parse it from there using inet_pton(). We can do that when url2ipv4
returns zero it seems, as it stops on anything not a digit nor a dot, and
wants 3 dots.

I probably won't have time to look into this tomorrow, so if you can, once
again your fix will be welcome !

Thanks,
Willy


Reply via email to