[libvirt] [PATCHv2 09/13] Change virtual network XML parsing/formatting to support IPv6

Laine Stump laine at laine.org
Thu Dec 23 14:50:58 UTC 2010


On 12/23/2010 09:23 AM, Paweł Krześniak wrote:
> On Thu, Dec 23, 2010 at 09:31, Laine Stump<laine at laine.org>  wrote:
>> The new IPv6 regexp (constructed by first de-constructing the old regexp,
>> then removing the IPv4 sub-expressions and replacing them with the fixed
>> version from ipv4-addr, and finally concatenating everything back together):
>>
>> <param
>> name="pattern">(([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9])))|(([0-9A-Fa-f]{1,4}:){0,5}:(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9])))|(::([0-9A-Fa-f]{1,4}:){0,5}(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9])))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:)</param>
> which matches incorrect address:
> :10.0.0.1
>
> more reading: http://crisp.tweakblogs.net/blog/3049/ipv6-validation-more-caveats.html

Yikes!

I'd like to get this 100% correct, but since the rng is only actually 
used by the test programs (and as a guide for users of the API), and not 
used by the library itself, I'm inclined to call it good enough for now, 
and put a note on my to-do list to fix it up later :-)

Thanks for the pointer to the article. That will be useful to have for 
reference when I go back to fix it.





More information about the libvir-list mailing list