On 10/31/2013 09:40 AM, Ján Tomko wrote:
> Also try to bind on IPv6 to check if the port is occupied.
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1025407
> ---
>  src/util/virportallocator.c | 45 
> ++++++++++++++++++++++++++++++++++++++-------
>  1 file changed, 38 insertions(+), 7 deletions(-)

Since it is listed as a bugzilla fix, I could probably live with this in
1.1.4; but it would be nice to get a second opinion (after all, this is
not a regression, so it could be argued that we are finally implementing
a missing feature).

>      fd = socket(PF_INET, SOCK_STREAM, 0);
>      if (fd < 0) {
> +        if (errno == EAFNOSUPPORT)
> +            return 0;

As to the code, I didn't spot any errors.  I do wonder if checking for
EAFNOSUPPORT on every iteration for finding a free port could be made
more efficient by remembering up front if ipv6 is even enabled, and
skipping the attempt in that case (that is, a running system is unlikely
to change which subset of [ipv4, ipv6] that it currently supports except
at boot).  But there's probably more in the code base that we could
optimize if we know that a particular family is unsupported for the
given process.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to