From 3258ef5f299ae78da4fceeb7bcdd7b92cc7507bd Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Wed, 13 Nov 2013 12:57:44 -0500 Subject: [PATCH] revert merge --- interface.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/interface.cpp b/interface.cpp index c1953b0..36786a3 100644 --- a/interface.cpp +++ b/interface.cpp @@ -509,10 +509,6 @@ QStringList Interface::list() { return QStringList(); } - // fixes libnl "issue": https://github.com/tgraf/libnl/issues/49 - // the cache is apparently global to the kernel and must be resynced if a hotplug device goes away and comes back - nl_cache_resync(sock, link_cache, NULL, NULL); - int index = 1; forever { @@ -534,6 +530,17 @@ QStringList Interface::list() { nl_cache_free(link_cache); nl_socket_free(sock); + // workaround for libnl issue: https://github.com/tgraf/libnl/issues/49 + // find any interfaces libnl doesn't know about (e.g. USB wireless adapters after they're been unplugged and replugged) + QDir dir("/sys/class/net"); + QStringList interfaces = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); + + foreach(QString interface, interfaces) { + if(!linkList.contains(interface)) { + linkList << interface; + } + } + return linkList; }