diff options
author | Daniel Dickinson <cshoredaniel@users.noreply.github.com> | 2017-02-07 16:00:09 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-07 16:00:09 -0500 |
commit | fecf6e1d11d466efa7b1bbf05633931a3081517e (patch) | |
tree | 9a402dce9424adbec953a398ab92f68b45cc1cfe /modules/luci-base/luasrc | |
parent | 5180a5bb8bcab18e06d25dbe94ba3f5e37e66248 (diff) | |
parent | 4fd2b74e4a3463e4538b3bd2ec04e296f24b3825 (diff) |
Merge pull request #965 from cshore-firmware/pull-request-odhcpd-mac
base: status: For odhpcd leases display MAC formatted with colons
Diffstat (limited to 'modules/luci-base/luasrc')
-rw-r--r-- | modules/luci-base/luasrc/tools/status.lua | 10 |
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 b531393d0f..95ff46df15 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 } |