summaryrefslogtreecommitdiff
path: root/iwinfo_nl80211.c
diff options
context:
space:
mode:
Diffstat (limited to 'iwinfo_nl80211.c')
-rw-r--r--iwinfo_nl80211.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index 5bc2f51..50bb8f0 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -825,14 +825,16 @@ static char * nl80211_phy2ifname(const char *ifname)
memset(nif, 0, sizeof(nif));
- snprintf(buffer, sizeof(buffer),
- "/sys/class/ieee80211/phy%d/device/net", phyidx);
-
- if ((d = opendir(buffer)) != NULL)
+ if ((d = opendir("/sys/class/net")) != NULL)
{
while ((e = readdir(d)) != NULL)
{
snprintf(buffer, sizeof(buffer),
+ "/sys/class/net/%s/phy80211/index", e->d_name);
+ if (nl80211_readint(buffer) != phyidx)
+ continue;
+
+ snprintf(buffer, sizeof(buffer),
"/sys/class/net/%s/ifindex", e->d_name);
cifidx = nl80211_readint(buffer);