[libvirt] [PATCH 1/4] tests: Fix virnetsockettest on FreeBSD

Daniel P. Berrangé berrange at redhat.com
Fri Apr 27 15:32:20 UTC 2018


On Fri, Apr 27, 2018 at 05:21:20PM +0200, Andrea Bolognani wrote:
> FreeBSD doesn't let IPv4 clients to connect to IPv6 sockets,
> so one of our test cases has to be compiled out there.

Yep, IPV6_V6ONLY is set to true by default, where as it is false
by default on Linux, however, .....

> 
> Signed-off-by: Andrea Bolognani <abologna at redhat.com>
> ---
>  tests/virnetsockettest.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c
> index 9f9a243484..d39481067e 100644
> --- a/tests/virnetsockettest.c
> +++ b/tests/virnetsockettest.c
> @@ -470,9 +470,19 @@ mymain(void)
>          if (virTestRun("Socket TCP/IPv4+IPv6 Accept", testSocketTCPAccept, &tcpData) < 0)
>              ret = -1;
>  
> +        /* From FreeBSD's inet6(4):
> +         *
> +         *   By default, FreeBSD does not route IPv4 traffic to AF_INET6
> +         *   sockets.  The default behavior intentionally violates RFC2553
> +         *   for security reasons.  Listen to two sockets if you want to
> +         *   accept both IPv4 and IPv6 traffic.
> +         *
> +         * So this test will never work on FreeBSD, and need to skip it. */

This code is not supposed to be relying on IPV6_V6ONLY. The testSocketTCPAccept
method is supposed to create multiple listener sockets. We passing NULL as the
listen address, which means we are supposed to get two sockets, one listening
on IPv4 and one on IPv6. So the comment is right about FreeBSD being different
but that situation should not apply to this test AFAIK.

So I'm wondering why it hasn't listened on both sockets...

> +# ifndef __FreeBSD__
>          tcpData.cnode = "::1";
>          if (virTestRun("Socket TCP/IPv4+IPv6 Accept", testSocketTCPAccept, &tcpData) < 0)
>              ret = -1;
> +# endif /* __FreeBSD__ */
>      }
>  #endif
>  
> -- 
> 2.14.3
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

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 :|




More information about the libvir-list mailing list