diff options
Diffstat (limited to 'libs/sys')
-rw-r--r-- | libs/sys/luasrc/sys.lua | 15 |
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 |