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>bb10
parent
a3abf9d76b
commit
e1d4c16aef
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue