diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2010-08-18 14:17:55 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2010-08-24 10:28:36 (GMT) |
commit | ae29cdf5cd319e447ef75b11ac1247375c6c8192 (patch) | |
tree | 7090407072c816b755a5bf33edf541cb0c3790de /src/network/socket/qnativesocketengine_unix.cpp | |
parent | 409d41185e85f2eefe6bb4872c4dd3005bef8170 (diff) | |
download | Qt-ae29cdf5cd319e447ef75b11ac1247375c6c8192.zip Qt-ae29cdf5cd319e447ef75b11ac1247375c6c8192.tar.gz Qt-ae29cdf5cd319e447ef75b11ac1247375c6c8192.tar.bz2 |
Keep the scopeid that getaddrinfo(3) returns to us.
Task-number: QTBUG-12608, QTBUG-12243
Reviewed-by: Markus Goetz
Diffstat (limited to 'src/network/socket/qnativesocketengine_unix.cpp')
-rw-r--r-- | src/network/socket/qnativesocketengine_unix.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index fe28863..f6bfbac 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -352,10 +352,13 @@ bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &addr, quint16 memset(&sockAddrIPv6, 0, sizeof(sockAddrIPv6)); sockAddrIPv6.sin6_family = AF_INET6; sockAddrIPv6.sin6_port = htons(port); + + QString scopeid = addr.scopeId(); + bool ok; + sockAddrIPv6.sin6_scope_id = scopeid.toInt(&ok); #ifndef QT_NO_IPV6IFNAME - sockAddrIPv6.sin6_scope_id = ::if_nametoindex(addr.scopeId().toLatin1().data()); -#else - sockAddrIPv6.sin6_scope_id = addr.scopeId().toInt(); + if (!ok) + sockAddrIPv6.sin6_scope_id = ::if_nametoindex(scopeid.toLatin1()); #endif Q_IPV6ADDR ip6 = addr.toIPv6Address(); memcpy(&sockAddrIPv6.sin6_addr.s6_addr, &ip6, sizeof(ip6)); |