From a1ee8e16b66ac9f0c6bf8b7b5f421f79cf1e1587 Mon Sep 17 00:00:00 2001 From: Mathias Kresin Date: Thu, 16 Nov 2017 07:16:59 +0100 Subject: luci-mod-admin-full: don't replace DHCPv6 hostname Don't replace the DHCPv6 supplied hostname if the DUID can be mapped to the MAC-Address of an already known host. It hides the issue of a missing DHCPv6 hostname and could lead to the conclution that the already known host has an IPv6 address. Signed-off-by: Mathias Kresin --- modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm | 2 +- modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'modules/luci-mod-admin-full/luasrc') diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm index b4baedff2..7e2cc090e 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm @@ -78,7 +78,7 @@ tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1); var host = hosts[duid2mac(st[1][i].duid)]; - if (host) + if (!st[1][i].hostname && host) tr.insertCell(-1).innerHTML = String.format( '
%s
', ((host.name && (host.ipv4 || host.ipv6)) diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm index d29a89427..a46ee835c 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm @@ -417,7 +417,7 @@ tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1); var host = hosts[duid2mac(info.leases6[i].duid)]; - if (host) + if (!info.leases6[i].hostname && host) tr.insertCell(-1).innerHTML = String.format( '
%s
', ((host.name && (host.ipv4 || host.ipv6)) -- cgit v1.2.3 From 9f5a1de8b1f32c30c6f9c0ade42b418ce0aeacd4 Mon Sep 17 00:00:00 2001 From: Mathias Kresin Date: Thu, 16 Nov 2017 07:32:58 +0100 Subject: luci-mod-admin-full: always indicate missing DHCPv6 hostname Don't show a DHCPv6 supplied hostname if none was send. It happens in case the DUID can be mapped to the MAC-Address of an existing host and the existing host has a name set. Signed-off-by: Mathias Kresin --- .../luasrc/view/admin_network/lease_status.htm | 14 ++++++-------- .../luci-mod-admin-full/luasrc/view/admin_status/index.htm | 14 ++++++-------- 2 files changed, 12 insertions(+), 16 deletions(-) (limited to 'modules/luci-mod-admin-full/luasrc') diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm index 7e2cc090e..1f50db5b9 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm @@ -78,15 +78,13 @@ tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1); var host = hosts[duid2mac(st[1][i].duid)]; - if (!st[1][i].hostname && host) - tr.insertCell(-1).innerHTML = String.format( - '
%s
', - ((host.name && (host.ipv4 || host.ipv6)) - ? '%h (%s)'.format(host.name, host.ipv4 || host.ipv6) - : '%h'.format(host.name || host.ipv4 || host.ipv6)).nobr() - ); + if (!st[1][i].hostname) + tr.insertCell(-1).innerHTML = + (host && (host.name || host.ipv4 || host.ipv6)) + ? '
? (%h)
'.format(host.name || host.ipv4 || host.ipv6) + : '?'; else - tr.insertCell(-1).innerHTML = st[1][i].hostname ? st[1][i].hostname : '?'; + tr.insertCell(-1).innerHTML = st[1][i].hostname; tr.insertCell(-1).innerHTML = st[1][i].ip6addr; tr.insertCell(-1).innerHTML = st[1][i].duid; diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm index a46ee835c..626532e1b 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm @@ -417,15 +417,13 @@ tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1); var host = hosts[duid2mac(info.leases6[i].duid)]; - if (!info.leases6[i].hostname && host) - tr.insertCell(-1).innerHTML = String.format( - '
%s
', - ((host.name && (host.ipv4 || host.ipv6)) - ? '%h (%s)'.format(host.name, host.ipv4 || host.ipv6) - : '%h'.format(host.name || host.ipv4 || host.ipv6)).nobr() - ); + if (!info.leases6[i].hostname) + tr.insertCell(-1).innerHTML = + (host && (host.name || host.ipv4 || host.ipv6)) + ? '
? (%h)
'.format(host.name || host.ipv4 || host.ipv6) + : '?'; else - tr.insertCell(-1).innerHTML = info.leases6[i].hostname ? info.leases6[i].hostname : '?'; + tr.insertCell(-1).innerHTML = info.leases6[i].hostname; tr.insertCell(-1).innerHTML = info.leases6[i].ip6addr; tr.insertCell(-1).innerHTML = info.leases6[i].duid; -- cgit v1.2.3 From 0a2c7b9e5c1745e28451825c838fc38752bebf60 Mon Sep 17 00:00:00 2001 From: Mathias Kresin Date: Thu, 16 Nov 2017 08:22:14 +0100 Subject: luci-mod-admin-full: indicate DHCPv6 hostname mismatch In case the DUID can be mapped to the MAC-Address of an already known host, show the already know hostname next to the DHCPv6 supplied one in case they differ. Signed-off-by: Mathias Kresin --- .../luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm | 5 ++++- modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'modules/luci-mod-admin-full/luasrc') diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm index 1f50db5b9..ea6ee91c7 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm @@ -84,7 +84,10 @@ ? '
? (%h)
'.format(host.name || host.ipv4 || host.ipv6) : '?'; else - tr.insertCell(-1).innerHTML = st[1][i].hostname; + tr.insertCell(-1).innerHTML = + (host && host.name && st[1][i].hostname != host.name) + ? '
%h (%h)
'.format(st[1][i].hostname, host.name) + : st[1][i].hostname; tr.insertCell(-1).innerHTML = st[1][i].ip6addr; tr.insertCell(-1).innerHTML = st[1][i].duid; diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm index 626532e1b..9f44ac76d 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm @@ -423,7 +423,10 @@ ? '
? (%h)
'.format(host.name || host.ipv4 || host.ipv6) : '?'; else - tr.insertCell(-1).innerHTML = info.leases6[i].hostname; + tr.insertCell(-1).innerHTML = + (host && host.name && info.leases6[i].hostname != host.name) + ? '
%h (%h)
'.format(info.leases6[i].hostname, host.name) + : info.leases6[i].hostname; tr.insertCell(-1).innerHTML = info.leases6[i].ip6addr; tr.insertCell(-1).innerHTML = info.leases6[i].duid; -- cgit v1.2.3