• D
    sockets: don't block IPv4 clients when listening on "::" · 4dc5d815
    Daniel P. Berrange 提交于
    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. 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.
    Acked-by: NGerd Hoffmann <kraxel@gmail.com>
    Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
    Reviewed-by: NEric Blake <eblake@redhat.com>
    Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
    4dc5d815
qemu-sockets.c 36.6 KB