Fix tst_qtcpserver::serverAddress on Mac OSX
While linux returns the local address of dual mode sockets as "::" i.e. the IPv6 address, OSX returns "::FFFF:0.0.0.0" i.e. the IPv4 address. In the unix socket engine, treat both of these as candidates for being a dual mode socket. This should hopefully cover other unixes which we haven't tested. Task-Number: QTBUG-25445 Change-Id: If1251018d54da98618223ba538c00ba54ac4cb4e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
20d901a555
commit
6137067fc2
@ -943,9 +943,13 @@ bool QNativeSocketEnginePrivate::fetchConnectionParameters()
|
||||
|
||||
#if defined (IPV6_V6ONLY)
|
||||
// determine if local address is dual mode
|
||||
// On linux, these are returned as "::" (==AnyIPv6)
|
||||
// On OSX, these are returned as "::FFFF:0.0.0.0" (==AnyIPv4)
|
||||
// in either case, the IPV6_V6ONLY option is cleared
|
||||
int ipv6only = 0;
|
||||
socklen_t optlen = sizeof(ipv6only);
|
||||
if (localAddress == QHostAddress::AnyIPv6
|
||||
if (socketProtocol == QAbstractSocket::IPv6Protocol
|
||||
&& (localAddress == QHostAddress::AnyIPv4 || localAddress == QHostAddress::AnyIPv6)
|
||||
&& !getsockopt(socketDescriptor, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&ipv6only, &optlen )) {
|
||||
if (optlen != sizeof(ipv6only))
|
||||
qWarning("unexpected size of IPV6_V6ONLY socket option");
|
||||
|
Loading…
Reference in New Issue
Block a user