[libvirt] [PATCH 2/2] Support IPv6 in port allocator

Ján Tomko jtomko at redhat.com
Fri Nov 1 09:58:21 UTC 2013


On 10/31/2013 06:40 PM, Eric Blake wrote:
> 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.
> 

I've tried to check up front if ipv6 is enabled in v1:
https://www.redhat.com/archives/libvir-list/2013-October/msg00010.html

Jan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20131101/816022ad/attachment-0001.sig>


More information about the libvir-list mailing list