Merge commit '8073a33e2cb0bbf3aa7ac14808e4cedebb0c20f4' into dora

dora
Holger Hans Peter Freyther 7 years ago
commit 6dfbeb8cea
  1. 84
      meta-qt5/recipes-qt/qt5/qtbase/0017-prevent-if_nametoindex-being-called-with-empty-strin.patch
  2. 3
      meta-qt5/recipes-qt/qt5/qtbase_5.2.1.bb

@ -0,0 +1,84 @@
From bcca9b3cd8a7699b68a296a8b606df8a4065e527 Mon Sep 17 00:00:00 2001
From: Tom Hirst <tom.hirst@ipe-systems.co.uk>
Date: Fri, 10 Oct 2014 17:02:17 +0100
Subject: [PATCH] prevent if_nametoindex being called with empty string
Calling if_nametoindex with an empty string will always return 0, but
on ARM linux platforms this call seems to be very expensive (~30ms),
adding a large overhead to calls such as QUdpSocket::writeDatagram()
Task-number: QTBUG-37092
Change-Id: Iad00867585d9534af1ddaee936dd4e4dc5e03611
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
---
src/network/socket/qnativesocketengine_unix.cpp | 33 ++++++++++++++++---------
1 file changed, 22 insertions(+), 11 deletions(-)
diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp
index e076f2b..88ef5a0 100644
--- a/src/network/socket/qnativesocketengine_unix.cpp
+++ b/src/network/socket/qnativesocketengine_unix.cpp
@@ -378,12 +378,15 @@ bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &addr, quint16
sockAddrIPv6.sin6_port = htons(port);
QString scopeid = addr.scopeId();
- bool ok;
- sockAddrIPv6.sin6_scope_id = scopeid.toInt(&ok);
+
+ if (!scopeid.isEmpty()) {
+ bool ok;
+ sockAddrIPv6.sin6_scope_id = scopeid.toInt(&ok);
#ifndef QT_NO_IPV6IFNAME
- if (!ok)
- sockAddrIPv6.sin6_scope_id = ::if_nametoindex(scopeid.toLatin1());
+ 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));
@@ -489,11 +492,16 @@ bool QNativeSocketEnginePrivate::nativeBind(const QHostAddress &address, quint16
memset(&sockAddrIPv6, 0, sizeof(sockAddrIPv6));
sockAddrIPv6.sin6_family = AF_INET6;
sockAddrIPv6.sin6_port = htons(port);
+ QString scopeid = address.scopeId();
+
+ if (!scopeid.isEmpty()) {
+ bool ok;
+ sockAddrIPv6.sin6_scope_id = scopeid.toInt(&ok);
#ifndef QT_NO_IPV6IFNAME
- sockAddrIPv6.sin6_scope_id = ::if_nametoindex(address.scopeId().toLatin1().data());
-#else
- sockAddrIPv6.sin6_scope_id = address.scopeId().toInt();
+ if (!ok)
+ sockAddrIPv6.sin6_scope_id = ::if_nametoindex(scopeid.toLatin1());
#endif
+ }
Q_IPV6ADDR tmp = address.toIPv6Address();
memcpy(&sockAddrIPv6.sin6_addr.s6_addr, &tmp, sizeof(tmp));
sockAddrSize = sizeof(sockAddrIPv6);
@@ -902,12 +910,15 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l
Q_IPV6ADDR tmp = host.toIPv6Address();
memcpy(&sockAddrIPv6.sin6_addr.s6_addr, &tmp, sizeof(tmp));
QString scopeid = host.scopeId();
- bool ok;
- sockAddrIPv6.sin6_scope_id = scopeid.toInt(&ok);
+
+ if (!scopeid.isEmpty()) {
+ bool ok;
+ sockAddrIPv6.sin6_scope_id = scopeid.toInt(&ok);
#ifndef QT_NO_IPV6IFNAME
- if (!ok)
- sockAddrIPv6.sin6_scope_id = ::if_nametoindex(scopeid.toLatin1());
+ if (!ok)
+ sockAddrIPv6.sin6_scope_id = ::if_nametoindex(scopeid.toLatin1());
#endif
+ }
sockAddrSize = sizeof(sockAddrIPv6);
sockAddrPtr = (struct sockaddr *)&sockAddrIPv6;
} else if (host.protocol() == QAbstractSocket::IPv4Protocol) {
--
2.3.5

@ -1,7 +1,8 @@
require qt5-${PV}.inc
require ${PN}.inc
SRC_URI += "file://0015-Fix-linuxfb-argument-mmsize-parsing.patch"
SRC_URI += "file://0015-Fix-linuxfb-argument-mmsize-parsing.patch \
file://0017-prevent-if_nametoindex-being-called-with-empty-strin.patch"
SRC_URI[md5sum] = "fa005301a2000b92b61b63edc042567b"
SRC_URI[sha256sum] = "acdfd1aa2548ebea1d922e8e24e5c59f5fc3b2beae7c8003ba47d773bfcc94c0"

Loading…
Cancel
Save