aboutsummaryrefslogtreecommitdiffstats
path: root/package/iwinfo/src/iwinfo_nl80211.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2011-12-06 13:24:47 +0000
committerJo-Philipp Wich <jow@openwrt.org>2011-12-06 13:24:47 +0000
commit843452730565e43ca70a2572681b651690c0789b (patch)
tree25adba03741c11ebc16810e14c0784152d2e7e5d /package/iwinfo/src/iwinfo_nl80211.c
parent62d8009cdd9c8f998c23b0c71e5d8002e2c2153a (diff)
downloadupstream-843452730565e43ca70a2572681b651690c0789b.tar.gz
upstream-843452730565e43ca70a2572681b651690c0789b.tar.bz2
upstream-843452730565e43ca70a2572681b651690c0789b.zip
iwinfo: support nl80211 hardware identification against radioX pseudo interfaces, useful if radio is not up yet
SVN-Revision: 29462
Diffstat (limited to 'package/iwinfo/src/iwinfo_nl80211.c')
-rw-r--r--package/iwinfo/src/iwinfo_nl80211.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/package/iwinfo/src/iwinfo_nl80211.c b/package/iwinfo/src/iwinfo_nl80211.c
index 4b8b37daa8..4672b9d640 100644
--- a/package/iwinfo/src/iwinfo_nl80211.c
+++ b/package/iwinfo/src/iwinfo_nl80211.c
@@ -1631,6 +1631,27 @@ int nl80211_get_mbssid_support(const char *ifname, int *buf)
int nl80211_get_hardware_id(const char *ifname, char *buf)
{
+ int rv;
+ char *res;
+
+ /* Got a radioX pseudo interface, find some interface on it or create one */
+ if (!strncmp(ifname, "radio", 5))
+ {
+ /* Reuse existing interface */
+ if ((res = nl80211_phy2ifname(ifname)) != NULL)
+ {
+ return wext_get_hardware_id(res, buf);
+ }
+
+ /* Need to spawn a temporary iface for finding IDs */
+ else if ((res = nl80211_ifadd(ifname)) != NULL)
+ {
+ rv = wext_get_hardware_id(res, buf);
+ nl80211_ifdel(res);
+ return rv;
+ }
+ }
+
return wext_get_hardware_id(ifname, buf);
}