From d24b2e7e4abc904f61a16a4e19e057e68d6eed45 Mon Sep 17 00:00:00 2001 From: vnxme <46669194+vnxme@users.noreply.github.com> Date: Sat, 29 May 2021 10:36:11 +0300 Subject: [PATCH] DHCPv6 leases status: Display manufacturer info (#4527) o Display info about manufacturers of devices based on their MAC addresses. o Get MAC addresses not only from NDP, but also from DUID of certain types. --- src/www/status_dhcpv6_leases.php | 34 ++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/src/www/status_dhcpv6_leases.php b/src/www/status_dhcpv6_leases.php index 41335208b..f5b848c6a 100644 --- a/src/www/status_dhcpv6_leases.php +++ b/src/www/status_dhcpv6_leases.php @@ -447,8 +447,8 @@ endif;?> - - + + @@ -459,6 +459,7 @@ endif;?> $data['if'] = convert_real_interface_to_friendly_interface_name(guess_interface_from_ip($data['ip'])); } $data['int'] = htmlspecialchars($interfaces[$data['if']]['descr']); + + $mac_from_ndp = !empty($ndpdata[$data['ip']]) ? $ndpdata[$data['ip']]['mac'] : ""; + $vendor_from_ndp = empty($mac_from_ndp) ? "" : ($mac_man[strtoupper(implode("", explode(":", substr($mac_from_ndp, 0, 8))))] ?? ""); + + $mac_from_duid = ""; + $duid_formatted = $data['duid']; + $duid_type = substr($data['duid'], 0, 5); + if ($duid_type === "00:01" || $duid_type === "00:03"){ + $duid_subtype = substr($data['duid'], 6, 5); + if ($duid_subtype === "00:01") { + $mac_from_duid = substr($data['duid'], -17, 17); + $duid_formatted = substr($data['duid'], 0, strlen($data['duid']) - 17) . '' . $mac_from_duid . ''; + } + } + $vendor_from_duid = empty($mac_from_duid) ? "" : ($mac_man[strtoupper(implode("", explode(":", substr($mac_from_duid, 0, 8))))] ?? ""); + + $duid_content = $duid_formatted; + if (!empty($vendor_from_duid)) { + $duid_content .= '
'.$vendor_from_duid.''; + } + if (!empty($mac_from_ndp) && $mac_from_duid !== $mac_from_ndp) { + $duid_content .= '
'.gettext('NDP MAC').': '.$mac_from_ndp; + if (!empty($vendor_from_ndp)) { + $duid_content .= '
'.$vendor_from_ndp.''; + } + } ?> - + -