diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2013-06-09 14:39:14 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2013-06-09 14:39:14 +0000 |
commit | bc73ca56198ce61623db3061e00c1d246d1e20a5 (patch) | |
tree | a43edb26e9ca27496f6d0f412c5a7ce88ecb5079 /package/network | |
parent | cb24c37858e2628c9dba371653779ad2aa771899 (diff) | |
download | mtk-20170518-bc73ca56198ce61623db3061e00c1d246d1e20a5.zip mtk-20170518-bc73ca56198ce61623db3061e00c1d246d1e20a5.tar.gz mtk-20170518-bc73ca56198ce61623db3061e00c1d246d1e20a5.tar.bz2 |
iwinfo: add phyname attribute, this is useful to group networks by radio phy
SVN-Revision: 36889
Diffstat (limited to 'package/network')
-rw-r--r-- | package/network/utils/iwinfo/Makefile | 2 | ||||
-rw-r--r-- | package/network/utils/iwinfo/src/include/iwinfo.h | 1 | ||||
-rw-r--r-- | package/network/utils/iwinfo/src/include/iwinfo/madwifi.h | 2 | ||||
-rw-r--r-- | package/network/utils/iwinfo/src/include/iwinfo/nl80211.h | 2 | ||||
-rw-r--r-- | package/network/utils/iwinfo/src/include/iwinfo/wext.h | 2 | ||||
-rw-r--r-- | package/network/utils/iwinfo/src/include/iwinfo/wl.h | 2 | ||||
-rw-r--r-- | package/network/utils/iwinfo/src/iwinfo_cli.c | 15 | ||||
-rw-r--r-- | package/network/utils/iwinfo/src/iwinfo_lua.c | 8 | ||||
-rw-r--r-- | package/network/utils/iwinfo/src/iwinfo_madwifi.c | 20 | ||||
-rw-r--r-- | package/network/utils/iwinfo/src/iwinfo_nl80211.c | 25 | ||||
-rw-r--r-- | package/network/utils/iwinfo/src/iwinfo_wext.c | 7 | ||||
-rw-r--r-- | package/network/utils/iwinfo/src/iwinfo_wl.c | 12 |
12 files changed, 95 insertions, 3 deletions
diff --git a/package/network/utils/iwinfo/Makefile b/package/network/utils/iwinfo/Makefile index 018832f..aa53411 100644 --- a/package/network/utils/iwinfo/Makefile +++ b/package/network/utils/iwinfo/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libiwinfo -PKG_RELEASE:=45 +PKG_RELEASE:=46 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) PKG_CONFIG_DEPENDS := \ diff --git a/package/network/utils/iwinfo/src/include/iwinfo.h b/package/network/utils/iwinfo/src/include/iwinfo.h index 0d92d8d..ebea319 100644 --- a/package/network/utils/iwinfo/src/include/iwinfo.h +++ b/package/network/utils/iwinfo/src/include/iwinfo.h @@ -167,6 +167,7 @@ struct iwinfo_ops { int (*hardware_id)(const char *, char *); int (*hardware_name)(const char *, char *); int (*encryption)(const char *, char *); + int (*phyname)(const char *, char *); int (*assoclist)(const char *, char *, int *); int (*txpwrlist)(const char *, char *, int *); int (*scanlist)(const char *, char *, int *); diff --git a/package/network/utils/iwinfo/src/include/iwinfo/madwifi.h b/package/network/utils/iwinfo/src/include/iwinfo/madwifi.h index 14d8135..3662d9f 100644 --- a/package/network/utils/iwinfo/src/include/iwinfo/madwifi.h +++ b/package/network/utils/iwinfo/src/include/iwinfo/madwifi.h @@ -41,6 +41,7 @@ int madwifi_get_noise(const char *ifname, int *buf); int madwifi_get_quality(const char *ifname, int *buf); int madwifi_get_quality_max(const char *ifname, int *buf); int madwifi_get_encryption(const char *ifname, char *buf); +int madwifi_get_phyname(const char *ifname, char *buf); int madwifi_get_assoclist(const char *ifname, char *buf, int *len); int madwifi_get_txpwrlist(const char *ifname, char *buf, int *len); int madwifi_get_scanlist(const char *ifname, char *buf, int *len); @@ -72,6 +73,7 @@ static const struct iwinfo_ops madwifi_ops = { .hardware_id = madwifi_get_hardware_id, .hardware_name = madwifi_get_hardware_name, .encryption = madwifi_get_encryption, + .phyname = madwifi_get_phyname, .assoclist = madwifi_get_assoclist, .txpwrlist = madwifi_get_txpwrlist, .scanlist = madwifi_get_scanlist, diff --git a/package/network/utils/iwinfo/src/include/iwinfo/nl80211.h b/package/network/utils/iwinfo/src/include/iwinfo/nl80211.h index 2854514..0611fee 100644 --- a/package/network/utils/iwinfo/src/include/iwinfo/nl80211.h +++ b/package/network/utils/iwinfo/src/include/iwinfo/nl80211.h @@ -83,6 +83,7 @@ int nl80211_get_noise(const char *ifname, int *buf); int nl80211_get_quality(const char *ifname, int *buf); int nl80211_get_quality_max(const char *ifname, int *buf); int nl80211_get_encryption(const char *ifname, char *buf); +int nl80211_get_phyname(const char *ifname, char *buf); int nl80211_get_assoclist(const char *ifname, char *buf, int *len); int nl80211_get_txpwrlist(const char *ifname, char *buf, int *len); int nl80211_get_scanlist(const char *ifname, char *buf, int *len); @@ -114,6 +115,7 @@ static const struct iwinfo_ops nl80211_ops = { .hardware_id = nl80211_get_hardware_id, .hardware_name = nl80211_get_hardware_name, .encryption = nl80211_get_encryption, + .phyname = nl80211_get_phyname, .assoclist = nl80211_get_assoclist, .txpwrlist = nl80211_get_txpwrlist, .scanlist = nl80211_get_scanlist, diff --git a/package/network/utils/iwinfo/src/include/iwinfo/wext.h b/package/network/utils/iwinfo/src/include/iwinfo/wext.h index 68b596e..e84f6a6 100644 --- a/package/network/utils/iwinfo/src/include/iwinfo/wext.h +++ b/package/network/utils/iwinfo/src/include/iwinfo/wext.h @@ -42,6 +42,7 @@ int wext_get_noise(const char *ifname, int *buf); int wext_get_quality(const char *ifname, int *buf); int wext_get_quality_max(const char *ifname, int *buf); int wext_get_encryption(const char *ifname, char *buf); +int wext_get_phyname(const char *ifname, char *buf); int wext_get_assoclist(const char *ifname, char *buf, int *len); int wext_get_txpwrlist(const char *ifname, char *buf, int *len); int wext_get_scanlist(const char *ifname, char *buf, int *len); @@ -73,6 +74,7 @@ static const struct iwinfo_ops wext_ops = { .hardware_id = wext_get_hardware_id, .hardware_name = wext_get_hardware_name, .encryption = wext_get_encryption, + .phyname = wext_get_phyname, .assoclist = wext_get_assoclist, .txpwrlist = wext_get_txpwrlist, .scanlist = wext_get_scanlist, diff --git a/package/network/utils/iwinfo/src/include/iwinfo/wl.h b/package/network/utils/iwinfo/src/include/iwinfo/wl.h index db37e37..077a51b 100644 --- a/package/network/utils/iwinfo/src/include/iwinfo/wl.h +++ b/package/network/utils/iwinfo/src/include/iwinfo/wl.h @@ -42,6 +42,7 @@ int wl_get_quality(const char *ifname, int *buf); int wl_get_quality_max(const char *ifname, int *buf); int wl_get_enctype(const char *ifname, char *buf); int wl_get_encryption(const char *ifname, char *buf); +int wl_get_phyname(const char *ifname, char *buf); int wl_get_assoclist(const char *ifname, char *buf, int *len); int wl_get_txpwrlist(const char *ifname, char *buf, int *len); int wl_get_scanlist(const char *ifname, char *buf, int *len); @@ -73,6 +74,7 @@ static const struct iwinfo_ops wl_ops = { .hardware_id = wl_get_hardware_id, .hardware_name = wl_get_hardware_name, .encryption = wl_get_encryption, + .phyname = wl_get_phyname, .assoclist = wl_get_assoclist, .txpwrlist = wl_get_txpwrlist, .scanlist = wl_get_scanlist, diff --git a/package/network/utils/iwinfo/src/iwinfo_cli.c b/package/network/utils/iwinfo/src/iwinfo_cli.c index 8da216a..87cc10f 100644 --- a/package/network/utils/iwinfo/src/iwinfo_cli.c +++ b/package/network/utils/iwinfo/src/iwinfo_cli.c @@ -512,6 +512,16 @@ static char * print_mbssid_supp(const struct iwinfo_ops *iw, const char *ifname) return buf; } +static char * print_phyname(const struct iwinfo_ops *iw, const char *ifname) +{ + static char buf[32]; + + if (!iw->phyname(ifname, buf)) + return buf; + + return "?"; +} + static void print_info(const struct iwinfo_ops *iw, const char *ifname) { @@ -545,8 +555,9 @@ static void print_info(const struct iwinfo_ops *iw, const char *ifname) print_txpower_offset(iw, ifname)); printf(" Frequency offset: %s\n", print_frequency_offset(iw, ifname)); - printf(" Supports VAPs: %s\n", - print_mbssid_supp(iw, ifname)); + printf(" Supports VAPs: %s PHY name: %s\n", + print_mbssid_supp(iw, ifname), + print_phyname(iw, ifname)); } diff --git a/package/network/utils/iwinfo/src/iwinfo_lua.c b/package/network/utils/iwinfo/src/iwinfo_lua.c index bd8faf9..fc4fd4a 100644 --- a/package/network/utils/iwinfo/src/iwinfo_lua.c +++ b/package/network/utils/iwinfo/src/iwinfo_lua.c @@ -625,6 +625,7 @@ LUA_WRAP_STRING(wl,ssid) LUA_WRAP_STRING(wl,bssid) LUA_WRAP_STRING(wl,country) LUA_WRAP_STRING(wl,hardware_name) +LUA_WRAP_STRING(wl,phyname) LUA_WRAP_STRUCT(wl,mode) LUA_WRAP_STRUCT(wl,assoclist) LUA_WRAP_STRUCT(wl,txpwrlist) @@ -653,6 +654,7 @@ LUA_WRAP_STRING(madwifi,ssid) LUA_WRAP_STRING(madwifi,bssid) LUA_WRAP_STRING(madwifi,country) LUA_WRAP_STRING(madwifi,hardware_name) +LUA_WRAP_STRING(madwifi,phyname) LUA_WRAP_STRUCT(madwifi,mode) LUA_WRAP_STRUCT(madwifi,assoclist) LUA_WRAP_STRUCT(madwifi,txpwrlist) @@ -681,6 +683,7 @@ LUA_WRAP_STRING(nl80211,ssid) LUA_WRAP_STRING(nl80211,bssid) LUA_WRAP_STRING(nl80211,country) LUA_WRAP_STRING(nl80211,hardware_name) +LUA_WRAP_STRING(nl80211,phyname) LUA_WRAP_STRUCT(nl80211,mode) LUA_WRAP_STRUCT(nl80211,assoclist) LUA_WRAP_STRUCT(nl80211,txpwrlist) @@ -708,6 +711,7 @@ LUA_WRAP_STRING(wext,ssid) LUA_WRAP_STRING(wext,bssid) LUA_WRAP_STRING(wext,country) LUA_WRAP_STRING(wext,hardware_name) +LUA_WRAP_STRING(wext,phyname) LUA_WRAP_STRUCT(wext,mode) LUA_WRAP_STRUCT(wext,assoclist) LUA_WRAP_STRUCT(wext,txpwrlist) @@ -746,6 +750,7 @@ static const luaL_reg R_wl[] = { LUA_REG(wl,mbssid_support), LUA_REG(wl,hardware_id), LUA_REG(wl,hardware_name), + LUA_REG(wl,phyname), { NULL, NULL } }; #endif @@ -777,6 +782,7 @@ static const luaL_reg R_madwifi[] = { LUA_REG(madwifi,mbssid_support), LUA_REG(madwifi,hardware_id), LUA_REG(madwifi,hardware_name), + LUA_REG(madwifi,phyname), { NULL, NULL } }; #endif @@ -808,6 +814,7 @@ static const luaL_reg R_nl80211[] = { LUA_REG(nl80211,mbssid_support), LUA_REG(nl80211,hardware_id), LUA_REG(nl80211,hardware_name), + LUA_REG(nl80211,phyname), { NULL, NULL } }; #endif @@ -838,6 +845,7 @@ static const luaL_reg R_wext[] = { LUA_REG(wext,mbssid_support), LUA_REG(wext,hardware_id), LUA_REG(wext,hardware_name), + LUA_REG(wext,phyname), { NULL, NULL } }; diff --git a/package/network/utils/iwinfo/src/iwinfo_madwifi.c b/package/network/utils/iwinfo/src/iwinfo_madwifi.c index 832f40b..293c28e 100644 --- a/package/network/utils/iwinfo/src/iwinfo_madwifi.c +++ b/package/network/utils/iwinfo/src/iwinfo_madwifi.c @@ -721,6 +721,26 @@ int madwifi_get_encryption(const char *ifname, char *buf) return 0; } +int madwifi_get_phyname(const char *ifname, char *buf) +{ + const char *wifidev; + + wifidev = madwifi_isvap(ifname, NULL); + + if (wifidev) + { + strcpy(buf, wifidev); + return 0; + } + else if (madwifi_iswifi(ifname)) + { + strcpy(buf, madwifi_phyname(ifname)); + return 0; + } + + return -1; +} + int madwifi_get_assoclist(const char *ifname, char *buf, int *len) { int bl, tl, noise; diff --git a/package/network/utils/iwinfo/src/iwinfo_nl80211.c b/package/network/utils/iwinfo/src/iwinfo_nl80211.c index 051d34d..9486ffc 100644 --- a/package/network/utils/iwinfo/src/iwinfo_nl80211.c +++ b/package/network/utils/iwinfo/src/iwinfo_nl80211.c @@ -1407,6 +1407,31 @@ int nl80211_get_encryption(const char *ifname, char *buf) return -1; } +int nl80211_get_phyname(const char *ifname, char *buf) +{ + const char *name; + + name = nl80211_ifname2phy(ifname); + + if (name) + { + strcpy(buf, name); + return 0; + } + else if ((name = nl80211_phy2ifname(ifname)) != NULL) + { + name = nl80211_ifname2phy(name); + + if (name) + { + strcpy(buf, ifname); + return 0; + } + } + + return -1; +} + static int nl80211_get_assoclist_cb(struct nl_msg *msg, void *arg) { diff --git a/package/network/utils/iwinfo/src/iwinfo_wext.c b/package/network/utils/iwinfo/src/iwinfo_wext.c index cf3dccc..890a36d 100644 --- a/package/network/utils/iwinfo/src/iwinfo_wext.c +++ b/package/network/utils/iwinfo/src/iwinfo_wext.c @@ -446,6 +446,13 @@ int wext_get_encryption(const char *ifname, char *buf) return -1; } +int wext_get_phyname(const char *ifname, char *buf) +{ + /* No suitable api in wext */ + strcpy(buf, ifname); + return 0; +} + int wext_get_mbssid_support(const char *ifname, int *buf) { /* No multi bssid support atm */ diff --git a/package/network/utils/iwinfo/src/iwinfo_wl.c b/package/network/utils/iwinfo/src/iwinfo_wl.c index 3d15fc9..0a1439b 100644 --- a/package/network/utils/iwinfo/src/iwinfo_wl.c +++ b/package/network/utils/iwinfo/src/iwinfo_wl.c @@ -321,6 +321,18 @@ int wl_get_encryption(const char *ifname, char *buf) return 0; } +int wl_get_phyname(const char *ifname, char *buf) +{ + char *p; + + strcpy(buf, ifname); + + if ((p = strchr(buf, '.')) != NULL) + *p = 0; + + return 0; +} + int wl_get_enctype(const char *ifname, char *buf) { uint32_t wsec, wpa; |