diff options
author | Daniel Dickinson <lede@cshore.thecshore.com> | 2016-12-09 11:58:21 -0500 |
---|---|---|
committer | Daniel Dickinson <lede@cshore.thecshore.com> | 2017-01-20 02:09:34 -0500 |
commit | 4fd2b74e4a3463e4538b3bd2ec04e296f24b3825 (patch) | |
tree | 7e9953297089fc8a677da5ae26fd2a2bd0a0007e /modules/luci-base/luasrc/tools/status.lua | |
parent | 9b7a5a477a707164d07d17a65acd5a1ac78845db (diff) |
base: status: For odhpcd leases display MAC formatted with colons
This should result in the MAC address display being the same
using odhcpd for v4 DHCP as when using DNSMasq for v4 DHCP.
Signed-off-by: Daniel Dickinson <lede@cshore.thecshore.com>
Diffstat (limited to 'modules/luci-base/luasrc/tools/status.lua')
-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 4da0cf984b..b0df9d365a 100644 --- a/modules/luci-base/luasrc/tools/status.lua +++ b/modules/luci-base/luasrc/tools/status.lua @@ -73,9 +73,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 } |