From b53c229a4b394e6b83268151845e1fee734f633d Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Sat, 14 Jan 2017 12:22:53 +0900 Subject: [PATCH] Fix build without features.networkinterface Change-Id: I9fd2a7ec402a1d2d99e30f08554d86f18c6424ff Reviewed-by: Paul Olav Tvete --- src/network/socket/qnativesocketengine_p.h | 4 ++++ src/network/socket/qnativesocketengine_unix.cpp | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/network/socket/qnativesocketengine_p.h b/src/network/socket/qnativesocketengine_p.h index 4d1d8e1eb1..08e72072ef 100644 --- a/src/network/socket/qnativesocketengine_p.h +++ b/src/network/socket/qnativesocketengine_p.h @@ -286,8 +286,10 @@ public: bool checkProxy(const QHostAddress &address); bool fetchConnectionParameters(); +#if QT_CONFIG(networkinterface) static uint scopeIdFromString(const QString &scopeid) { return QNetworkInterface::interfaceIndexFromName(scopeid); } +#endif /*! \internal Sets \a address and \a port in the \a aa sockaddr structure and the size in \a sockAddrSize. @@ -301,7 +303,9 @@ public: || socketProtocol == QAbstractSocket::AnyIPProtocol) { memset(&aa->a6, 0, sizeof(sockaddr_in6)); aa->a6.sin6_family = AF_INET6; +#if QT_CONFIG(networkinterface) aa->a6.sin6_scope_id = scopeIdFromString(address.scopeId()); +#endif aa->a6.sin6_port = htons(port); Q_IPV6ADDR tmp = address.toIPv6Address(); memcpy(&aa->a6.sin6_addr, &tmp, sizeof(tmp)); diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index e140b33ce9..09c06adb1e 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -121,8 +121,10 @@ static inline void qt_socket_getPortAndAddress(const qt_sockaddr *s, quint16 *po QHostAddress tmpAddress; tmpAddress.setAddress(tmp); *addr = tmpAddress; +#if QT_CONFIG(networkinterface) if (s->a6.sin6_scope_id) addr->setScopeId(QNetworkInterface::interfaceNameFromIndex(s->a6.sin6_scope_id)); +#endif } if (port) *port = ntohs(s->a6.sin6_port);