QNetworkInterface: fix handling of interfaces with no addresses

Certain Linux interfaces have no addresses at all (hardware or IP), like
the nlmon interfaces. They weren't being reported.

Change-Id: I8de47ed6c7be4847b99bffff141c2b60c2089ad3
Reviewed-by: Richard J. Moore <rich@kde.org>
This commit is contained in:
Thiago Macieira 2015-12-02 10:27:54 -08:00
parent 7b2fb038ae
commit 043f5d3eb5

View File

@ -343,7 +343,7 @@ static QList<QNetworkInterfacePrivate *> createInterfaces(ifaddrs *rawList)
// - virtual interfaces with no HW address have no AF_PACKET
// - interface labels have no AF_PACKET, but shouldn't be shown as a new interface
for (ifaddrs *ptr = rawList; ptr; ptr = ptr->ifa_next) {
if (ptr->ifa_addr && ptr->ifa_addr->sa_family != AF_PACKET) {
if (!ptr->ifa_addr || ptr->ifa_addr->sa_family != AF_PACKET) {
QString name = QString::fromLatin1(ptr->ifa_name);
if (seenInterfaces.contains(name))
continue;