On 05/19/2017 01:03 PM, Daniel P. Berrange wrote: > When 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.
If I understand correctly, the correct response (and post-patch behavior) is an error (mismatch between requesting IPv4-only usage while giving an IPv6 address), but the buggy response (pre-patch behavior) is that we ended up setting ipv6 in addition to the user-set ipv4 (because we found a ':'), and then end up listening on IPv6 after all contrary to the user's request. > 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. > > 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. > > Signed-off-by: Daniel P. Berrange <berra...@redhat.com> > --- > util/qemu-sockets.c | 4 ---- > 1 file changed, 4 deletions(-) Reviewed-by: Eric Blake <ebl...@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature