summaryrefslogtreecommitdiffhomepage
path: root/libs/sys/luasrc
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-08-13 01:24:44 +0000
committerSteven Barth <steven@midlink.org>2008-08-13 01:24:44 +0000
commit07fdaa87dbac0582960cded4e9aa981d4a141782 (patch)
tree158e9c66902494de736ea282b216a374ba01f516 /libs/sys/luasrc
parent0e3fda59e094a272bafc43b67e6393dc6f2b279e (diff)
modules/admin-full: Network interface configuration optimization part #1
Diffstat (limited to 'libs/sys/luasrc')
-rw-r--r--libs/sys/luasrc/sys.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/libs/sys/luasrc/sys.lua b/libs/sys/luasrc/sys.lua
index 56beafe94..c8d7a5477 100644
--- a/libs/sys/luasrc/sys.lua
+++ b/libs/sys/luasrc/sys.lua
@@ -212,6 +212,21 @@ function net.devices()
return devices
end
+
+--- Return information about available network interfaces.
+-- @return Table containing all current interface names and their information
+function net.deviceinfo()
+ local devices = {}
+ for line in io.lines("/proc/net/dev") do
+ local name, data = line:match("^ *(.-): *(.*)$")
+ if name and data then
+ devices[name] = luci.util.split(data, " +", nil, true)
+ end
+ end
+ return devices
+end
+
+
-- Determine the MAC address belonging to the given IP address.
-- @param ip IPv4 address
-- @return String containing the MAC address or nil if it cannot be found