Welcome! Log In Create A New Profile

Advanced

IPv6 : bug in unique-id-format and hex transormation

Posted by [email protected] 
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.

mildis
Willy Tarreau
Re: IPv6 : bug in unique-id-format and hex transormation
June 29, 2018 05:00AM
Hi,

On Thu, Jun 28, 2018 at 11:48:24AM +0200, me@mildis.org 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.

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
> Le 29 juin 2018 à 04:51, Willy Tarreau <[email protected]> a écrit :
>
> Hi,
>
> On Thu, Jun 28, 2018 at 11:48:24AM +0200, me@mildis.org 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
> Le 29 juin 2018 à 14:26, Mildis <[email protected]> a écrit :
>
>>
>> Le 29 juin 2018 à 04:51, Willy Tarreau <[email protected]> a écrit :
>>
>> Hi,
>>
>> On Thu, Jun 28, 2018 at 11:48:24AM +0200, me@mildis.org 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
Or even
2001:db8:0:85a3::ac1f:8001 => 20013Adb83A03A85a33A3Aac1f3A8001
::ffff:192.168.0.1 => 3A3AFFFF3AC0A80001

> 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
Sorry, only registered users may post in this forum.

Click here to login