Changeset 6332
- Timestamp:
- 10/23/10 02:37:05 (3 years ago)
- Location:
- luci/trunk/contrib/package/iwinfo/src
- Files:
-
- 3 modified
-
iwinfo.lua (modified) (2 diffs)
-
iwinfo_lualib.c (modified) (11 diffs)
-
iwinfo_nl80211.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
luci/trunk/contrib/package/iwinfo/src/iwinfo.lua
r6320 r6332 63 63 64 64 printf(" Encryption: %s", 65 s(enc and enc.description)) 65 s(enc and enc.description or "None")) 66 67 printf(" Supports VAPs: %s", 68 iw.mbssid_support(dev) and "yes" or "no") 66 69 67 70 print("") … … 86 89 87 90 printf(" Encryption: %s", 88 s(se.encryption.description ))91 s(se.encryption.description or "None")) 89 92 90 93 print("") -
luci/trunk/contrib/package/iwinfo/src/iwinfo_lualib.c
r6320 r6332 433 433 } 434 434 } 435 else 436 { 437 sprintf(desc, "None"); 438 } 435 439 } 436 440 else … … 695 699 } 696 700 697 return 0; 701 lua_pushnil(L); 702 return 1; 698 703 } 699 704 700 705 /* Wrapper for hwmode list */ 701 static int iwinfo_L_hwmodelist(lua_State *L, int (*func)(const char *, int *))706 static int iwinfo_L_hwmodelist(lua_State *L, int (*func)(const char *, int *)) 702 707 { 703 708 const char *ifname = luaL_checkstring(L, 1); … … 723 728 } 724 729 725 return 0; 730 lua_pushnil(L); 731 return 1; 732 } 733 734 /* Wrapper for mbbsid_support */ 735 static int iwinfo_L_mbssid_support(lua_State *L, int (*func)(const char *, int *)) 736 { 737 const char *ifname = luaL_checkstring(L, 1); 738 int support = 0; 739 740 if( !(*func)(ifname, &support) ) 741 { 742 lua_pushboolean(L, support); 743 return 1; 744 } 745 746 lua_pushnil(L); 747 return 1; 726 748 } 727 749 … … 793 815 LUA_WRAP_INT(wl,quality) 794 816 LUA_WRAP_INT(wl,quality_max) 795 LUA_WRAP_INT(wl,mbssid_support)796 817 LUA_WRAP_STRING(wl,mode) 797 818 LUA_WRAP_STRING(wl,ssid) … … 805 826 LUA_WRAP_LIST(wl,hwmodelist) 806 827 LUA_WRAP_LIST(wl,encryption) 828 LUA_WRAP_LIST(wl,mbssid_support) 807 829 #endif 808 830 … … 817 839 LUA_WRAP_INT(madwifi,quality) 818 840 LUA_WRAP_INT(madwifi,quality_max) 819 LUA_WRAP_INT(madwifi,mbssid_support)820 841 LUA_WRAP_STRING(madwifi,mode) 821 842 LUA_WRAP_STRING(madwifi,ssid) … … 829 850 LUA_WRAP_LIST(madwifi,hwmodelist) 830 851 LUA_WRAP_LIST(madwifi,encryption) 852 LUA_WRAP_LIST(madwifi,mbssid_support) 831 853 #endif 832 854 … … 841 863 LUA_WRAP_INT(nl80211,quality) 842 864 LUA_WRAP_INT(nl80211,quality_max) 843 LUA_WRAP_INT(nl80211,mbssid_support)844 865 LUA_WRAP_STRING(nl80211,mode) 845 866 LUA_WRAP_STRING(nl80211,ssid) … … 853 874 LUA_WRAP_LIST(nl80211,hwmodelist) 854 875 LUA_WRAP_LIST(nl80211,encryption) 876 LUA_WRAP_LIST(nl80211,mbssid_support) 855 877 #endif 856 878 … … 864 886 LUA_WRAP_INT(wext,quality) 865 887 LUA_WRAP_INT(wext,quality_max) 866 LUA_WRAP_INT(wext,mbssid_support)867 888 LUA_WRAP_STRING(wext,mode) 868 889 LUA_WRAP_STRING(wext,ssid) … … 876 897 LUA_WRAP_LIST(wext,hwmodelist) 877 898 LUA_WRAP_LIST(wext,encryption) 899 LUA_WRAP_LIST(wext,mbssid_support) 878 900 879 901 #ifdef USE_WL -
luci/trunk/contrib/package/iwinfo/src/iwinfo_nl80211.c
r6330 r6332 160 160 goto err; 161 161 162 if( !strncmp(ifname, "radio", 5) ) 162 if( !strncmp(ifname, "phy", 3) ) 163 phyidx = atoi(&ifname[3]); 164 else if( !strncmp(ifname, "radio", 5) ) 163 165 phyidx = atoi(&ifname[5]); 164 166 else if( !strncmp(ifname, "mon.", 4) ) … … 415 417 static char * nl80211_phy2ifname(const char *ifname) 416 418 { 417 int fd, phyidx = 0;419 int fd, phyidx = -1; 418 420 char buffer[64]; 419 421 static char nif[IFNAMSIZ] = { 0 }; … … 422 424 struct dirent *e; 423 425 424 if( !strncmp(ifname, "radio", 5) ) 425 { 426 if( !strncmp(ifname, "phy", 3) ) 427 phyidx = atoi(&ifname[3]); 428 else if( !strncmp(ifname, "radio", 5) ) 426 429 phyidx = atoi(&ifname[5]); 427 430 431 if( phyidx > -1 ) 432 { 428 433 if( (d = opendir("/sys/class/net")) != NULL ) 429 434 { … … 547 552 int fd, pid = 0; 548 553 char buf[32]; 549 char *phy = strncmp(ifname, "phy", 3) ? nl80211_ifname2phy(ifname) : ifname;554 char *phy = nl80211_ifname2phy(ifname); 550 555 551 556 if( phy ) … … 1509 1514 caps = nla_get_u16(bands[NL80211_BAND_ATTR_HT_CAPA]); 1510 1515 1511 /* Treat HT20/HT40as 11n */1512 if( caps & (1 << 1))1516 /* Treat any nonzero capability as 11n */ 1517 if( caps > 0 ) 1513 1518 *buf |= IWINFO_80211_N; 1514 1519 … … 1543 1548 int nl80211_get_mbssid_support(const char *ifname, int *buf) 1544 1549 { 1545 /* We assume that multi bssid is always possible */ 1546 *buf = 1; 1547 return 0; 1548 } 1550 /* test whether we can create another interface */ 1551 char *nif = nl80211_ifadd(ifname); 1552 1553 if( nif ) 1554 { 1555 *buf = (nl80211_ifmac(nif) && nl80211_ifup(nif)); 1556 1557 nl80211_ifdown(nif); 1558 nl80211_ifdel(nif); 1559 1560 return 0; 1561 } 1562 1563 return -1; 1564 }
