diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-10-31 14:57:27 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-11-01 12:03:33 +0100 |
commit | cc1cbdaf3296bf8360c68127aadae46f08e66e1f (patch) | |
tree | 99a2fd4b2f2bd50e89f1801820992d54f7ce6c46 /modules/luci-base/root/usr/libexec | |
parent | a96e7a664fa9ddd6de25f1a8d114cfd6d33d83e6 (diff) |
luci-base: migrate luci/getNetworkDevices to C plugin
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/root/usr/libexec')
-rwxr-xr-x | modules/luci-base/root/usr/libexec/rpcd/luci | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/modules/luci-base/root/usr/libexec/rpcd/luci b/modules/luci-base/root/usr/libexec/rpcd/luci index da36270a17..ae504fd3e3 100755 --- a/modules/luci-base/root/usr/libexec/rpcd/luci +++ b/modules/luci-base/root/usr/libexec/rpcd/luci @@ -186,69 +186,6 @@ local methods = { end }, - getNetworkDevices = { - call = function(args) - local dir = fs.dir("/sys/class/net") - local result = { } - if dir then - local dev - for dev in dir do - if not result[dev] then - result[dev] = { name = dev } - end - - if fs.access("/sys/class/net/"..dev.."/master") then - local brname = fs.basename(fs.readlink("/sys/class/net/"..dev.."/master")) - if not result[brname] then - result[brname] = { name = brname } - end - - if not result[brname].ports then - result[brname].ports = { } - end - - result[brname].ports[#result[brname].ports+1] = dev - elseif fs.access("/sys/class/net/"..dev.."/bridge") then - if not result[dev].ports then - result[dev].ports = { } - end - - result[dev].id = readfile("/sys/class/net/"..dev.."/bridge/bridge_id") - result[dev].stp = (readfile("/sys/class/net/"..dev.."/bridge/stp_state") ~= "0") - result[dev].bridge = true - end - - local opr = readfile("/sys/class/net/"..dev.."/operstate") - - result[dev].up = (opr == "up" or opr == "unknown") - result[dev].type = tonumber(readfile("/sys/class/net/"..dev.."/type")) - result[dev].name = dev - - local mtu = tonumber(readfile("/sys/class/net/"..dev.."/mtu")) - if mtu and mtu > 0 then - result[dev].mtu = mtu - end - - local qlen = tonumber(readfile("/sys/class/net/"..dev.."/tx_queue_len")) - if qlen and qlen > 0 then - result[dev].qlen = qlen - end - - local master = fs.readlink("/sys/class/net/"..dev.."/master") - if master then - result[dev].master = fs.basename(master) - end - - local mac = readfile("/sys/class/net/"..dev.."/address") - if mac and #mac == 17 then - result[dev].mac = mac - end - end - end - return result - end - }, - getConntrackHelpers = { call = function() local ok, fd = pcall(io.open, "/usr/share/fw3/helpers.conf", "r") |