config: use PARTUUID by default on x86_64
[openwrt.git] / package / network / utils / iwinfo / src / iwinfo_lua.c
index bd8faf9..3201af4 100644 (file)
@@ -362,7 +362,7 @@ static int iwinfo_L_txpwrlist(lua_State *L, int (*func)(const char *, char *, in
 /* Wrapper for scan list */
 static int iwinfo_L_scanlist(lua_State *L, int (*func)(const char *, char *, int *))
 {
-       int i, x, len;
+       int i, x, len = 0;
        char rv[IWINFO_BUFSIZE];
        char macstr[18];
        const char *ifname = luaL_checkstring(L, 1);
@@ -499,6 +499,9 @@ static int iwinfo_L_hwmodelist(lua_State *L, int (*func)(const char *, int *))
                lua_pushboolean(L, hwmodes & IWINFO_80211_N);
                lua_setfield(L, -2, "n");
 
+               lua_pushboolean(L, hwmodes & IWINFO_80211_AC);
+               lua_setfield(L, -2, "ac");
+
                return 1;
        }
 
@@ -611,113 +614,117 @@ static int iwinfo_L_countrylist(lua_State *L, int (*func)(const char *, char *,
 
 #ifdef USE_WL
 /* Broadcom */
-LUA_WRAP_INT(wl,channel)
-LUA_WRAP_INT(wl,frequency)
-LUA_WRAP_INT(wl,frequency_offset)
-LUA_WRAP_INT(wl,txpower)
-LUA_WRAP_INT(wl,txpower_offset)
-LUA_WRAP_INT(wl,bitrate)
-LUA_WRAP_INT(wl,signal)
-LUA_WRAP_INT(wl,noise)
-LUA_WRAP_INT(wl,quality)
-LUA_WRAP_INT(wl,quality_max)
-LUA_WRAP_STRING(wl,ssid)
-LUA_WRAP_STRING(wl,bssid)
-LUA_WRAP_STRING(wl,country)
-LUA_WRAP_STRING(wl,hardware_name)
-LUA_WRAP_STRUCT(wl,mode)
-LUA_WRAP_STRUCT(wl,assoclist)
-LUA_WRAP_STRUCT(wl,txpwrlist)
-LUA_WRAP_STRUCT(wl,scanlist)
-LUA_WRAP_STRUCT(wl,freqlist)
-LUA_WRAP_STRUCT(wl,countrylist)
-LUA_WRAP_STRUCT(wl,hwmodelist)
-LUA_WRAP_STRUCT(wl,encryption)
-LUA_WRAP_STRUCT(wl,mbssid_support)
-LUA_WRAP_STRUCT(wl,hardware_id)
+LUA_WRAP_INT_OP(wl,channel)
+LUA_WRAP_INT_OP(wl,frequency)
+LUA_WRAP_INT_OP(wl,frequency_offset)
+LUA_WRAP_INT_OP(wl,txpower)
+LUA_WRAP_INT_OP(wl,txpower_offset)
+LUA_WRAP_INT_OP(wl,bitrate)
+LUA_WRAP_INT_OP(wl,signal)
+LUA_WRAP_INT_OP(wl,noise)
+LUA_WRAP_INT_OP(wl,quality)
+LUA_WRAP_INT_OP(wl,quality_max)
+LUA_WRAP_STRING_OP(wl,ssid)
+LUA_WRAP_STRING_OP(wl,bssid)
+LUA_WRAP_STRING_OP(wl,country)
+LUA_WRAP_STRING_OP(wl,hardware_name)
+LUA_WRAP_STRING_OP(wl,phyname)
+LUA_WRAP_STRUCT_OP(wl,mode)
+LUA_WRAP_STRUCT_OP(wl,assoclist)
+LUA_WRAP_STRUCT_OP(wl,txpwrlist)
+LUA_WRAP_STRUCT_OP(wl,scanlist)
+LUA_WRAP_STRUCT_OP(wl,freqlist)
+LUA_WRAP_STRUCT_OP(wl,countrylist)
+LUA_WRAP_STRUCT_OP(wl,hwmodelist)
+LUA_WRAP_STRUCT_OP(wl,encryption)
+LUA_WRAP_STRUCT_OP(wl,mbssid_support)
+LUA_WRAP_STRUCT_OP(wl,hardware_id)
 #endif
 
 #ifdef USE_MADWIFI
 /* Madwifi */
-LUA_WRAP_INT(madwifi,channel)
-LUA_WRAP_INT(madwifi,frequency)
-LUA_WRAP_INT(madwifi,frequency_offset)
-LUA_WRAP_INT(madwifi,txpower)
-LUA_WRAP_INT(madwifi,txpower_offset)
-LUA_WRAP_INT(madwifi,bitrate)
-LUA_WRAP_INT(madwifi,signal)
-LUA_WRAP_INT(madwifi,noise)
-LUA_WRAP_INT(madwifi,quality)
-LUA_WRAP_INT(madwifi,quality_max)
-LUA_WRAP_STRING(madwifi,ssid)
-LUA_WRAP_STRING(madwifi,bssid)
-LUA_WRAP_STRING(madwifi,country)
-LUA_WRAP_STRING(madwifi,hardware_name)
-LUA_WRAP_STRUCT(madwifi,mode)
-LUA_WRAP_STRUCT(madwifi,assoclist)
-LUA_WRAP_STRUCT(madwifi,txpwrlist)
-LUA_WRAP_STRUCT(madwifi,scanlist)
-LUA_WRAP_STRUCT(madwifi,freqlist)
-LUA_WRAP_STRUCT(madwifi,countrylist)
-LUA_WRAP_STRUCT(madwifi,hwmodelist)
-LUA_WRAP_STRUCT(madwifi,encryption)
-LUA_WRAP_STRUCT(madwifi,mbssid_support)
-LUA_WRAP_STRUCT(madwifi,hardware_id)
+LUA_WRAP_INT_OP(madwifi,channel)
+LUA_WRAP_INT_OP(madwifi,frequency)
+LUA_WRAP_INT_OP(madwifi,frequency_offset)
+LUA_WRAP_INT_OP(madwifi,txpower)
+LUA_WRAP_INT_OP(madwifi,txpower_offset)
+LUA_WRAP_INT_OP(madwifi,bitrate)
+LUA_WRAP_INT_OP(madwifi,signal)
+LUA_WRAP_INT_OP(madwifi,noise)
+LUA_WRAP_INT_OP(madwifi,quality)
+LUA_WRAP_INT_OP(madwifi,quality_max)
+LUA_WRAP_STRING_OP(madwifi,ssid)
+LUA_WRAP_STRING_OP(madwifi,bssid)
+LUA_WRAP_STRING_OP(madwifi,country)
+LUA_WRAP_STRING_OP(madwifi,hardware_name)
+LUA_WRAP_STRING_OP(madwifi,phyname)
+LUA_WRAP_STRUCT_OP(madwifi,mode)
+LUA_WRAP_STRUCT_OP(madwifi,assoclist)
+LUA_WRAP_STRUCT_OP(madwifi,txpwrlist)
+LUA_WRAP_STRUCT_OP(madwifi,scanlist)
+LUA_WRAP_STRUCT_OP(madwifi,freqlist)
+LUA_WRAP_STRUCT_OP(madwifi,countrylist)
+LUA_WRAP_STRUCT_OP(madwifi,hwmodelist)
+LUA_WRAP_STRUCT_OP(madwifi,encryption)
+LUA_WRAP_STRUCT_OP(madwifi,mbssid_support)
+LUA_WRAP_STRUCT_OP(madwifi,hardware_id)
 #endif
 
 #ifdef USE_NL80211
 /* NL80211 */
-LUA_WRAP_INT(nl80211,channel)
-LUA_WRAP_INT(nl80211,frequency)
-LUA_WRAP_INT(nl80211,frequency_offset)
-LUA_WRAP_INT(nl80211,txpower)
-LUA_WRAP_INT(nl80211,txpower_offset)
-LUA_WRAP_INT(nl80211,bitrate)
-LUA_WRAP_INT(nl80211,signal)
-LUA_WRAP_INT(nl80211,noise)
-LUA_WRAP_INT(nl80211,quality)
-LUA_WRAP_INT(nl80211,quality_max)
-LUA_WRAP_STRING(nl80211,ssid)
-LUA_WRAP_STRING(nl80211,bssid)
-LUA_WRAP_STRING(nl80211,country)
-LUA_WRAP_STRING(nl80211,hardware_name)
-LUA_WRAP_STRUCT(nl80211,mode)
-LUA_WRAP_STRUCT(nl80211,assoclist)
-LUA_WRAP_STRUCT(nl80211,txpwrlist)
-LUA_WRAP_STRUCT(nl80211,scanlist)
-LUA_WRAP_STRUCT(nl80211,freqlist)
-LUA_WRAP_STRUCT(nl80211,countrylist)
-LUA_WRAP_STRUCT(nl80211,hwmodelist)
-LUA_WRAP_STRUCT(nl80211,encryption)
-LUA_WRAP_STRUCT(nl80211,mbssid_support)
-LUA_WRAP_STRUCT(nl80211,hardware_id)
+LUA_WRAP_INT_OP(nl80211,channel)
+LUA_WRAP_INT_OP(nl80211,frequency)
+LUA_WRAP_INT_OP(nl80211,frequency_offset)
+LUA_WRAP_INT_OP(nl80211,txpower)
+LUA_WRAP_INT_OP(nl80211,txpower_offset)
+LUA_WRAP_INT_OP(nl80211,bitrate)
+LUA_WRAP_INT_OP(nl80211,signal)
+LUA_WRAP_INT_OP(nl80211,noise)
+LUA_WRAP_INT_OP(nl80211,quality)
+LUA_WRAP_INT_OP(nl80211,quality_max)
+LUA_WRAP_STRING_OP(nl80211,ssid)
+LUA_WRAP_STRING_OP(nl80211,bssid)
+LUA_WRAP_STRING_OP(nl80211,country)
+LUA_WRAP_STRING_OP(nl80211,hardware_name)
+LUA_WRAP_STRING_OP(nl80211,phyname)
+LUA_WRAP_STRUCT_OP(nl80211,mode)
+LUA_WRAP_STRUCT_OP(nl80211,assoclist)
+LUA_WRAP_STRUCT_OP(nl80211,txpwrlist)
+LUA_WRAP_STRUCT_OP(nl80211,scanlist)
+LUA_WRAP_STRUCT_OP(nl80211,freqlist)
+LUA_WRAP_STRUCT_OP(nl80211,countrylist)
+LUA_WRAP_STRUCT_OP(nl80211,hwmodelist)
+LUA_WRAP_STRUCT_OP(nl80211,encryption)
+LUA_WRAP_STRUCT_OP(nl80211,mbssid_support)
+LUA_WRAP_STRUCT_OP(nl80211,hardware_id)
 #endif
 
 /* Wext */
-LUA_WRAP_INT(wext,channel)
-LUA_WRAP_INT(wext,frequency)
-LUA_WRAP_INT(wext,frequency_offset)
-LUA_WRAP_INT(wext,txpower)
-LUA_WRAP_INT(wext,txpower_offset)
-LUA_WRAP_INT(wext,bitrate)
-LUA_WRAP_INT(wext,signal)
-LUA_WRAP_INT(wext,noise)
-LUA_WRAP_INT(wext,quality)
-LUA_WRAP_INT(wext,quality_max)
-LUA_WRAP_STRING(wext,ssid)
-LUA_WRAP_STRING(wext,bssid)
-LUA_WRAP_STRING(wext,country)
-LUA_WRAP_STRING(wext,hardware_name)
-LUA_WRAP_STRUCT(wext,mode)
-LUA_WRAP_STRUCT(wext,assoclist)
-LUA_WRAP_STRUCT(wext,txpwrlist)
-LUA_WRAP_STRUCT(wext,scanlist)
-LUA_WRAP_STRUCT(wext,freqlist)
-LUA_WRAP_STRUCT(wext,countrylist)
-LUA_WRAP_STRUCT(wext,hwmodelist)
-LUA_WRAP_STRUCT(wext,encryption)
-LUA_WRAP_STRUCT(wext,mbssid_support)
-LUA_WRAP_STRUCT(wext,hardware_id)
+LUA_WRAP_INT_OP(wext,channel)
+LUA_WRAP_INT_OP(wext,frequency)
+LUA_WRAP_INT_OP(wext,frequency_offset)
+LUA_WRAP_INT_OP(wext,txpower)
+LUA_WRAP_INT_OP(wext,txpower_offset)
+LUA_WRAP_INT_OP(wext,bitrate)
+LUA_WRAP_INT_OP(wext,signal)
+LUA_WRAP_INT_OP(wext,noise)
+LUA_WRAP_INT_OP(wext,quality)
+LUA_WRAP_INT_OP(wext,quality_max)
+LUA_WRAP_STRING_OP(wext,ssid)
+LUA_WRAP_STRING_OP(wext,bssid)
+LUA_WRAP_STRING_OP(wext,country)
+LUA_WRAP_STRING_OP(wext,hardware_name)
+LUA_WRAP_STRING_OP(wext,phyname)
+LUA_WRAP_STRUCT_OP(wext,mode)
+LUA_WRAP_STRUCT_OP(wext,assoclist)
+LUA_WRAP_STRUCT_OP(wext,txpwrlist)
+LUA_WRAP_STRUCT_OP(wext,scanlist)
+LUA_WRAP_STRUCT_OP(wext,freqlist)
+LUA_WRAP_STRUCT_OP(wext,countrylist)
+LUA_WRAP_STRUCT_OP(wext,hwmodelist)
+LUA_WRAP_STRUCT_OP(wext,encryption)
+LUA_WRAP_STRUCT_OP(wext,mbssid_support)
+LUA_WRAP_STRUCT_OP(wext,hardware_id)
 
 #ifdef USE_WL
 /* Broadcom table */
@@ -746,6 +753,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 +785,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 +817,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 +848,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 }
 };
 
@@ -854,6 +865,7 @@ LUALIB_API int luaopen_iwinfo(lua_State *L) {
 
 #ifdef USE_WL
        luaL_newmetatable(L, IWINFO_WL_META);
+       luaL_register(L, NULL, R_common);
        luaL_register(L, NULL, R_wl);
        lua_pushvalue(L, -1);
        lua_setfield(L, -2, "__index");
@@ -862,6 +874,7 @@ LUALIB_API int luaopen_iwinfo(lua_State *L) {
 
 #ifdef USE_MADWIFI
        luaL_newmetatable(L, IWINFO_MADWIFI_META);
+       luaL_register(L, NULL, R_common);
        luaL_register(L, NULL, R_madwifi);
        lua_pushvalue(L, -1);
        lua_setfield(L, -2, "__index");
@@ -870,6 +883,7 @@ LUALIB_API int luaopen_iwinfo(lua_State *L) {
 
 #ifdef USE_NL80211
        luaL_newmetatable(L, IWINFO_NL80211_META);
+       luaL_register(L, NULL, R_common);
        luaL_register(L, NULL, R_nl80211);
        lua_pushvalue(L, -1);
        lua_setfield(L, -2, "__index");
@@ -877,6 +891,7 @@ LUALIB_API int luaopen_iwinfo(lua_State *L) {
 #endif
 
        luaL_newmetatable(L, IWINFO_WEXT_META);
+       luaL_register(L, NULL, R_common);
        luaL_register(L, NULL, R_wext);
        lua_pushvalue(L, -1);
        lua_setfield(L, -2, "__index");