> Le 29 juin 2018 à 04:51, Willy Tarreau <[email protected]> a écrit : > > Hi, > > On Thu, Jun 28, 2018 at 11:48:24AM +0200, [email protected] wrote: >> >> Hi, >> >> When applying hex transform to an IPv6 in unique-id-format, the result is an >> string full of zeros. unique-id-format %{+X}o\ >> %ci:%cp_%fi:%fp_%Ts_%rt:%pid"00000000:D142_00000000:01BB_5B348110_0000:0FC3" >> When hex transform is disabled, the IPv6 is printed. >> >> Here is a patch that only applies hex transformation to IPv4 addresses. > > Hmmm I get your point but then we should have 3 cases handled differently : > - IPv4 => hex conversion > - IPv6 => no conversion > - IPv4 in IPv6 => conversion of the IPv4 part. It hits me when I made the patch : wether I should choose the lazy way or the thorough way. I did the former.
So the results should be : - 192.168.0.1 => C0A80001 - 2001:db8:0:85a3::ac1f:8001 => 20010db8000085a300000000ac1f8001 - ::ffff:192.168.0.1 => 000000000000000000000000ffffC0A80001 Applying address compression without commas is not feasible. The argument of saving space with hex will not be that obivous then. Mildis > > In practice it should still boil down to doing IPv4 vs IPv6 and encoding > the fields manually for IPv6 without the colons. Indeed, some people will > definitely expect the hexa conversion to put a 16-byte block at once and > not to insert colons that are used as port delimiters in their format, > especially for unique-id. So this should just have its own encoding format > for IPv6 addresses in my opinion. > > Thanks, > willy

