diff options
Diffstat (limited to 'src/network/socket')
-rw-r--r-- | src/network/socket/qnativesocketengine.cpp | 4 | ||||
-rw-r--r-- | src/network/socket/qnativesocketengine_p.h | 4 | ||||
-rw-r--r-- | src/network/socket/qnativesocketengine_unix.cpp | 5 |
3 files changed, 12 insertions, 1 deletions
diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp index cf3afe1845..b796934199 100644 --- a/src/network/socket/qnativesocketengine.cpp +++ b/src/network/socket/qnativesocketengine.cpp @@ -129,6 +129,10 @@ # include "qtcpserver.h" #endif +#if !defined(QT_NO_SCTP) +# include "qsctpserver.h" +#endif + QT_BEGIN_NAMESPACE //#define QNATIVESOCKETENGINE_DEBUG 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 1e69aebb54..13ceb4c612 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); @@ -984,7 +986,8 @@ qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxS if (cmsgptr->cmsg_len == CMSG_LEN(sizeof(int)) && ((cmsgptr->cmsg_level == IPPROTO_IPV6 && cmsgptr->cmsg_type == IPV6_HOPLIMIT) || (cmsgptr->cmsg_level == IPPROTO_IP && cmsgptr->cmsg_type == IP_TTL))) { - header->hopLimit = *reinterpret_cast<int *>(CMSG_DATA(cmsgptr)); + Q_STATIC_ASSERT(sizeof(header->hopLimit) == sizeof(int)); + memcpy(&header->hopLimit, CMSG_DATA(cmsgptr), sizeof(header->hopLimit)); } #ifndef QT_NO_SCTP |