summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDaniel Dickinson <cshoredaniel@users.noreply.github.com>2017-02-07 16:00:09 -0500
committerGitHub <noreply@github.com>2017-02-07 16:00:09 -0500
commitfecf6e1d11d466efa7b1bbf05633931a3081517e (patch)
tree9a402dce9424adbec953a398ab92f68b45cc1cfe
parent5180a5bb8bcab18e06d25dbe94ba3f5e37e66248 (diff)
parent4fd2b74e4a3463e4538b3bd2ec04e296f24b3825 (diff)
Merge pull request #965 from cshore-firmware/pull-request-odhcpd-mac
base: status: For odhpcd leases display MAC formatted with colons
-rw-r--r--modules/luci-base/luasrc/tools/status.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/luci-base/luasrc/tools/status.lua b/modules/luci-base/luasrc/tools/status.lua
index b531393d0..95ff46df1 100644
--- a/modules/luci-base/luasrc/tools/status.lua
+++ b/modules/luci-base/luasrc/tools/status.lua
@@ -74,9 +74,19 @@ local function dhcp_leases_common(family)
hostname = (name ~= "-") and name
}
elseif ip and iaid == "ipv4" and family == 4 then
+ local mac, mac1, mac2, mac3, mac4, mac5, mac6
+ if duid and type(duid) == "string" then
+ mac1, mac2, mac3, mac4, mac5, mac6 = duid:match("^(%x%x)(%x%x)(%x%x)(%x%x)(%x%x)(%x%x)$")
+ end
+ if not (mac1 and mac2 and mac3 and mac4 and mac5 and mac6) then
+ mac = "FF:FF:FF:FF:FF:FF"
+ else
+ mac = mac1..":"..mac2..":"..mac3..":"..mac4..":"..mac5..":"..mac6
+ end
rv[#rv+1] = {
expires = (expire >= 0) and os.difftime(expire, os.time()),
macaddr = duid,
+ macaddr = mac:lower(),
ipaddr = ip,
hostname = (name ~= "-") and name
}