summaryrefslogtreecommitdiffstats
path: root/src/network/socket/qnativesocketengine_unix.cpp
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2015-10-21 19:52:05 +0300
committerAlex Trotsenko <alex1973tr@gmail.com>2015-10-21 19:18:45 +0000
commite1d4c16aef954fe75fdfaf3156e78c3d62d9febd (patch)
tree1b97d29691b9b578d097162474d883dac5954be8 /src/network/socket/qnativesocketengine_unix.cpp
parenta3abf9d76b3760b37f6e846c21570806974641f2 (diff)
QNativeSocketEngine: allocate more space for the ancillary data
As a corner case on BSD systems, we use IP_RECVIF control message to retrieve an interface index of the received datagram. Take care about sockaddr_dl structure, while calculating a size of the ancillary data buffer. Change-Id: I1c113d390a4929489c4c5858847b6262f1baa204 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/network/socket/qnativesocketengine_unix.cpp')
-rw-r--r--src/network/socket/qnativesocketengine_unix.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp
index c40eef769e..f1845f31f3 100644
--- a/src/network/socket/qnativesocketengine_unix.cpp
+++ b/src/network/socket/qnativesocketengine_unix.cpp
@@ -828,7 +828,11 @@ qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxS
QAbstractSocketEngine::PacketHeaderOptions options)
{
// we use quintptr to force the alignment
- quintptr cbuf[(CMSG_SPACE(sizeof(struct in6_pktinfo)) + CMSG_SPACE(sizeof(int)) + sizeof(quintptr) - 1) / sizeof(quintptr)];
+ quintptr cbuf[(CMSG_SPACE(sizeof(struct in6_pktinfo)) + CMSG_SPACE(sizeof(int))
+#if !defined(IP_PKTINFO) && defined(IP_RECVIF) && defined(Q_OS_BSD4)
+ + CMSG_SPACE(sizeof(sockaddr_dl))
+#endif
+ + sizeof(quintptr) - 1) / sizeof(quintptr)];
struct msghdr msg;
struct iovec vec;