[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/5] Fix IPv6 zero-run compression.


  • To: Owen Smith <owen.smith@xxxxxxxxxx>, win-pv-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
  • Date: Thu, 10 Sep 2026 15:27:07 +0200
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
  • Delivery-date: Thu, 10 Sep 2026 13:27:12 +0000
  • Feedback-id: default:8631fc262581453bbf619ec5b2062170:Sweego
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

On 10/09/2026 15:20, Tu Dinh wrote:
> On 10/09/2026 14:54, Owen Smith wrote:
>> ZeroIndex was only set when the first zero was found, and ZeroCount is set to
>> the longest run of zeros. This would incorrectly compress an address with
>> a two runs of zeros, e.g. "1:0:0:2:0:0:0:3" to "1::0:0:0:3".
>> ZeroIndex should be recalculated whenever a longer run of zeros is detected,
>> so that the above run is correctly compressed to "1:0:2::3"
>>
>> Simplifies the condition detecting an ending zero run, as Index would always
>> be 7 when a trailing ":" is required.
>>
>> Assisted-by: ClaudeCode:claude-opus-4.8
>> Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
> 
> Hello,
> 
> RFC4291#2.2 [1] mandates that the "::" can only appear once in an
> address. If there are more than one "::", the address will become ambiguous.
> 
> [1] https://datatracker.ietf.org/doc/html/rfc4291#section-2.2

Apologies, I misread the message. I'll verify.

>> ---
>>    src/xenvif/frontend.c | 9 ++++-----
>>    1 file changed, 4 insertions(+), 5 deletions(-)
>>
>> diff --git a/src/xenvif/frontend.c b/src/xenvif/frontend.c
>> index bece661..56fcc30 100644
>> --- a/src/xenvif/frontend.c
>> +++ b/src/xenvif/frontend.c
>> @@ -774,22 +774,21 @@ FrontendDumpIPv6Address(
>>                Count = 0;
>>    
>>            if (Count > ZeroCount) {
>> -            if (Count == 1)
>> -                ZeroIndex = Index;
>> +            ZeroIndex = 1 + Index - Count;
>>                ZeroCount = Count;
>>            }
>>        }
>>    
>>        if (ZeroCount > 1) {
>> -        CHAR                        Parts[8][sizeof(":XXXX")];
>> +        CHAR                        Parts[8][sizeof(":XXXX")] = { 0 };
>>    
>>            for (Index = 0; Index < 8; Index++) {
>>                // Consecutive 0s are collapsed into a single semicolon, so 
>> that
>>                // appending :xxxx segments would work naturally.
>>                // Compensate for the missing appended semicolon if the last 
>> word
>>                // was also collapsed.
>> -            if (Index == ZeroIndex || (Index == 7 &&
>> -                                       Index == ZeroIndex + ZeroCount - 1)) 
>> {
>> +            if (Index == ZeroIndex ||
>> +                (Index == 7 && ZeroIndex + ZeroCount == 8)) {
>>                    Parts[Index][0] = ':';
>>                    Parts[Index][1] = '\0';
>>                } else if (Index > ZeroIndex && Index < ZeroIndex + 
>> ZeroCount) {
> 
> 
> 



--
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.