summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-11-26 08:39:23 +0100
committerDavid Bauer <mail@david-bauer.net>2019-12-27 13:32:03 +0100
commita6f6c053481fb5bb29fc8357fb107400100a0658 (patch)
tree9e043d2e1602adf9ffed054a987adc8d8795950a
parent31dcef3169d29dc9bb11c6901fa7b2894438dc78 (diff)
downloadiwinfo-a6f6c053481fb5bb29fc8357fb107400100a0658.tar.gz
nl80211: properly handle netdev names starting with "radio"
This fixes VAPs not being queried correctly when the netdev name starts with "radio". Fixes: FS#2629 Signed-off-by: Jo-Philipp Wich <jo@mein.io> Signed-off-by: David Bauer <mail@david-bauer.net>
-rw-r--r--iwinfo_nl80211.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index 4b6ef91..5990c78 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -367,7 +367,8 @@ static struct nl80211_msg_conveyor * nl80211_msg(const char *ifname,
phyidx = atoi(&ifname[3]);
else if (!strncmp(ifname, "radio", 5))
phyidx = nl80211_phy_idx_from_uci(ifname);
- else if (!strncmp(ifname, "mon.", 4))
+
+ if (!strncmp(ifname, "mon.", 4))
ifidx = if_nametoindex(&ifname[4]);
else
ifidx = if_nametoindex(ifname);
@@ -380,10 +381,9 @@ static struct nl80211_msg_conveyor * nl80211_msg(const char *ifname,
if (!cv)
return NULL;
- if (ifidx > -1)
+ if (ifidx > 0)
NLA_PUT_U32(cv->msg, NL80211_ATTR_IFINDEX, ifidx);
-
- if (phyidx > -1)
+ else if (phyidx > -1)
NLA_PUT_U32(cv->msg, NL80211_ATTR_WIPHY, phyidx);
return cv;