aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorAdriaan de Groot <adridg@FreeBSD.org>2018-12-24 16:46:16 +0000
committerAdriaan de Groot <adridg@FreeBSD.org>2018-12-24 16:46:16 +0000
commit578f803121ca48d30dc772cb33e9f973cffdb394 (patch)
tree607dec8ceacaf20a4673f1f1561aaf3779620e3d /net
parent99c3ec9c88e19d7a79936e69f748f98c4430f0be (diff)
downloadports-578f803121ca48d30dc772cb33e9f973cffdb394.tar.gz
ports-578f803121ca48d30dc772cb33e9f973cffdb394.zip
Notes
Diffstat (limited to 'net')
-rw-r--r--net/qt5-network/Makefile1
-rw-r--r--net/qt5-network/files/patch-src_network_kernel_qnetworkinterface__unix.cpp99
-rw-r--r--net/qt5-network/files/patch-src_network_socket_qnet__unix__p.h (renamed from net/qt5-network/files/patch-src_network_socket_qnet_unix_p.h)6
-rw-r--r--net/qt5-network/files/patch-src_network_ssl_qsslcontext__openssl.cpp (renamed from net/qt5-network/files/patch-qsslcontext_openssl.cpp)6
-rw-r--r--net/qt5-network/files/patch-src_plugins_bearer_generic_qgenericengine.cpp42
5 files changed, 141 insertions, 13 deletions
diff --git a/net/qt5-network/Makefile b/net/qt5-network/Makefile
index 3918871f81c0..ffaa7be45d62 100644
--- a/net/qt5-network/Makefile
+++ b/net/qt5-network/Makefile
@@ -2,6 +2,7 @@
PORTNAME= network
DISTVERSION= ${QT5_VERSION}
+PORTREVISION= 1
CATEGORIES= net ipv6
PKGNAMEPREFIX= qt5-
diff --git a/net/qt5-network/files/patch-src_network_kernel_qnetworkinterface__unix.cpp b/net/qt5-network/files/patch-src_network_kernel_qnetworkinterface__unix.cpp
index 73b6de7b682d..04d7b3019939 100644
--- a/net/qt5-network/files/patch-src_network_kernel_qnetworkinterface__unix.cpp
+++ b/net/qt5-network/files/patch-src_network_kernel_qnetworkinterface__unix.cpp
@@ -1,12 +1,95 @@
---- src/network/kernel/qnetworkinterface_unix.cpp.orig 2018-06-15 07:29:31 UTC
+Clean up interface type and MTU detection.
+
+ - Introduce a class SockPuppet that handles closing the socket
+ automatically, and handles different address families as well.
+ - Finding MTU requires using AF_LOCAL, cribbed that detail from ifconfig.c
+ - Zero out structures more diligently, initialize pointers to nullptr.
+ - In particular, don't use a union of structs passed in to ioctl().
+ Make them separate structs (with block scope so the compiler might
+ place them on top of each other, that would be ok).
+
+--- src/network/kernel/qnetworkinterface_unix.cpp.orig 2018-12-24 17:00:42 UTC
+++ src/network/kernel/qnetworkinterface_unix.cpp
-@@ -463,9 +463,6 @@ static QNetworkInterface::InterfaceType probeIfType(in
- case IFM_ETHER:
- return QNetworkInterface::Ethernet;
+@@ -419,12 +419,23 @@ QT_BEGIN_INCLUDE_NAMESPACE
+ #endif // QT_PLATFORM_UIKIT
+ QT_END_INCLUDE_NAMESPACE
-- case IFM_FDDI:
-- return QNetworkInterface::Fddi;
+-static int openSocket(int &socket)
++template<int address_family> struct SockPuppet
+ {
+- if (socket == -1)
+- socket = qt_safe_socket(AF_INET, SOCK_DGRAM, 0);
+- return socket;
+-}
++ int socket{-1};
++
++ int open()
++ {
++ if (socket == -1)
++ socket = qt_safe_socket(address_family, SOCK_DGRAM, 0);
++ return socket;
++ }
++
++ ~SockPuppet()
++ {
++ if (socket != -1)
++ qt_safe_close(socket);
++ }
++} ;
+
+ static QNetworkInterface::InterfaceType probeIfType(int socket, int iftype, struct ifmediareq *req)
+ {
+@@ -477,15 +488,8 @@ static QNetworkInterface::InterfaceType
+ static QList<QNetworkInterfacePrivate *> createInterfaces(ifaddrs *rawList)
+ {
+ QList<QNetworkInterfacePrivate *> interfaces;
+- union {
+- struct ifmediareq mediareq;
+- struct ifreq req;
+- };
+- int socket = -1;
-
- case IFM_IEEE80211:
- return QNetworkInterface::Ieee80211;
+- // ensure both structs start with the name field, of size IFNAMESIZ
+- Q_STATIC_ASSERT(sizeof(mediareq.ifm_name) == sizeof(req.ifr_name));
+- Q_ASSERT(&mediareq.ifm_name == &req.ifr_name);
++ SockPuppet<AF_INET> socket;
++ SockPuppet<AF_LOCAL> localSocket;
+
+ // on NetBSD we use AF_LINK and sockaddr_dl
+ // scan the list for that family
+@@ -500,13 +504,21 @@ static QList<QNetworkInterfacePrivate *>
+ iface->flags = convertFlags(ptr->ifa_flags);
+ iface->hardwareAddress = iface->makeHwAddress(sdl->sdl_alen, (uchar*)LLADDR(sdl));
+
+- strlcpy(mediareq.ifm_name, ptr->ifa_name, sizeof(mediareq.ifm_name));
+- iface->type = probeIfType(openSocket(socket), sdl->sdl_type, &mediareq);
+- iface->mtu = getMtu(socket, &req);
++ {
++ ifmediareq req;
++ memset(&req, 0, sizeof(req));
++ strncpy(req.ifm_name, ptr->ifa_name, sizeof(req.ifm_name));
++ iface->type = probeIfType(socket.open(), sdl->sdl_type, &req);
++ }
++ {
++ ifreq req;
++ memset(&req, 0, sizeof(req));
++ strncpy(req.ifr_name, ptr->ifa_name, sizeof(req.ifr_name));
++ req.ifr_addr.sa_family = AF_LOCAL;
++ iface->mtu = getMtu(localSocket.open(), &req);
++ }
}
+
+- if (socket != -1)
+- qt_safe_close(socket);
+ return interfaces;
+ }
+
+@@ -605,7 +617,7 @@ static QList<QNetworkInterfacePrivate *>
+ {
+ QList<QNetworkInterfacePrivate *> interfaces;
+
+- ifaddrs *interfaceListing;
++ ifaddrs *interfaceListing = nullptr;
+ if (getifaddrs(&interfaceListing) == -1) {
+ // error
+ return interfaces;
diff --git a/net/qt5-network/files/patch-src_network_socket_qnet_unix_p.h b/net/qt5-network/files/patch-src_network_socket_qnet__unix__p.h
index bd2643152c43..8e6ca284ab48 100644
--- a/net/qt5-network/files/patch-src_network_socket_qnet_unix_p.h
+++ b/net/qt5-network/files/patch-src_network_socket_qnet__unix__p.h
@@ -1,5 +1,7 @@
---- src/network/socket/qnet_unix_p.h.orig 2018-08-27 06:31:41.917561000 +0200
-+++ src/network/socket/qnet_unix_p.h 2018-08-27 06:33:20.404588000 +0200
+Some extra includes for us.
+
+--- src/network/socket/qnet_unix_p.h.orig 2018-12-03 11:15:26 UTC
++++ src/network/socket/qnet_unix_p.h
@@ -71,6 +71,12 @@
# include <resolv.h>
#endif
diff --git a/net/qt5-network/files/patch-qsslcontext_openssl.cpp b/net/qt5-network/files/patch-src_network_ssl_qsslcontext__openssl.cpp
index c1202516d819..760df9a136af 100644
--- a/net/qt5-network/files/patch-qsslcontext_openssl.cpp
+++ b/net/qt5-network/files/patch-src_network_ssl_qsslcontext__openssl.cpp
@@ -1,10 +1,10 @@
*
-* Fix for libressl atter openssl111 API change
+* Fix for libressl after openssl111 API change
*
*
---- src/network/ssl/qsslcontext_openssl.cpp.orig 2018-10-21 16:58:39 UTC
+--- src/network/ssl/qsslcontext_openssl.cpp.orig 2018-12-03 11:15:26 UTC
+++ src/network/ssl/qsslcontext_openssl.cpp
-@@ -248,7 +248,7 @@ void QSslContext::applyBackendConfig(QSs
+@@ -249,7 +249,7 @@ void QSslContext::applyBackendConfig(QSs
if (sslContext->sslConfiguration.backendConfiguration().isEmpty())
return;
diff --git a/net/qt5-network/files/patch-src_plugins_bearer_generic_qgenericengine.cpp b/net/qt5-network/files/patch-src_plugins_bearer_generic_qgenericengine.cpp
new file mode 100644
index 000000000000..57261fa16fd2
--- /dev/null
+++ b/net/qt5-network/files/patch-src_plugins_bearer_generic_qgenericengine.cpp
@@ -0,0 +1,42 @@
+Determine suitable bearer. This code is basically the same
+as the Linux code, except out ioctl()s are named differently
+and we need an AF_LOCAL socket (this detail cribbed from ifconfig.c).
+If getting the HW address succeeds, assume it's Ethernet. Tested
+with two Ethernet cards and a vlan (all of which have a MAC reported
+by ifconfig).
+
+--- src/plugins/bearer/generic/qgenericengine.cpp.orig 2018-12-03 12:15:26.000000000 +0100
++++ src/plugins/bearer/generic/qgenericengine.cpp 2018-12-23 12:42:48.095145000 +0100
+@@ -82,7 +82,7 @@
+ // needed as interface is used as parameter name in qGetInterfaceType
+ #undef interface
+
+-#ifdef Q_OS_LINUX
++#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
+ #include <sys/socket.h>
+ #include <sys/ioctl.h>
+ #include <net/if.h>
+@@ -139,6 +139,23 @@
+
+ if (result >= 0 && request.ifr_hwaddr.sa_family == ARPHRD_ETHER)
+ return QNetworkConfiguration::BearerEthernet;
++
++#elif defined(Q_OS_FREEBSD)
++ int sock = socket(AF_LOCAL, SOCK_DGRAM, 0);
++
++ ifreq request;
++ memset(&request, 0, sizeof(struct ifreq));
++ strncpy(request.ifr_name, interface.toLocal8Bit().data(), sizeof(request.ifr_name) - 1);
++ request.ifr_name[sizeof(request.ifr_name) - 1] = '\0';
++
++ if (sock >= 0) {
++ int result = ioctl(sock, SIOCGHWADDR, &request);
++ close(sock);
++
++ if (result >= 0)
++ return QNetworkConfiguration::BearerEthernet;
++ }
++
+ #elif defined(Q_OS_WINRT)
+ ComPtr<INetworkInformationStatics> networkInfoStatics;
+ HRESULT hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_Connectivity_NetworkInformation).Get(), &networkInfoStatics);