From a6f6c053481fb5bb29fc8357fb107400100a0658 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 26 Nov 2019 08:39:23 +0100 Subject: [PATCH] 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 Signed-off-by: David Bauer --- iwinfo_nl80211.c | 8 ++++---- 1 file 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; -- 2.25.1