summaryrefslogtreecommitdiffstats
path: root/package/iwinfo/src
diff options
context:
space:
mode:
authorjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>2011-12-06 13:24:47 +0000
committerjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>2011-12-06 13:24:47 +0000
commitac75d1363c718d30cec1a43f300da83d0f0aa65d (patch)
tree5267eecb20345adc4b282804e924b9d544758241 /package/iwinfo/src
parent05a63614496bb1c0bd34a6b60b9f9d0c19558dca (diff)
[package] iwinfo: support nl80211 hardware identification against radioX pseudo interfaces, useful if radio is not up yet
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@29462 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/iwinfo/src')
-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 4b8b37daa..4672b9d64 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);
}