Fix reporting the network interface type on macOS 10.14.5 and later

* initialize the structure used as argument to ioctl SIOCGIFMEDIA

The ioctl in ifType(...) returned -1 and set errno to EFAULT, thus
the code to determine the interface type was not executed.

Task-number: QTBUG-76408
Change-Id: Ib69c2c0cd4dda3604d568adf9746e0c9a280e9a0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
This commit is contained in:
Karsten Heimrich 2019-08-22 15:12:56 +02:00
parent eb8d461171
commit 375f565060

View File

@ -485,6 +485,7 @@ static QList<QNetworkInterfacePrivate *> createInterfaces(ifaddrs *rawList)
struct ifreq req; struct ifreq req;
}; };
int socket = -1; int socket = -1;
memset(&mediareq, 0, sizeof(mediareq));
// ensure both structs start with the name field, of size IFNAMESIZ // ensure both structs start with the name field, of size IFNAMESIZ
Q_STATIC_ASSERT(sizeof(mediareq.ifm_name) == sizeof(req.ifr_name)); Q_STATIC_ASSERT(sizeof(mediareq.ifm_name) == sizeof(req.ifr_name));