🐶 Sync 2025-11-02 14:26:26
This commit is contained in:
23
autocore-arm/files/generic/ethinfo
Executable file
23
autocore-arm/files/generic/ethinfo
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local util = require "luci.util"
|
||||
local jsonc = require "luci.jsonc"
|
||||
|
||||
local eth_info = {}
|
||||
local ifname, stat
|
||||
for ifname, stat in pairs(util.ubus("network.device", "status")) do
|
||||
if ifname:match("^(eth%d+)$") == ifname or ifname:match("^(usb%d+)$") or ifname:match("^(lan%d+)$") or ifname:match("wan") == ifname then
|
||||
eth_info[#eth_info + 1] = {
|
||||
device = ifname
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(
|
||||
eth_info,
|
||||
function(a, b)
|
||||
return a.device < b.device
|
||||
end
|
||||
)
|
||||
|
||||
print(jsonc.stringify(eth_info))
|
||||
Reference in New Issue
Block a user