iwinfo: support nl80211 hardware identification against radioX pseudo interfaces...
authorJo-Philipp Wich <jow@openwrt.org>
Tue, 6 Dec 2011 13:24:47 +0000 (13:24 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Tue, 6 Dec 2011 13:24:47 +0000 (13:24 +0000)
SVN-Revision: 29462

package/iwinfo/Makefile
package/iwinfo/src/iwinfo_nl80211.c

index 471904432ee61ef0ee14a78c224b608ac920c7b5..f69b86e8f72ac353372175f14cde6b71c24723a6 100644 (file)
@@ -7,7 +7,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libiwinfo
-PKG_RELEASE:=20
+PKG_RELEASE:=21
 
 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
 
index 4b8b37daa89b7b96c053a50e1cd102802c1c2b7a..4672b9d6408b70894a3bd83008fca119b181c05e 100644 (file)
@@ -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);
 }