[libvirt] [PATCH 2/2] Support IPv6 in port allocator
Eric Blake
eblake at redhat.com
Thu Oct 31 17:40:02 UTC 2013
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20131031/5ede4bc1/attachment-0001.sig>
More information about the libvir-list
mailing list