Merge sockets 2017/06/07
The following changes since commit 0db1851becbefe3e50cfc03776fb1f75817376af:
Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-2.10-pull-request' into staging (2017-06-07 11:56:00 +0100)
are available in the git repository at:
git://github.com/berrange/qemu tags/pull-sockets-2017-06-07-1
for you to fetch changes up to 8dd2c27927b93aa352c43e8f0b9437f85d2f5f55:
tests: add functional test validating ipv4/ipv6 address flag handling (2017-06-07 17:15:08 +0100)
----------------------------------------------------------------
Merge sockets 2017/06/07 v1
----------------------------------------------------------------
Daniel P. Berrange (5):
sockets: ensure we can bind to both ipv4 & ipv6 separately
sockets: don't block IPv4 clients when listening on "::"
sockets: ensure we don't accept IPv4 clients when IPv4 is disabled
io: preserve ipv4/ipv6 flags when resolving InetSocketAddress
tests: add functional test validating ipv4/ipv6 address flag handling
io/dns-resolver.c | 6 +- tests/.gitignore | 1 + tests/Makefile.include | 4 + tests/test-sockets-proto.c | 857 +++++++++++++++++++++++++++++++++++++++++++++ util/qemu-sockets.c | 71 +++- 5 files changed, 918 insertions(+), 21 deletions(-) create mode 100644 tests/test-sockets-proto.c
Signature · 1 line
2.9.3
[Qemu-devel] [PULL v1 1/5] sockets: ensure we can bind to both ipv4 & ipv6 separately
When binding to an IPv6 socket we currently force the IPV6_V6ONLY flag to off. This means that the IPv6 socket will accept both IPv4 & IPv6 sockets when QEMU is launched with something like
-vnc :::1
While this is good for that case, it is bad for other cases. For example if an empty hostname is given, getaddrinfo resolves it to 2 addresses 0.0.0.0 and ::, in that order. We will thus bind to 0.0.0.0 first, and then fail to bind to :: on the same port. The same problem can happen if any other hostname lookup causes the IPv4 address to be reported before the IPv6 address.
When we get an IPv6 bind failure, we should re-try the same port, but with IPV6_V6ONLY turned on again, to avoid clash with any IPv4 listener.
This ensures that
-vnc :1
will bind successfully to both 0.0.0.0 and ::, and also avoid
-vnc :1,to=2
from mistakenly using a 2nd port for the :: listener.
--- util/qemu-sockets.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-)
util/qemu-sockets.c +23 -8
@@ -208,22 +208,37 @@ static int inet_listen_saddr(InetSocketAddress *saddr, }socket_set_fast_reuse (slisten); -#ifdef IPV6_V6ONLY -if (e->ai_family ==PF_INET6 ) { -/* listen on both ipv4 and ipv6 */ -const int off =0 ; -qemu_setsockopt (slisten,IPPROTO_IPV6 ,IPV6_V6ONLY , &off, -sizeof (off)); - } -#endif port_min =inet_getport (e); port_max = saddr->has_to ? saddr->to + port_offset : port_min;for (p = port_min; p <= port_max; p++) { +#ifdef IPV6_V6ONLY +/* listen on both ipv4 and ipv6 */ +int v6only =0 ; +#endif inet_setport (e, p); +#ifdef IPV6_V6ONLY + rebind: +if (e->ai_family ==PF_INET6 ) { +qemu_setsockopt (slisten,IPPROTO_IPV6 ,IPV6_V6ONLY , &v6only, +sizeof (v6only)); + } +#endif if (bind (slisten, e->ai_addr, e->ai_addrlen) ==0 ) { goto listen; } + +#ifdef IPV6_V6ONLY +/* If we got EADDRINUSE from an IPv6 bind & V6ONLY is unset, +* it could be that the IPv4 port is already claimed, so retry +* with V6ONLY set +*/ +if (e->ai_family ==PF_INET6 && errno ==EADDRINUSE && !v6only) { + v6only =1 ; + goto rebind; + } +#endif +if (p == port_max) {if (!e->ai_next) {error_setg_errno (errp, errno,"Failed to bind socket" );
Signature · 1 line
2.9.3
[Qemu-devel] [PULL v1 2/5] sockets: don't block IPv4 clients when listening on "::"
In reply to Daniel P. BerrangeWhen inet_parse() parses the hostname, it is forcing the has_ipv6 && ipv6 flags if the address contains a ":". This means that if the user had set the ipv4=on flag, to try to restrict the listener to just ipv4, an error would not have been raised. eg
-incoming tcp:[::]:9000,ipv4
should have raised an error because listening for IPv4 on "::" is a non-sensical combination. With this removed, we now call getaddrinfo() on "::" passing PF_INET and so getaddrinfo reports an error about the hostname being incompatible with the requested protocol:
qemu-system-x86_64: -incoming tcp:[::]:9000,ipv4: address resolution
failed for :::9000: Address family for hostname not supported
Likewise it is explicitly setting the has_ipv4 & ipv4 flags when the address contains only digits + '.'. This has no ill-effect, but also has no benefit, so is removed.
--- util/qemu-sockets.c | 4 ---- 1 file changed, 4 deletions(-)
util/qemu-sockets.c +0 -4
@@ -618,16 +618,12 @@ int inet_parse(InetSocketAddress *addr, const char *str, Error **errp)error_setg (errp,"error parsing IPv6 address '%s'" , str);return -1 ; } - addr->ipv6 = addr->has_ipv6 = true; }else {/* hostname or IPv4 addr */ if (sscanf (str,"%64[^:]:%32[^,]%n" , host, port, &pos) !=2 ) {error_setg (errp,"error parsing address '%s'" , str);return -1 ; } -if (host[strspn (host,"0123456789." )] =='\0' ) { - addr->ipv4 = addr->has_ipv4 = true; - } } addr->host =g_strdup (host);
Signature · 1 line
2.9.3
[Qemu-devel] [PULL v1 3/5] sockets: ensure we don't accept IPv4 clients when IPv4 is disabled
In reply to Daniel P. BerrangeCurrently if you disable listening on IPv4 addresses, via the CLI flag ipv4=off, we still mistakenly accept IPv4 clients via the IPv6 listener socket due to IPV6_V6ONLY flag being unset.
We must ensure IPV6_V6ONLY is always set if ipv4=off
This fixes the following scenarios
-incoming tcp::9000,ipv6=on
-incoming tcp:[::]:9000,ipv6=on
-chardev socket,id=cdev0,host=,port=9000,server,nowait,ipv4=off -chardev socket,id=cdev0,host=,port=9000,server,nowait,ipv6=on -chardev socket,id=cdev0,host=::,port=9000,server,nowait,ipv4=off -chardev socket,id=cdev0,host=::,port=9000,server,nowait,ipv6=on
which all mistakenly accepted IPv4 clients
--- util/qemu-sockets.c | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-)
util/qemu-sockets.c +31 -9
@@ -104,17 +104,16 @@ NetworkAddressFamily inet_netfamily(int family)* f t PF_INET6 * t - PF_INET * t f PF_INET -* t t PF_INET6 +* t t PF_INET6/PF_UNSPEC * * NB, this matrix is only about getting the necessary results * from getaddrinfo(). Some of the cases require further work * after reading results from getaddrinfo in order to fully -* apply the logic the end user wants. eg with the last case -* ipv4=t + ipv6=t + PF_INET6, getaddrinfo alone can only -* guarantee the ipv6=t part of the request - we need more -* checks to provide ipv4=t part of the guarantee. This is -* outside scope of this method and not currently handled by -* callers at all. +* apply the logic the end user wants. +* +* In the first and last cases, we must set IPV6_V6ONLY=0 +* when binding, to allow a single listener to potentially +* accept both IPv4+6 addresses. */ int inet_ai_family_from_address (InetSocketAddress *addr,Error **errp)
@@ -124,6 +123,23 @@ int inet_ai_family_from_address(InetSocketAddress *addr,error_setg (errp,"Cannot disable IPv4 and IPv6 at same time" );return PF_UNSPEC ; } +if ((addr->has_ipv6 && addr->ipv6) && (addr->has_ipv4 && addr->ipv4)) { +/* +* Some backends can only do a single listener. In that case +* we want empty hostname to resolve to "::" and then use the +* flag IPV6_V6ONLY==0 to get both protocols on 1 socket. This +* doesn't work for addresses other than "", so they're just +* inevitably broken until multiple listeners can be used, +* and thus we honour getaddrinfo automatic protocol detection +* Once all backends do multi-listener, remove the PF_INET6 +* branch entirely. +*/ +if (!addr->host ||g_str_equal (addr->host,"" )) { +return PF_INET6 ; + }else { +return PF_UNSPEC ; + } + }if ((addr->has_ipv6 && addr->ipv6) || (addr->has_ipv4 && !addr->ipv4)) {return PF_INET6 ; }
@@ -213,8 +229,14 @@ static int inet_listen_saddr(InetSocketAddress *saddr, port_max = saddr->has_to ? saddr->to + port_offset : port_min;for (p = port_min; p <= port_max; p++) {#ifdef IPV6_V6ONLY -/* listen on both ipv4 and ipv6 */ -int v6only =0 ; +/* +* Deals with first & last cases in matrix in comment +* for inet_ai_family_from_address(). +*/ +int v6only = + ((!saddr->has_ipv4 && !saddr->has_ipv6) || + (saddr->has_ipv4 && saddr->ipv4 && + saddr->has_ipv6 && saddr->ipv6)) ?0 :1 ;#endif inet_setport (e, p);#ifdef IPV6_V6ONLY
Signature · 1 line
2.9.3
[Qemu-devel] [PULL v1 4/5] io: preserve ipv4/ipv6 flags when resolving InetSocketAddress
In reply to Daniel P. BerrangeThe original InetSocketAddress struct may have has_ipv4 and has_ipv6 fields set, which will control both the ai_family used during DNS resolution, and later use of the V6ONLY flag.
Currently the standalone DNS resolver code drops the has_ipv4 & has_ipv6 flags after resolving, which means the later bind() code won't correctly set V6ONLY.
This fixes the following scenarios
-vnc :0,ipv4=off
-vnc :0,ipv6=on
-vnc :::0,ipv4=off
-vnc :::0,ipv6=on
which all mistakenly accepted IPv4 clients
--- io/dns-resolver.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
io/dns-resolver.c +4 -2
@@ -116,8 +116,10 @@ static int qio_dns_resolver_lookup_sync_inet(QIODNSResolver *resolver, .numeric = true, .has_to = iaddr->has_to, .to = iaddr->to, - .has_ipv4 = false, - .has_ipv6 = false, + .has_ipv4 = iaddr->has_ipv4, + .ipv4 = iaddr->ipv4, + .has_ipv6 = iaddr->has_ipv6, + .ipv6 = iaddr->ipv6, }; (*addrs)[i] = newaddr;
Signature · 1 line
2.9.3
[Qemu-devel] [PULL v1 5/5] tests: add functional test validating ipv4/ipv6 address flag handling
In reply to Daniel P. BerrangeThe semantics around handling ipv4=on|off & ipv6=on|off are quite subtle to understand in combination with the various hostname addresses and backend types. Introduce a massive test matrix that launches QEMU and validates the ability to connect a client on each protocol as appropriate.
The test requires that the host has ability to bind to both :: and 0.0.0.0, on port 9000. If either protocol is not available, or if something is already listening on that port the test will skip.
Although it isn't using the QTest APIs, it expects the QTEST_QEMU_BINARY env variable to be set.
--- tests/.gitignore | 1 + tests/Makefile.include | 4 + tests/test-sockets-proto.c | 857 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 862 insertions(+) create mode 100644 tests/test-sockets-proto.c
tests/.gitignore +1 -0
@@ -76,6 +76,7 @@ test-qobject-output-visitor test-rcu-list test-replication test-shift128 +test-sockets-proto test-string-input-visitor test-string-output-visitor test-thread-pool
tests/Makefile.include +4 -0
@@ -261,6 +261,7 @@ check-qtest-i386-y += tests/test-filter-redirector$(EXESUF) check-qtest-i386-y += tests/postcopy-test$(EXESUF) check-qtest-i386-y += tests/test-x86-cpuid-compat$(EXESUF) check-qtest-i386-y += tests/numa-test$(EXESUF) +check-qtest-i386-y += tests/test-sockets-proto$(EXESUF) check-qtest-x86_64-y += $(check-qtest-i386-y) gcov-files-i386-y += i386-softmmu/hw/timer/mc146818rtc.c gcov-files-x86_64-y = $(subst i386-softmmu/,x86_64-softmmu/,$(gcov-files-i386-y))
@@ -287,6 +288,7 @@ check-qtest-ppc64-y += tests/prom-env-test$(EXESUF) check-qtest-ppc64-y += tests/pnv-xscom-test$(EXESUF) check-qtest-ppc64-y += tests/drive_del-test$(EXESUF) check-qtest-ppc64-y += tests/postcopy-test$(EXESUF) +check-qtest-ppc64-y += tests/test-sockets-proto$(EXESUF) check-qtest-ppc64-y += tests/boot-serial-test$(EXESUF) check-qtest-ppc64-y += tests/rtas-test$(EXESUF) check-qtest-ppc64-y += tests/pxe-test$(EXESUF)
@@ -743,6 +745,8 @@ tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o $(libqos-usb-obj-y) tests/usb-hcd-xhci-test$(EXESUF): tests/usb-hcd-xhci-test.o $(libqos-usb-obj-y) tests/pc-cpu-test$(EXESUF): tests/pc-cpu-test.o tests/postcopy-test$(EXESUF): tests/postcopy-test.o +tests/test-sockets-proto$(EXESUF): tests/test-sockets-proto.o \ + $(test-io-obj-y) tests/vhost-user-test$(EXESUF): tests/vhost-user-test.o $(test-util-obj-y) \ $(qtest-obj-y) $(test-io-obj-y) $(libqos-virtio-obj-y) $(libqos-pc-obj-y) \ $(chardev-obj-y)
tests/test-sockets-proto.c new file +857 -0
857 lines not on this page · raw message
Signature · 1 line
2.9.3
Quoted 8 lines · Daniel P. Berrange
The following changes since commit
0db1851becbefe3e50cfc03776fb1f75817376af:Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-2.10-pull-request' into staging (2017-06-07 11:56:00 +0100)
are available in the git repository at:
git://github.com/berrange/qemutags/pull-sockets-2017-06-07-1
Quoted 8 lines
for you to fetch changes up to
8dd2c27927b93aa352c43e8f0b9437f85d2f5f55:tests: add functional test validating ipv4/ipv6 address flag handling (2017-06-07 17:15:08 +0100)
----------------------------------------------------------------
Merge sockets 2017/06/07 v1----------------------------------------------------------------
Hi; I'm afraid this ran into 'make check' problems:
On OSX and FreeBSD:
GTESTER check-qtest-i386
ERROR:/Users/pm215/src/qemu-for-merges/tests/test-sockets-proto.c:825:void test_listen(const void *): assertion failed: (data->ipv6 != 0)
GTester: last random seed: R02Sc21fa7784ab13d0fd3274d86c5a52367 ** ERROR:/Users/pm215/src/qemu-for-merges/tests/test-sockets-proto.c:825:void test_listen(const void *): assertion failed: (data->ipv6 != 0)
GTester: last random seed: R02Sdf653a63e8d9a5d03bfadb49122f3e9a
On the clang runtime undefined-behavior sanitizer:
GTESTER check-qtest-i386/home/petmay01/linaro/qemu-for-merges/qapi/qapi-visit-core.c:139:12:
runtime error: load of value 254, which is not a valid value for type 'bool'
(ditto for check-qtest-ppc64, x86_64
GTESTER check-qtest-ppc64/home/petmay01/linaro/qemu-for-merges/qapi/qapi-visit-core.c:139:12:
runtime error: load of value 254, which is not a valid value for type 'bool'
More specifically:
$ UBSAN_OPTIONS=print_stacktrace=1
QTEST_QEMU_BINARY=i386-softmmu/qemu-system-i386 gtester -k --verbose
-m=quick tests/test-sockets-proto -p=/sockets/migrate/wildcard/all
TEST: tests/test-sockets-proto... (pid=1710)
/sockets/migrate/wildcard/all:
/home/petmay01/linaro/qemu-for-merges/qapi/qapi-visit-core.c:139:12:
runtime error: load of value 224, which is not a valid value for type
'bool'
#0 0x56308e8ba318 in visit_optional
/home/petmay01/linaro/qemu-for-merges/qapi/qapi-visit-core.c:139:12
#1 0x56308e892598 in visit_type_InetSocketAddress_members
/home/petmay01/linaro/qemu-for-merges/build/clang/qapi-visit.c:7030:9
#2 0x56308e8a8ab3 in visit_type_SocketAddress_members
/home/petmay01/linaro/qemu-for-merges/build/clang/qapi-visit.c:12820:9
#3 0x56308e8829b6 in visit_type_SocketAddress
/home/petmay01/linaro/qemu-for-merges/build/clang/qapi-visit.c:12850:5
#4 0x56308e873f63 in qapi_free_SocketAddress
/home/petmay01/linaro/qemu-for-merges/build/clang/qapi-types.c:3897:5
#5 0x56308e827e19 in test_listen
/home/petmay01/linaro/qemu-for-merges/tests/test-sockets-proto.c:831:5
#6 0x7f1cea6757da (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x6f7da)
#7 0x7f1cea6759a2 (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x6f9a2)
#8 0x7f1cea6759a2 (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x6f9a2)
#9 0x7f1cea6759a2 (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x6f9a2)
#10 0x7f1cea675b7a in g_test_run_suite
(/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x6fb7a)
#11 0x7f1cea675bd0 in g_test_run
(/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x6fbd0)
#12 0x56308e82798d in main
/home/petmay01/linaro/qemu-for-merges/tests/test-sockets-proto.c:854:11
#13 0x7f1ce860582f in __libc_start_main
/build/glibc-9tT8Do/glibc-2.23/csu/../csu/libc-start.c:291
#14 0x56308e8053f8 in _start
(/home/petmay01/linaro/qemu-for-merges/build/clang/tests/test-sockets-proto+0xb93f8)OK
PASS: tests/test-sockets-proto
This usually means "forgot to initialize a bool". May or may not be the same bug in both cases...
thanks
-- PMM
Quoted 32 lines · Peter Maydell
Quoted 8 lines · Daniel P. Berrange
The following changes since commit
0db1851becbefe3e50cfc03776fb1f75817376af:Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-2.10-pull-request' into staging (2017-06-07 11:56:00 +0100)
are available in the git repository at:
git://github.com/berrange/qemutags/pull-sockets-2017-06-07-1Quoted 8 lines
for you to fetch changes up to
8dd2c27927b93aa352c43e8f0b9437f85d2f5f55:tests: add functional test validating ipv4/ipv6 address flag handling (2017-06-07 17:15:08 +0100)
----------------------------------------------------------------
Merge sockets 2017/06/07 v1----------------------------------------------------------------
Hi; I'm afraid this ran into 'make check' problems:
On OSX and FreeBSD:
GTESTER check-qtest-i386
ERROR:/Users/pm215/src/qemu-for-merges/tests/test-sockets-proto.c:825:voidtest_listen(const void *): assertion failed: (data->ipv6!= 0)
GTester: last random seed: R02Sc21fa7784ab13d0fd3274d86c5a52367 ** ERROR:/Users/pm215/src/qemu-for-merges/tests/test-sockets-proto.c:825:voidtest_listen(const void *): assertion failed: (data->ipv6!= 0)
GTester: last random seed: R02Sdf653a63e8d9a5d03bfadb49122f3e9a
Quoted 1 line
On the clang runtime undefined-behavior sanitizer:
Was this clang on OSX/FreeBSD too, or is that on Linux ? If the latter, what are the args to use with configure to exercise this scenario ?
Quoted 4 lines
GTESTER check-qtest-i386
/home/petmay01/linaro/qemu-for-merges/qapi/qapi-visit-core.c:139:12:
runtime error: load of value 254, which is not a valid value for type 'bool'
Regards,
Daniel
Signature · 3 lines
|: 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 :|
Quoted 20 lines · Peter Maydell
Quoted 8 lines · Daniel P. Berrange
The following changes since commit
0db1851becbefe3e50cfc03776fb1f75817376af:Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-2.10-pull-request' into staging (2017-06-07 11:56:00 +0100)
are available in the git repository at:
git://github.com/berrange/qemutags/pull-sockets-2017-06-07-1Quoted 8 lines
for you to fetch changes up to
8dd2c27927b93aa352c43e8f0b9437f85d2f5f55:tests: add functional test validating ipv4/ipv6 address flag handling (2017-06-07 17:15:08 +0100)
----------------------------------------------------------------
Merge sockets 2017/06/07 v1----------------------------------------------------------------
Hi; I'm afraid this ran into 'make check' problems:
Quoted 9 lines
On OSX and FreeBSD:
GTESTER check-qtest-i386
ERROR:/Users/pm215/src/qemu-for-merges/tests/test-sockets-proto.c:825:voidtest_listen(const void *): assertion failed: (data->ipv6!= 0)
GTester: last random seed: R02Sc21fa7784ab13d0fd3274d86c5a52367 ** ERROR:/Users/pm215/src/qemu-for-merges/tests/test-sockets-proto.c:825:voidtest_listen(const void *): assertion failed: (data->ipv6!= 0)
GTester: last random seed: R02Sdf653a63e8d9a5d03bfadb49122f3e9a
Ok, it appears that getaddrinfo() returns different results for "localhost" on FreeBSD/OSX, compared to Linux. Linux returns IPv4 first, then IPv6, while FreeBSD/OSX return IPv6 first then IPv4. The sockets code is working correctly, but the unit test is not seeing the expected results, since its data tables are expecting the Linux behaviour. Not sure how I'll fix this yet, perhaps I'll just #ifdef __linux__ as a temporary hack.
Quoted 11 lines
On the clang runtime undefined-behavior sanitizer:
GTESTER check-qtest-i386/home/petmay01/linaro/qemu-for-merges/qapi/qapi-visit-core.c:139:12:
runtime error: load of value 254, which is not a valid value for type 'bool'(ditto for check-qtest-ppc64,
x86_64
GTESTER check-qtest-ppc64/home/petmay01/linaro/qemu-for-merges/qapi/qapi-visit-core.c:139:12:
runtime error: load of value 254, which is not a valid value for type 'bool'
[snip]
Quoted 2 lines
This usually means "forgot to initialize a bool". May or may not be the same bug in both cases...
Yes, this was a unit test bug using g_new instead of g_new0
Regards,
Daniel
Signature · 3 lines
|: 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 :|
Quoted 2 lines · Daniel P. Berrange
Was this clang on OSX/FreeBSD too, or is that on Linux ? If the latter, what are the args to use with configure to exercise this scenario ?
Linux. For details of how to run the sanitizer, see
http://wiki.qemu.org/Testing#clang_UBSan
thanks
-- PMM
Hi Daniel,
Quoted 31 lines · Daniel P. Berrange
Quoted 20 lines · Peter Maydell
Quoted 8 lines · Daniel P. Berrange
The following changes since commit
0db1851becbefe3e50cfc03776fb1f75817376af:Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-2.10-pull-request' into staging (2017-06-07 11:56:00 +0100)
are available in the git repository at:
git://github.com/berrange/qemutags/pull-sockets-2017-06-07-1Quoted 8 lines
for you to fetch changes up to
8dd2c27927b93aa352c43e8f0b9437f85d2f5f55:tests: add functional test validating ipv4/ipv6 address flag handling (2017-06-07 17:15:08 +0100)
----------------------------------------------------------------
Merge sockets 2017/06/07 v1----------------------------------------------------------------
Hi; I'm afraid this ran into 'make check' problems:
Quoted 9 lines
On OSX and FreeBSD:
GTESTER check-qtest-i386
ERROR:/Users/pm215/src/qemu-for-merges/tests/test-sockets-proto.c:825:voidtest_listen(const void *): assertion failed: (data->ipv6!= 0)
GTester: last random seed: R02Sc21fa7784ab13d0fd3274d86c5a52367 ** ERROR:/Users/pm215/src/qemu-for-merges/tests/test-sockets-proto.c:825:voidtest_listen(const void *): assertion failed: (data->ipv6!= 0)
GTester: last random seed: R02Sdf653a63e8d9a5d03bfadb49122f3e9a
Quoted 6 lines
Ok, it appears that
getaddrinfo()returns different results for "localhost" on FreeBSD/OSX, compared to Linux. Linux returns IPv4 first, then IPv6, while FreeBSD/OSX return IPv6 first then IPv4. The sockets code is working correctly, but the unit test is not seeing the expected results, since its data tables are expecting the Linux behaviour. Not sure how I'll fix this yet, perhaps I'll just #ifdef__linux__as a temporary hack.
On Linux it depends of your /etc/gai.conf(5), on FreeBSD it depends on ip6addrctl(8) policy.
I'm not sure about this hack, temporary tends to last...
Quoted 24 lines
Quoted 13 lines
On the clang runtime undefined-behavior sanitizer:
GTESTER check-qtest-i386/home/petmay01/linaro/qemu-for-merges/qapi/qapi-visit-core.c:139:12:
runtime error: load of value 254, which is not a valid value for type 'bool'(ditto for check-qtest-ppc64,
x86_64
GTESTER check-qtest-ppc64/home/petmay01/linaro/qemu-for-merges/qapi/qapi-visit-core.c:139:12:
runtime error: load of value 254, which is not a valid value for type 'bool'[snip]
Quoted 2 lines
This usually means "forgot to initialize a bool". May or may not be the same bug in both cases...
Yes, this was a unit test bug using
g_newinstead ofg_new0Regards,
Daniel
Quoted 41 lines · Philippe Mathieu-Daudé
Hi Daniel,
Quoted 31 lines · Daniel P. Berrange
Quoted 20 lines · Peter Maydell
Quoted 8 lines · Daniel P. Berrange
The following changes since commit
0db1851becbefe3e50cfc03776fb1f75817376af:Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-2.10-pull-request' into staging (2017-06-07 11:56:00 +0100)
are available in the git repository at:
git://github.com/berrange/qemutags/pull-sockets-2017-06-07-1Quoted 8 lines
for you to fetch changes up to
8dd2c27927b93aa352c43e8f0b9437f85d2f5f55:tests: add functional test validating ipv4/ipv6 address flag handling (2017-06-07 17:15:08 +0100)
----------------------------------------------------------------
Merge sockets 2017/06/07 v1----------------------------------------------------------------
Hi; I'm afraid this ran into 'make check' problems:
Quoted 9 lines
On OSX and FreeBSD:
GTESTER check-qtest-i386
ERROR:/Users/pm215/src/qemu-for-merges/tests/test-sockets-proto.c:825:voidtest_listen(const void *): assertion failed: (data->ipv6!= 0)
GTester: last random seed: R02Sc21fa7784ab13d0fd3274d86c5a52367 ** ERROR:/Users/pm215/src/qemu-for-merges/tests/test-sockets-proto.c:825:voidtest_listen(const void *): assertion failed: (data->ipv6!= 0)
GTester: last random seed: R02Sdf653a63e8d9a5d03bfadb49122f3e9aQuoted 6 lines
Ok, it appears that
getaddrinfo()returns different results for "localhost" on FreeBSD/OSX, compared to Linux. Linux returns IPv4 first, then IPv6, while FreeBSD/OSX return IPv6 first then IPv4. The sockets code is working correctly, but the unit test is not seeing the expected results, since its data tables are expecting the Linux behaviour. Not sure how I'll fix this yet, perhaps I'll just #ifdef__linux__as a temporary hack.
Quoted 4 lines
On Linux it depends of your /etc/gai.conf(5), on FreeBSD it depends on ip6addrctl(8) policy.
I'm not sure about this hack, temporary tends to last...
Yeah, I'm thinking about a way to adapt the test suite to cope with the arbitrary ordering, rather than assuming an "out of the box" gai.conf setup.
Regards,
Daniel
Signature · 3 lines
|: 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 :|