[libvirt] [PATCH 02/11] tests: Avoid IPv4-translated IPv6 address in sockettest

Roman Bolshakov posted 11 patches 6 years, 5 months ago
[libvirt] [PATCH 02/11] tests: Avoid IPv4-translated IPv6 address in sockettest
Posted by Roman Bolshakov 6 years, 5 months ago
getnameinfo on macOS formats certain IPv6 addresses as IPv4-translated
addresses. The following pattern has been observed:
  ::ffff is formated as ::0.0.255.255
  ::fffe is formated as ::0.0.255.254
  ::ffff:0 is formated as ::255.255.0.0
  ::fffe:0 is formated as ::255.254.0.0
  ::ffff:0:0 is formated as ::ffff:0.0.0.0
  ::fffe:0:0 is formated as ::fffe:0:0
  ::ffff:0:0:0 is formated as ::ffff:0:0:0

The getnameinfo behavior causes a failure for:
  DO_TEST_PARSE_AND_FORMAT("::ffff", AF_UNSPEC, true);

Use non-ambigious IPv6 for parse/format testing.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
---
 tests/sockettest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/sockettest.c b/tests/sockettest.c
index 2b21352c13..29a565de40 100644
--- a/tests/sockettest.c
+++ b/tests/sockettest.c
@@ -378,7 +378,7 @@ mymain(void)
     DO_TEST_PARSE_AND_FORMAT("::1", AF_INET, false);
     DO_TEST_PARSE_AND_FORMAT("::1", AF_INET6, true);
     DO_TEST_PARSE_AND_FORMAT("::1", AF_UNIX, false);
-    DO_TEST_PARSE_AND_FORMAT("::ffff", AF_UNSPEC, true);
+    DO_TEST_PARSE_AND_FORMAT("::fffe:0:0", AF_UNSPEC, true);
 
     /* tests that specify a network that should contain the range */
     DO_TEST_RANGE("192.168.122.1", "192.168.122.1", "192.168.122.1", 24, 1, true);
-- 
2.22.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 02/11] tests: Avoid IPv4-translated IPv6 address in sockettest
Posted by Daniel P. Berrangé 6 years, 5 months ago
On Wed, Aug 21, 2019 at 07:13:14PM +0300, Roman Bolshakov wrote:
> getnameinfo on macOS formats certain IPv6 addresses as IPv4-translated
> addresses. The following pattern has been observed:
>   ::ffff is formated as ::0.0.255.255
>   ::fffe is formated as ::0.0.255.254
>   ::ffff:0 is formated as ::255.255.0.0
>   ::fffe:0 is formated as ::255.254.0.0
>   ::ffff:0:0 is formated as ::ffff:0.0.0.0
>   ::fffe:0:0 is formated as ::fffe:0:0
>   ::ffff:0:0:0 is formated as ::ffff:0:0:0
> 
> The getnameinfo behavior causes a failure for:
>   DO_TEST_PARSE_AND_FORMAT("::ffff", AF_UNSPEC, true);
> 
> Use non-ambigious IPv6 for parse/format testing.
> 
> Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
> ---
>  tests/sockettest.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list