Rev 4 | Rev 16 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4 | Rev 15 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | <?php |
1 | <?php |
2 | 2 | ||
3 | /* |
3 | /* |
4 | * MAC utils for PHP |
4 | * MAC utils for PHP |
5 | * Copyright 2017 Daniel Marschall, ViaThinkSoft |
5 | * Copyright 2017 - 2023 Daniel Marschall, ViaThinkSoft |
6 | * Version 19 August 2017 |
6 | * Version 2023-04-29 |
7 | * |
7 | * |
8 | * Licensed under the Apache License, Version 2.0 (the "License"); |
8 | * Licensed under the Apache License, Version 2.0 (the "License"); |
9 | * you may not use this file except in compliance with the License. |
9 | * you may not use this file except in compliance with the License. |
10 | * You may obtain a copy of the License at |
10 | * You may obtain a copy of the License at |
11 | * |
11 | * |
Line 16... | Line 16... | ||
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
17 | * See the License for the specific language governing permissions and |
17 | * See the License for the specific language governing permissions and |
18 | * limitations under the License. |
18 | * limitations under the License. |
19 | */ |
19 | */ |
20 | 20 | ||
21 | define('IEEE_MAC_REGISTRY', __DIR__ . '/../web-data'); |
21 | const IEEE_MAC_REGISTRY = __DIR__ . '/../web-data'; |
22 | 22 | ||
- | 23 | /** |
|
- | 24 | * @param string $mac |
|
- | 25 | * @return bool |
|
- | 26 | */ |
|
23 | function mac_valid($mac) { |
27 | function mac_valid(string $mac): bool { |
24 | $mac = str_replace(array('-', ':'), '', $mac); |
28 | $mac = str_replace(array('-', ':'), '', $mac); |
25 | $mac = strtoupper($mac); |
29 | $mac = strtoupper($mac); |
26 | 30 | ||
27 | if (strlen($mac) != 12) return false; |
31 | if (strlen($mac) != 12) return false; |
28 | 32 | ||
29 | $mac = preg_replace('@[0-9A-F]@', '', $mac); |
33 | $mac = preg_replace('@[0-9A-F]@', '', $mac); |
30 | 34 | ||
31 | return ($mac == ''); |
35 | return ($mac == ''); |
32 | } |
36 | } |
33 | 37 | ||
- | 38 | /** |
|
- | 39 | * @param string $file |
|
- | 40 | * @param string $oui_name |
|
- | 41 | * @param string $mac |
|
- | 42 | * @return false|string |
|
- | 43 | */ |
|
34 | function _lookup_ieee_registry($file, $oui_name, $mac) { |
44 | function _lookup_ieee_registry(string $file, string $oui_name, string $mac) { |
35 | $begin = substr($mac, 0, 2).'-'.substr($mac, 2, 2).'-'.substr($mac, 4, 2); |
45 | $begin = substr($mac, 0, 2).'-'.substr($mac, 2, 2).'-'.substr($mac, 4, 2); |
36 | $f = file_get_contents($file); |
46 | $f = file_get_contents($file); |
37 | 47 | ||
38 | $f = str_replace("\r", '', $f); |
48 | $f = str_replace("\r", '', $f); |
39 | 49 | ||
40 | # We are using a positive-lookahead because entries like the MA-M references have a blank line between organization and address |
50 | # We are using a positive-lookahead because entries like the MA-M references have a blank line between organization and address |
41 | preg_match_all('@^\s*'.preg_quote($begin, '@').'\s+\(hex\)\s+(\S+)\s+(.*)\n\n\s*(?=[0-9A-F])@ismU', "$f\n\nA", $m, PREG_SET_ORDER); |
51 | preg_match_all('@^\s*'.preg_quote($begin, '@').'\s+\(hex\)\s+(\S+)\s+(.*)\n\n\s*(?=[0-9A-F])@ismU', "$f\n\nA", $m, PREG_SET_ORDER); |
42 | foreach ($m as $n) { |
52 | foreach ($m as $n) { |
43 | preg_match('@(\S+)\s+\(base 16\)(.*)$@ism', $n[2], $m); |
53 | preg_match('@(\S+)\s+\(base 16\)(.*)$@ism', $n[2], $m); |
44 | 54 | ||
45 | if (preg_match('@(.+)\-(.+)@ism', $m[1], $o)) { |
55 | if (preg_match('@(.+)-(.+)@ism', $m[1], $o)) { |
46 | $z = hexdec(substr($mac, 6, 6)); |
56 | $z = hexdec(substr($mac, 6, 6)); |
47 | $beg = hexdec($o[1]); |
57 | $beg = hexdec($o[1]); |
48 | $end = hexdec($o[2]); |
58 | $end = hexdec($o[2]); |
49 | if (($z < $beg) || ($z > $end)) continue; |
59 | if (($z < $beg) || ($z > $end)) continue; |
50 | } else { |
60 | } else { |
51 | $beg = 0x000000; |
61 | $beg = 0x000000; |
52 | $end = 0xFFFFFF; |
62 | $end = 0xFFFFFF; |
53 | } |
63 | } |
54 | 64 | ||
55 | $x = trim(preg_replace('@^\s+@ism', '', $m[2])); |
65 | $x = trim(preg_replace('@^\s+@im', '', $m[2])); |
56 | 66 | ||
57 | # "PRIVATE" entries are only marked at the "(hex)" line, but not at the "(base16)" line |
67 | # "PRIVATE" entries are only marked at the "(hex)" line, but not at the "(base16)" line |
58 | if ($x == '') $x = trim($n[1]); |
68 | if ($x == '') $x = trim($n[1]); |
59 | 69 | ||
60 | $x = explode("\n", $x); |
70 | $x = explode("\n", $x); |
61 | 71 | ||
62 | $ra_len = strlen(dechex($end-$beg)); |
72 | $ra_len = strlen(dechex($end-$beg)); |
63 | 73 | ||
64 | $out = ''; |
- | |
65 | $out .= sprintf("%-24s 0x%s\n", "IEEE $oui_name part:", substr($mac, 0, 12-$ra_len)); |
74 | $out = sprintf("%-32s 0x%s\n", "IEEE $oui_name part:", substr($mac, 0, 12-$ra_len)); |
66 | $out .= sprintf("%-24s 0x%s\n", "NIC specific part:", substr($mac, 12-$ra_len)); |
75 | $out .= sprintf("%-32s 0x%s\n", "NIC specific part:", substr($mac, 12-$ra_len)); |
67 | $out .= sprintf("%-24s %s\n", "Registrant:", $x[0]); |
76 | $out .= sprintf("%-32s %s\n", "Registrant:", $x[0]); |
68 | foreach ($x as $n => $y) { |
77 | foreach ($x as $n => $y) { |
69 | if ($n == 0) continue; |
78 | if ($n == 0) continue; |
70 | else if ($n == 1) $out .= sprintf("%-24s %s\n", "Address of registrant:", $y); |
79 | else if ($n == 1) $out .= sprintf("%-32s %s\n", "Address of registrant:", $y); |
71 | else if ($n >= 2) $out .= sprintf("%-24s %s\n", "", $y); |
80 | else if ($n >= 2) $out .= sprintf("%-32s %s\n", "", $y); |
72 | } |
81 | } |
73 | 82 | ||
74 | // TODO: also print the date of last update of the OUI files |
83 | // TODO: also print the date of last update of the OUI files |
75 | 84 | ||
76 | return $out; |
85 | return $out; |
77 | } |
86 | } |
78 | 87 | ||
79 | return false; |
88 | return false; |
80 | } |
89 | } |
81 | 90 | ||
- | 91 | /** |
|
- | 92 | * @param string $mac |
|
- | 93 | * @return void |
|
- | 94 | * @throws Exception |
|
- | 95 | */ |
|
82 | function decode_mac($mac) { |
96 | function decode_mac(string $mac) { |
- | 97 | // Amazing website about MAC addresses: https://mac-address.alldatafeeds.com/faq#how-to-recognise-mac-address-application |
|
- | 98 | ||
83 | if (!mac_valid($mac)) return false; |
99 | if (!mac_valid($mac)) throw new Exception("Invalid MAC address"); |
84 | 100 | ||
85 | // Format MAC |
101 | // Format MAC |
86 | $mac = strtoupper($mac); |
102 | $mac = strtoupper($mac); |
87 | $mac = preg_replace('@[^0-9A-F]@', '', $mac); |
103 | $mac = preg_replace('@[^0-9A-F]@', '', $mac); |
88 | if (strlen($mac) != 12) { |
104 | if (strlen($mac) != 12) { |
89 | # echo "Invalid MAC address\n"; |
105 | throw new Exception("Invalid MAC address"); |
90 | return false; |
- | |
91 | } |
106 | } |
92 | $mac_ = preg_replace('@^(..)(..)(..)(..)(..)(..)$@', '\\1-\\2-\\3-\\4-\\5-\\6', $mac); |
107 | $mac_ = preg_replace('@^(..)(..)(..)(..)(..)(..)$@', '\\1-\\2-\\3-\\4-\\5-\\6', $mac); |
93 | echo sprintf("%-24s %s\n", "MAC address:", $mac_); |
108 | echo sprintf("%-32s %s\n", "MAC address:", $mac_); |
94 | 109 | ||
95 | // Empfaengergruppe |
110 | // Empfaengergruppe |
96 | $ig = hexdec($mac[1]) & 1; // Bit #LSB+0 of Byte 1 |
111 | $ig = hexdec($mac[1]) & 1; // Bit #LSB+0 of Byte 1 |
97 | $ig_ = ($ig == 0) ? '[0] Individual' : '[1] Group'; |
112 | $ig_ = ($ig == 0) ? '[0] Individual (Unicast)' : '[1] Group (Multicast)'; |
98 | echo sprintf("%-24s %s\n", "I/G flag:", $ig_); |
113 | echo sprintf("%-32s %s\n", "Transmission type (I/G flag):", $ig_); |
99 | 114 | ||
100 | // Vergabestelle |
115 | // Vergabestelle |
101 | $ul = hexdec($mac[1]) & 2; // Bit #LSB+1 of Byte 1 |
116 | $ul = hexdec($mac[1]) & 2; // Bit #LSB+1 of Byte 1 |
102 | $ul_ = ($ul == 0) ? '[0] Universally Administered Address (UAA)' : '[1] Locally Administered Address (LAA)'; |
117 | $ul_ = ($ul == 0) ? '[0] Universally Administered Address (UAA)' : '[1] Locally Administered Address (LAA)'; |
103 | echo sprintf("%-24s %s\n", "U/L flag:", $ul_); |
118 | echo sprintf("%-32s %s\n", "Administration type (U/L flag):", $ul_); |
104 | 119 | ||
105 | // Query IEEE registries |
120 | // Query IEEE registries |
106 | // TODO: gilt OUI nur bei Individual UAA? |
121 | // TODO: gilt OUI nur bei Individual UAA? |
- | 122 | if (count(glob(IEEE_MAC_REGISTRY.'/*.txt')) > 0) { |
|
107 | if ( |
123 | if ( |
108 | ($x = _lookup_ieee_registry(IEEE_MAC_REGISTRY.'/mam.txt', 'OUI-28 (MA-M)', $mac)) || |
124 | ($x = _lookup_ieee_registry(IEEE_MAC_REGISTRY . '/mam.txt', 'OUI-28 (MA-M)', $mac)) || |
109 | ($x = _lookup_ieee_registry(IEEE_MAC_REGISTRY.'/oui36.txt', 'OUI-36 (MA-S)', $mac)) || |
125 | ($x = _lookup_ieee_registry(IEEE_MAC_REGISTRY . '/oui36.txt', 'OUI-36 (MA-S)', $mac)) || |
110 | # The IEEE Registration Authority distinguishes between IABs and OUI-36 values. Both are 36-bit values which may be used to generate EUI-48 values, but IABs may not be used to generate EUI-64 values.[6] |
126 | # The IEEE Registration Authority distinguishes between IABs and OUI-36 values. Both are 36-bit values which may be used to generate EUI-48 values, but IABs may not be used to generate EUI-64 values.[6] |
111 | # Note: The Individual Address Block (IAB) is an inactive registry activity, which has been replaced by the MA-S registry product as of January 1, 2014. |
127 | # Note: The Individual Address Block (IAB) is an inactive registry activity, which has been replaced by the MA-S registry product as of January 1, 2014. |
112 | ($x = _lookup_ieee_registry(IEEE_MAC_REGISTRY.'/iab.txt', 'IAB', $mac)) |
128 | ($x = _lookup_ieee_registry(IEEE_MAC_REGISTRY . '/iab.txt', 'IAB', $mac)) |
113 | ) { |
129 | ) { |
114 | return $x; |
130 | echo $x; |
115 | } else { |
131 | } else { |
116 | return _lookup_ieee_registry(IEEE_MAC_REGISTRY.'/oui.txt', 'OUI-24 (MA-L)', $mac); |
132 | echo _lookup_ieee_registry(IEEE_MAC_REGISTRY . '/oui.txt', 'OUI-24 (MA-L)', $mac); |
117 | } |
133 | } |
- | 134 | } |
|
- | 135 | ||
- | 136 | $vm = ''; |
|
- | 137 | // === FAQ "Detection rules which don't have their dedicated page yet" === |
|
- | 138 | // https://wiki.xenproject.org/wiki/Xen_Networking |
|
- | 139 | // https://mcpmag.com/articles/2007/11/27/hey-vm-whats-your-hypervisor.aspx |
|
- | 140 | // https://www.techrepublic.com/blog/data-center/mac-address-scorecard-for-common-virtual-machine-platforms |
|
- | 141 | if (mac_between($mac, '00:16:3E:00:00:00', '00:16:3E:FF:FF:FF')) $vm = "Red Hat Xen, XenSource, Novell Xen"; |
|
- | 142 | // http://techgenix.com/mac-address-pool-duplication-hyper-v/ |
|
- | 143 | // https://docs.microsoft.com/en-us/system-center/vmm/network-mac?view=sc-vmm-1807 |
|
- | 144 | // https://blogs.technet.microsoft.com/gbanin/2014/08/27/how-to-solve-mac-address-conflict-on-hyper-v/ |
|
- | 145 | if (mac_between($mac, '00:1D:D8:B7:1C:00', '00:1D:D8:F4:1F:FF')) $vm = "Microsoft SCVMM (System Center Virtual Machine Manager)"; |
|
- | 146 | // https://mcpmag.com/articles/2007/11/27/hey-vm-whats-your-hypervisor.aspx |
|
- | 147 | // https://www.techrepublic.com/blog/data-center/mac-address-scorecard-for-common-virtual-machine-platforms/ |
|
- | 148 | // https://blogs.technet.microsoft.com/medv/2011/01/24/how-to-manage-vm-mac-addresses-with-the-globalimagedata-xml-file-in-med-v-v1/ |
|
- | 149 | if (mac_between($mac, '00:03:FF:00:00:00', '00:03:FF:FF:FF:FF')) $vm = "Microsoft Virtual PC / Virtual Server"; |
|
- | 150 | // https://mcpmag.com/articles/2007/11/27/hey-vm-whats-your-hypervisor.aspx |
|
- | 151 | if (mac_between($mac, '00:18:51:00:00:00', '00:18:51:FF:FF:FF')) $vm = "SWsoft"; |
|
- | 152 | // https://macaddress.io/statistics/company/17619 |
|
- | 153 | if (mac_between($mac, '58:9C:FC:00:00:00', '58:9C:FC:FF:FF:FF')) $vm = "bhyve by FreebsdF"; |
|
- | 154 | // https://macaddress.io/statistics/company/17388 |
|
- | 155 | if (mac_between($mac, '50:6B:8D:00:00:00', '50:6B:8D:FF:FF:FF')) $vm = "Nutanix AHV"; |
|
- | 156 | // https://www.centos.org/forums/viewtopic.php?t=26739 |
|
- | 157 | if (mac_between($mac, '54:52:00:00:00:00', '54:52:FF:FF:FF:FF')) $vm = "KVM (proxmox)"; |
|
- | 158 | // Self tested (alldatafeeds.com) |
|
- | 159 | if (mac_between($mac, '96:00:00:00:00:00', '96:00:FF:FF:FF:FF')) $vm = "Hetzner vServer (based on KVM and libvirt)"; |
|
- | 160 | // === FAQ "How to recognise a VMware's virtual machine by its MAC address?" === |
|
- | 161 | if (mac_between($mac, '00:50:56:00:00:00', '00:50:56:FF:FF:FF')) $vm = "VMware vSphere, VMware Workstation, VMware ESX Server"; |
|
- | 162 | if (mac_between($mac, '00:50:56:80:00:00', '00:50:56:BF:FF:FF')) $vm = "VMware vSphere managed by vCenter Server"; |
|
- | 163 | if (mac_between($mac, '00:0C:29:00:00:00', '00:0C:29:FF:FF:FF')) $vm = "VMWare Standalone VMware vSphere, VMware Workstation, VMware Horizon"; |
|
- | 164 | if (mac_between($mac, '00:05:69:00:00:00', '00:05:69:FF:FF:FF')) $vm = "VMware ESX, VMware GSX Server"; |
|
- | 165 | if (mac_between($mac, '00:1C:14:00:00:00', '00:1C:14:FF:FF:FF')) $vm = "VMWare"; |
|
- | 166 | // === FAQ "machine by its MAC address?" === |
|
- | 167 | if (mac_between($mac, '00:1C:42:00:00:00', '00:1C:42:FF:FF:FF')) $vm = "Parallels Virtual Machine"; |
|
- | 168 | // === FAQ "How to recognise a Docker container by its MAC address?" === |
|
- | 169 | if (mac_between($mac, '02:42:00:00:00:00', '02:42:FF:FF:FF:FF')) $vm = "Docker container"; |
|
- | 170 | // === FAQ =How to recognise a Microsoft Hyper-V's virtual machine by its MAC address?" === |
|
- | 171 | if (mac_between($mac, '00:15:5D:00:00:00', '00:15:5D:FF:FF:FF')) $vm = "Microsoft Hyper-V"; |
|
- | 172 | // === FAQ "How to recognise an Oracle Virtual machine by its MAC address?" === |
|
- | 173 | if (mac_between($mac, '08:00:27:00:00:00', '08:00:27:FF:FF:FF')) $vm = "Oracle VirtualBox 5.2"; // Pcs Systemtechnik GmbH |
|
- | 174 | if (mac_between($mac, '52:54:00:00:00:00', '52:54:00:FF:FF:FF')) $vm = "Oracle VirtualBox 5.2 + Vagrant"; // 52:54:00 (Exact MAC: 52:54:00:C9:C7:04) |
|
- | 175 | if (mac_between($mac, '00:21:F6:00:00:00', '00:21:F6:FF:FF:FF')) $vm = "Oracle VirtualBox 3.3"; |
|
- | 176 | if (mac_between($mac, '00:14:4F:00:00:00', '00:14:4F:FF:FF:FF')) $vm = "Oracle VM Server for SPARC"; |
|
- | 177 | if (mac_between($mac, '00:0F:4B:00:00:00', '00:0F:4B:FF:FF:FF')) $vm = "Oracle Virtual Iron 4"; |
|
- | 178 | ||
- | 179 | if ($vm) { |
|
- | 180 | echo sprintf("%-32s %s\n", "Special use:", "Virtual machine $vm"); |
|
- | 181 | } |
|
- | 182 | ||
- | 183 | $app = ''; |
|
118 | 184 | ||
- | 185 | // === FAQ "Other MAC address applications" |
|
- | 186 | // http://www.cavebear.com/archive/cavebear/Ethernet/Ethernet.txt |
|
- | 187 | // https://tools.ietf.org/html/rfc1060 |
|
- | 188 | if (mac_between($mac, '03:00:00:01:00:00', '03:00:40:00:00:00')) $app = 'User-defined (per 802 spec), EtherType is 0x0802'; |
|
- | 189 | if (mac_equals($mac, '01:00:1D:00:00:00')) $app = 'Cabletron PC-OV PC discover (on demand), EtherType is 0x0802'; |
|
- | 190 | if (mac_equals($mac, '01:00:1D:42:00:00')) $app = 'Cabletron PC-OV Bridge discover (on demand), EtherType is 0x0802'; |
|
- | 191 | if (mac_equals($mac, '01:00:1D:52:00:00')) $app = 'Cabletron PC-OV MMAC discover (on demand), EtherType is 0x0802'; |
|
- | 192 | if (mac_between($mac, '01:00:3C:00:00:00' , '01:00:3C:FF:FF:FF')) $app = 'Auspex Systems (Serverguard)'; |
|
- | 193 | if (mac_equals($mac, '01:00:10:00:00:20')) $app = 'Hughes Lan Systems Terminal Server S/W download, EtherType is 0x0802'; |
|
- | 194 | if (mac_equals($mac, '01:00:10:FF:FF:20')) $app = 'Hughes Lan Systems Terminal Server S/W request, EtherType is 0x0802'; |
|
- | 195 | if (mac_equals($mac, '01:00:81:00:00:00')) $app = 'Synoptics Network Management'; |
|
- | 196 | if (mac_equals($mac, '01:00:81:00:00:02')) $app = 'Synoptics Network Management'; |
|
- | 197 | if (mac_equals($mac, '01:00:81:00:01:00')) $app = 'Bay Networks (Synoptics) autodiscovery, EtherType is 0x0802 SNAP type is 0x01A2'; |
|
- | 198 | if (mac_equals($mac, '01:00:81:00:01:01')) $app = 'Bay Networks (Synoptics) autodiscovery, EtherType is 0x0802 SNAP type is 0x01A1'; |
|
- | 199 | if (mac_between($mac, '01:20:25:00:00:00', '01:20:25:7F:FF:FF')) $app = 'Control Technology Inc\'s Industrial Ctrl Proto., EtherType is 0x873A'; |
|
- | 200 | if (mac_equals($mac, '01:80:24:00:00:00')) $app = 'Kalpana Etherswitch every 60 seconds, EtherType is 0x0802'; |
|
- | 201 | if (mac_equals($mac, '01:DD:00:FF:FF:FF')) $app = 'Ungermann-Bass boot-me requests, EtherType is 0x7002'; |
|
- | 202 | if (mac_equals($mac, '01:DD:01:00:00:00')) $app = 'Ungermann-Bass Spanning Tree, EtherType is 0x7005'; |
|
- | 203 | if (mac_equals($mac, '03:00:00:00:00:10')) $app = 'OS/2 1.3 EE + Communications Manager, EtherType is 0x80D5'; |
|
- | 204 | if (mac_equals($mac, '03:00:00:00:00:40')) $app = 'OS/2 1.3 EE + Communications Manager, EtherType is 0x80D5'; |
|
- | 205 | if (mac_equals($mac, '03:00:00:00:01:00')) $app = 'OSI All-IS Multicast, EtherType is 0x0802'; |
|
- | 206 | if (mac_equals($mac, '03:00:00:00:02:00')) $app = 'OSI All-ES Multicast, EtherType is 0x0802'; |
|
- | 207 | if (mac_equals($mac, '03:00:00:80:00:00')) $app = 'Discovery Client, EtherType is 0x0802'; |
|
- | 208 | if (mac_equals($mac, '03:00:FF:FF:FF:FF')) $app = 'All Stations address, EtherType is 0x0802'; |
|
- | 209 | if (mac_between($mac, '09:00:0D:00:00:00', '09:00:0D:FF:FF:FF')) $app = 'ICL Oslan Multicast, EtherType is 0x0802'; |
|
- | 210 | if (mac_equals($mac, '09:00:0D:02:00:00')) $app = 'ICL Oslan Service discover only on boot'; |
|
- | 211 | if (mac_equals($mac, '09:00:0D:02:0A:3C')) $app = 'ICL Oslan Service discover only on boot'; |
|
- | 212 | if (mac_equals($mac, '09:00:0D:02:0A:38')) $app = 'ICL Oslan Service discover only on boot'; |
|
- | 213 | if (mac_equals($mac, '09:00:0D:02:0A:39')) $app = 'ICL Oslan Service discover only on boot'; |
|
- | 214 | if (mac_equals($mac, '09:00:0D:02:FF:FF')) $app = 'ICL Oslan Service discover only on boot'; |
|
- | 215 | if (mac_equals($mac, '09:00:0D:09:00:00')) $app = 'ICL Oslan Service discover as required'; |
|
- | 216 | if (mac_equals($mac, '09:00:1E:00:00:00')) $app = 'Apollo DOMAIN, EtherType is 0x8019'; |
|
- | 217 | if (mac_equals($mac, '09:00:02:04:00:01')) $app = 'Vitalink printer messages, EtherType is 0x8080'; |
|
- | 218 | if (mac_equals($mac, '09:00:02:04:00:02')) $app = 'Vitalink bridge management, EtherType is 0x8080'; |
|
- | 219 | if (mac_equals($mac, '09:00:4C:00:00:0F')) $app = 'BICC Remote bridge adaptive routing (e.g. to Retix), EtherType is 0x0802'; |
|
- | 220 | if (mac_equals($mac, '09:00:4E:00:00:02')) $app = 'Novell IPX, EtherType is 0x8137'; |
|
- | 221 | if (mac_equals($mac, '09:00:6A:00:01:00')) $app = 'TOP NetBIOS'; |
|
- | 222 | if (mac_equals($mac, '09:00:7C:01:00:01')) $app = 'Vitalink DLS Multicast'; |
|
- | 223 | if (mac_equals($mac, '09:00:7C:01:00:03')) $app = 'Vitalink DLS Inlink'; |
|
- | 224 | if (mac_equals($mac, '09:00:7C:01:00:04')) $app = 'Vitalink DLS and non DLS Multicast'; |
|
- | 225 | if (mac_equals($mac, '09:00:7C:02:00:05')) $app = 'Vitalink diagnostics, EtherType is 0x8080'; |
|
- | 226 | if (mac_equals($mac, '09:00:7C:05:00:01')) $app = 'Vitalink gateway, EtherType is 0x8080'; |
|
- | 227 | if (mac_equals($mac, '09:00:7C:05:00:02')) $app = 'Vitalink Network Validation Message'; |
|
- | 228 | if (mac_equals($mac, '09:00:09:00:00:01')) $app = 'HP Probe, EtherType is 0x8005 or 0x0802'; |
|
- | 229 | if (mac_equals($mac, '09:00:09:00:00:04')) $app = 'HP DTC, EtherType is 0x8005'; |
|
- | 230 | if (mac_equals($mac, '09:00:26:01:00:01')) $app = 'Vitalink TransLAN bridge management, EtherType is 0x8038'; |
|
- | 231 | if (mac_equals($mac, '09:00:39:00:70:00')) $app = 'Spider Systems Bridge'; |
|
- | 232 | if (mac_between($mac, '09:00:56:00:00:00', '09:00:56:FE:FF:FF')) $app = 'Stanford reserved'; |
|
- | 233 | if (mac_between($mac, '09:00:56:FF:00:00', '09:00:56:FF:FF:FF')) $app = 'Stanford V Kernel, version 6.0, EtherType is 0x805C'; |
|
- | 234 | if (mac_equals($mac, '09:00:77:00:00:00')) $app = 'Retix Bridge Local Management System, EtherType is 0x0802'; |
|
- | 235 | if (mac_equals($mac, '09:00:77:00:00:01')) $app = 'Retix spanning tree bridges, EtherType is 0x0802'; |
|
- | 236 | if (mac_equals($mac, '09:00:77:00:00:02')) $app = 'Retix Bridge Adaptive routing, EtherType is 0x0802'; |
|
- | 237 | if (mac_equals($mac, '09:00:87:80:FF:FF')) $app = 'Xyplex Terminal Servers, EtherType is 0x0889'; |
|
- | 238 | if (mac_equals($mac, '09:00:87:90:FF:FF')) $app = 'Xyplex Terminal Servers, EtherType is 0x0889'; |
|
- | 239 | if (mac_between($mac, '44:38:39:FF:00:00', '44:38:39:FF:FF:FF')) $app = 'Multi-Chassis Link Aggregation (Cumulus Linux)'; |
|
- | 240 | if (mac_equals($mac, 'FF:FF:00:40:00:01')) $app = 'LANtastic, EtherType is 0x81D6'; |
|
- | 241 | if (mac_equals($mac, 'FF:FF:00:60:00:04')) $app = 'LANtastic, EtherType is 0x81D6'; |
|
- | 242 | if (mac_equals($mac, 'FF:FF:01:E0:00:04')) $app = 'LANtastic'; |
|
- | 243 | ||
- | 244 | // === FAQ "The "CF" series MAC addresses" === |
|
- | 245 | // https://www.iana.org/assignments/ppp-numbers/ppp-numbers.xhtml |
|
- | 246 | // https://tools.ietf.org/html/rfc2153 |
|
- | 247 | // https://tools.ietf.org/html/rfc7042#section-2.3.2 |
|
- | 248 | if (mac_between($mac, 'CF:00:00:00:00:00', 'CF:00:00:FF:FF:FF')) $app = 'Reserved'; |
|
- | 249 | if (mac_equals($mac, 'CF:00:00:00:00:00')) $app = 'Used for Ethernet loopback tests'; |
|
- | 250 | ||
- | 251 | // === FAQ "How to recognise a Broadcast MAC address application?" === |
|
- | 252 | if (mac_equals($mac, 'FF:FF:FF:FF:FF:FF')) echo sprintf("%-32s %s\n", "Special use:", "Broadcast messaging"); |
|
- | 253 | ||
- | 254 | // === FAQ "How to recognise a Virtual Router ID by MAC address?" === |
|
- | 255 | // https://tools.ietf.org/html/rfc7042#section-5.1 |
|
- | 256 | // https://tools.ietf.org/html/rfc5798 |
|
- | 257 | if (mac_between($mac, '00:00:5E:00:01:00', '00:00:5E:00:01:FF')) $app = 'IPv4 Virtual Router Redundancy Protocol (VRRP)'; |
|
- | 258 | if (mac_between($mac, '00:00:5E:00:02:00', '00:00:5E:00:02:FF')) $app = 'IPv6 Virtual Router Redundancy Protocol'; |
|
- | 259 | ||
- | 260 | // === FAQ "How to recognise an IP frame by MAC address?" === |
|
- | 261 | // https://tools.ietf.org/html/rfc1060 |
|
- | 262 | // https://en.wikipedia.org/wiki/Multicast_address#cite_note-15 |
|
- | 263 | // https://tools.ietf.org/html/rfc2464 |
|
- | 264 | // https://www.iana.org/go/rfc1112 |
|
- | 265 | // http://www.cavebear.com/archive/cavebear/Ethernet/Ethernet.txt |
|
- | 266 | if (mac_between($mac, '01:00:5E:00:00:00', '01:00:5E:7F:FF:FF')) $app = 'IPv4 Multicast (EtherType is 0x0800)'; |
|
- | 267 | if (mac_between($mac, '33:33:00:00:00:00', '33:33:FF:FF:FF:FF')) $app = 'IPv6 Multicast. IPv6 neighbor discovery (EtherType is 0x86DD)'; // TODO: Dabei werden die untersten 32 Bit der IPv6-Multicast-Adresse in die MAC-Adresse eingebettet. |
|
- | 268 | if (mac_between($mac, '00:00:5E:00:52:13', '00:00:5E:00:52:13')) $app = 'Proxy Mobile IPv6'; |
|
- | 269 | //if (mac_between($mac, '00:00:5E:FE:C0:00:02:00', '00:00:5E:FE:C0:00:02:FF')) $app = 'IPv4 derived documentation'; |
|
- | 270 | //if (mac_between($mac, '00:00:5E:FE:C6:33:64:00', '00:00:5E:FE:C6:33:64:FF')) $app = 'IPv4 derived documentation'; |
|
- | 271 | //if (mac_between($mac, '00:00:5E:FE:CB:00:71:00', '00:00:5E:FE:CB:00:71:FF')) $app = 'IPv4 derived documentation'; |
|
- | 272 | //if (mac_equals($mac, '00:00:5E:FE:EA:C0:00:02')) $app = 'IPv4 multicast derived documentation'; |
|
- | 273 | //if (mac_equals($mac, '00:00:5E:FE:EA:C6:33:64')) $app = 'IPv4 multicast derived documentation'; |
|
- | 274 | //if (mac_equals($mac, '00:00:5E:FE:EA:CB:00:71')) $app = 'IPv4 multicast derived documentation'; |
|
- | 275 | //if (mac_between($mac, '01:00:5E:FE:C0:00:02:00', '01:00:5E:FE:C0:00:02:FF')) $app = 'IPv4 derived documentation'; |
|
- | 276 | //if (mac_between($mac, '01:00:5E:FE:C6:33:64:00', '01:00:5E:FE:C6:33:64:FF')) $app = 'IPv4 derived documentation'; |
|
- | 277 | //if (mac_between($mac, '01:00:5E:FE:CB:00:71:00', '01:00:5E:FE:CB:00:71:FF')) $app = 'IPv4 derived documentation'; |
|
- | 278 | //if (mac_equals($mac, '01:00:5E:FE:EA:C0:00:02')) $app = 'IPv4 multicast derived documentation'; |
|
- | 279 | //if (mac_equals($mac, '01:00:5E:FE:EA:C6:33:64')) $app = 'IPv4 multicast derived documentation'; |
|
- | 280 | //if (mac_equals($mac, '01:00:5E:FE:EA:CB:00:71')) $app = 'IPv4 multicast derived documentation'; |
|
- | 281 | if (mac_between($mac, '01:80:C2:00:00:20', '01:80:C2:00:00:2F')) $app = 'Reserved for use by Multiple Registration Protocol (MRP) applications'; |
|
- | 282 | //if (mac_between($mac, '02:00:5E:FE:00:00:00:00', '02:00:5E:FE:FF:FF:FF:FF')) $app = 'IPv4 Addr Holders'; |
|
- | 283 | if (mac_equals($mac, '03:00:00:20:00:00')) $app = 'IP multicast address'; |
|
- | 284 | if (mac_equals($mac, 'C0:00:00:04:00:00')) $app = 'IP multicast address'; |
|
- | 285 | //if (mac_between($mac, '03:00:5E:FE:00:00:00:00', '03:00:5E:FE:FF:FF:FF:FF')) $app = 'IPv4 Addr Holders'; |
|
- | 286 | ||
- | 287 | // === FAQ "How to recognise a MPLS multicast frame by MAC address?" === |
|
- | 288 | // http://www.iana.org/go/rfc5332 |
|
- | 289 | // http://www.iana.org/go/rfc7213 |
|
- | 290 | if (mac_between($mac, '01:00:5E:80:00:00', '01:00:5E:8F:FF:FF')) $app = 'MPLS multicast (EtherType is 0x8847 or 0x8848)'; |
|
- | 291 | if (mac_equals($mac, '01:00:5E:90:00:00')) $app = 'MPLS-TP p2p'; |
|
- | 292 | ||
- | 293 | // === FAQ "How to recognise a Bidirectional Forwarding Detection (BFD) on Link Aggregation Group (LAG) interfaces by MAC address?" === |
|
- | 294 | // http://www.iana.org/go/rfc7130 |
|
- | 295 | if (mac_equals($mac, '01:00:5E:90:00:01')) $app = 'Bidirectional Forwarding Detection (BFD) on Link Aggregation Group (LAG) interfaces'; |
|
- | 296 | ||
- | 297 | // === FAQ "How to recognise Token Ring specific functions by MAC address?" === |
|
- | 298 | // https://tools.ietf.org/html/rfc1060 |
|
- | 299 | // https://tools.ietf.org/html/rfc1469 |
|
- | 300 | // https://standards.ieee.org/products-services/regauth/grpmac/public.html |
|
- | 301 | // https://tools.ietf.org/html/rfc2470 |
|
- | 302 | // http://www.cavebear.com/archive/cavebear/Ethernet/Ethernet.txt |
|
- | 303 | if (mac_equals($mac, '03:00:00:00:00:01')) $app = 'NetBIOS (Token Ring)'; |
|
- | 304 | if (mac_equals($mac, '03:00:00:00:00:02')) $app = 'Locate - Directory Server (Token Ring)'; |
|
- | 305 | if (mac_equals($mac, '03:00:00:00:00:04')) $app = 'Synchronous Bandwidth Manager (Token Ring)'; |
|
- | 306 | if (mac_equals($mac, '03:00:00:00:00:08')) $app = 'Configuration Report Server (Token Ring)'; |
|
- | 307 | if (mac_equals($mac, '03:00:00:00:00:10')) $app = 'Ring Error Monitor (Token Ring)'; |
|
- | 308 | if (mac_equals($mac, '03:00:00:00:00:20')) $app = 'Network Server Heartbeat (Token Ring)'; |
|
- | 309 | if (mac_equals($mac, '03:00:00:00:00:40')) $app = 'Ring Parameter Monitor (Token Ring)'; |
|
- | 310 | if (mac_equals($mac, '03:00:00:00:00:80')) $app = 'Active Monitor (Token Ring)'; |
|
- | 311 | if (mac_equals($mac, '03:00:00:00:04:00')) $app = 'LAN Manager (Token Ring)'; |
|
- | 312 | if (mac_equals($mac, '03:00:00:00:08:00')) $app = 'Ring Wiring Concentrator (Token Ring)'; |
|
- | 313 | if (mac_equals($mac, '03:00:00:00:10:00')) $app = 'LAN Gateway (Token Ring)'; |
|
- | 314 | if (mac_equals($mac, '03:00:00:00:20:00')) $app = 'Ring Authorization Server (Token Ring)'; |
|
- | 315 | if (mac_equals($mac, '03:00:00:00:40:00')) $app = 'IMPL Server (Token Ring)'; |
|
- | 316 | if (mac_equals($mac, '03:00:00:00:80:00')) $app = 'Bridge (Token Ring)'; |
|
- | 317 | if (mac_equals($mac, '03:00:00:20:00:00')) $app = 'Single Token-Ring functional address'; |
|
- | 318 | if (mac_equals($mac, '03:00:00:00:00:08')) $app = 'Configuration Report Server (CRS) MAC Group address'; |
|
- | 319 | if (mac_equals($mac, '03:00:00:00:00:10')) $app = 'Ring Error Monitor (REM) MAC Group address'; |
|
- | 320 | if (mac_equals($mac, '03:00:00:00:00:40')) $app = 'Ring Parameter Server (RPS) MAC group address'; |
|
- | 321 | if (mac_equals($mac, '03:00:00:00:01:00')) $app = 'All Intermediate System Network Entities address'; |
|
- | 322 | if (mac_equals($mac, '03:00:00:00:02:00')) $app = 'All End System Network Entities address, and Lobe Media Test (LMT) MAC group address'; |
|
- | 323 | if (mac_equals($mac, '03:00:00:00:04:00')) $app = 'Generic address for all Manager Stations'; |
|
- | 324 | if (mac_equals($mac, '03:00:00:00:08:00')) $app = 'All CONs SNARES address'; |
|
- | 325 | if (mac_equals($mac, '03:00:00:00:10:00')) $app = 'All CONs End System address'; |
|
- | 326 | if (mac_equals($mac, '03:00:00:00:20:00')) $app = 'Loadable Device Generic address'; |
|
- | 327 | if (mac_equals($mac, '03:00:00:00:40:00')) $app = 'Load Server Generic address'; |
|
- | 328 | if (mac_equals($mac, '03:00:00:40:00:00')) $app = 'Generic address for all Agent Stations'; |
|
- | 329 | if (mac_equals($mac, 'C0:00:00:04:00:00')) $app = 'Single Token-Ring functional address'; |
|
- | 330 | if (mac_equals($mac, '03:00:80:00:00:00')) $app = 'IPv6 multicast over Token Ring: all-Nodes (FF01::1 and FF02::1) and solicited node (FF02:0:0:0:0:1:FFXX:XXXX) addresses'; |
|
- | 331 | if (mac_equals($mac, '03:00:40:00:00:00')) $app = 'IPv6 multicast over Token Ring: all-Routers addresses (FF0X::2)'; |
|
- | 332 | if (mac_equals($mac, '03:00:00:80:00:00')) $app = 'IPv6 multicast over Token Ring: any other multicast address with three least significant bits = 000'; |
|
- | 333 | if (mac_equals($mac, '03:00:00:40:00:00')) $app = 'IPv6 multicast over Token Ring: any other multicast address with three least significant bits = 001'; |
|
- | 334 | if (mac_equals($mac, '03:00:00:20:00:00')) $app = 'IPv6 multicast over Token Ring: any other multicast address with three least significant bits = 010'; |
|
- | 335 | if (mac_equals($mac, '03:00:00:10:00:00')) $app = 'IPv6 multicast over Token Ring: any other multicast address with three least significant bits = 011'; |
|
- | 336 | if (mac_equals($mac, '03:00:00:08:00:00')) $app = 'IPv6 multicast over Token Ring: any other multicast address with three least significant bits = 100'; |
|
- | 337 | if (mac_equals($mac, '03:00:00:04:00:00')) $app = 'IPv6 multicast over Token Ring: any other multicast address with three least significant bits = 101'; |
|
- | 338 | if (mac_equals($mac, '03:00:00:02:00:00')) $app = 'IPv6 multicast over Token Ring: any other multicast address with three least significant bits = 110'; |
|
- | 339 | if (mac_equals($mac, '03:00:00:01:00:00')) $app = 'IPv6 multicast over Token Ring: any other multicast address with three least significant bits = 111'; |
|
- | 340 | ||
- | 341 | // === FAQ "How to recognise an AppleTalk protocols by MAC address?" === |
|
- | 342 | // https://tools.ietf.org/html/rfc1060 |
|
- | 343 | // http://www.cavebear.com/archive/cavebear/Ethernet/Ethernet.txt |
|
- | 344 | if (mac_between($mac, '09:00:07:00:00:00', '09:00:07:00:00:FC')) $app = 'AppleTalk zone multicast addresses (EtherType is 0x0802)'; |
|
- | 345 | if (mac_equals($mac, '09:00:07:FF:FF:FF')) $app = 'AppleTalk broadcast address (EtherType is 0x0802)'; |
|
- | 346 | ||
- | 347 | // === FAQ "How to recognise a TRILL protocols by MAC address?" === |
|
- | 348 | // http://www.iana.org/go/rfc7455 |
|
- | 349 | // https://tools.ietf.org/html/draft-ietf-trill-oam-framework-04 |
|
- | 350 | // https://standards.ieee.org/products-services/regauth/grpmac/public.html |
|
- | 351 | // https://tools.ietf.org/html/rfc7455#appendix-C |
|
- | 352 | if (mac_between($mac, '00:00:5E:90:01:00', '00:00:5E:90:01:00')) $app = 'TRILL OAM'; |
|
- | 353 | if (mac_equals($mac, '01:00:5E:90:01:00')) $app = 'TRILL OAM'; |
|
- | 354 | if (mac_between($mac, '01:80:C2:00:00:40', '01:80:C2:00:00:4F')) $app = 'Group MAC addresses used by the TRILL protocols'; |
|
- | 355 | ||
- | 356 | // === FAQ "How to recognise an IEEE 802.1X MAC address application?" === |
|
- | 357 | if (mac_between($mac, '01:0C:CD:01:00:00', '01:0C:CD:01:01:FF')) $app = 'IEC 61850-8-1 GOOSE Type 1/1A, EtherType is 0x88B8'; |
|
- | 358 | if (mac_between($mac, '01:0C:CD:02:00:00', '01:0C:CD:02:01:FF')) $app = 'GSSE (IEC 61850 8-1), EtherType is 0x88B9'; |
|
- | 359 | if (mac_between($mac, '01:0C:CD:04:00:00', '01:0C:CD:04:01:FF')) $app = 'Multicast sampled values (IEC 61850 8-1), EtherType is 0x88BA'; |
|
- | 360 | if (mac_equals($mac, '01:1B:19:00:00:00')) $app = 'General group address - An 802.1Q VLAN Bridge would forward the frame unchanged.'; |
|
- | 361 | if (mac_equals($mac, '01:1B:19:00:00:00')) $app = 'Precision Time Protocol (PTP) version 2 over Ethernet, EtherType is 0x88F7'; |
|
- | 362 | if (mac_equals($mac, '01:80:C2:00:00:00')) $app = 'Bridge Group address Nearest Customer Bridge group address'; |
|
- | 363 | if (mac_equals($mac, '01:80:C2:00:00:00')) $app = 'Spanning Tree Protocol (for bridges) IEEE 802.1D, EtherType is 0x0802'; |
|
- | 364 | if (mac_equals($mac, '01:80:C2:00:00:00')) $app = 'Link Layer Discovery Protocol, EtherType is 0x88CC'; |
|
- | 365 | if (mac_between($mac, '01:80:C2:00:00:00', '01:80:C2:00:00:0F')) $app = 'The initial bridging/link protocols block'; |
|
- | 366 | if (mac_between($mac, '01:80:C2:00:00:00', '01:80:C2:00:00:0F')) $app = 'IEEE 802.1D MAC Bridge Filtered MAC Group Addresses'; |
|
- | 367 | if (mac_between($mac, '01:80:C2:00:00:00', '01:80:C2:00:00:0F')) $app = 'IEEE Pause, 802.3x'; |
|
- | 368 | if (mac_equals($mac, '01:80:C2:00:00:0A')) $app = 'Reserved for future standardization'; |
|
- | 369 | if (mac_equals($mac, '01:80:C2:00:00:0B')) $app = 'EDE-SS PEP Address'; |
|
- | 370 | if (mac_equals($mac, '01:80:C2:00:00:0C')) $app = 'Reserved for future standardization'; |
|
- | 371 | if (mac_equals($mac, '01:80:C2:00:00:0D')) $app = 'Provider Bridge MVRP address'; |
|
- | 372 | if (mac_equals($mac, '01:80:C2:00:00:0E')) $app = 'Individual LAN Scope group address, It is intended that no IEEE 802.1 relay device will be defined that will forward frames that carry this destination address'; |
|
- | 373 | if (mac_equals($mac, '01:80:C2:00:00:0E')) $app = 'Nearest Bridge group address'; |
|
- | 374 | if (mac_equals($mac, '01:80:C2:00:00:0E')) $app = 'Link Layer Discovery Protocol, EtherType is 0x88CC'; |
|
- | 375 | if (mac_equals($mac, '01:80:C2:00:00:0E')) $app = 'Precision Time Protocol (PTP) version 2 over Ethernet, EtherType is 0x88F7'; |
|
- | 376 | if (mac_equals($mac, '01:80:C2:00:00:01')) $app = 'IEEE MAC-specific Control Protocols group address'; |
|
- | 377 | if (mac_equals($mac, '01:80:C2:00:00:01')) $app = 'Ethernet flow control (Pause frame) IEEE 802.3x, EtherType is 0x8808'; |
|
- | 378 | if (mac_equals($mac, '01:80:C2:00:00:1A')) $app = 'Generic Address for All Agent Stations'; |
|
- | 379 | if (mac_equals($mac, '01:80:C2:00:00:1B')) $app = 'All Multicast Capable End Systems address'; |
|
- | 380 | if (mac_equals($mac, '01:80:C2:00:00:1C')) $app = 'All Multicast Announcements address'; |
|
- | 381 | if (mac_equals($mac, '01:80:C2:00:00:1D')) $app = 'All Multicast Capable Intermediate Systems address'; |
|
- | 382 | if (mac_equals($mac, '01:80:C2:00:00:1E')) $app = 'All DTR Concentrators MAC group address'; |
|
- | 383 | if (mac_equals($mac, '01:80:C2:00:00:1F')) $app = 'EDE-CC PEP Address'; |
|
- | 384 | if (mac_between($mac, '01:80:C2:00:00:01', '01:80:C2:00:00:0F')) $app = '802.1 alternate Spanning multicast, EtherType is 0x0802'; |
|
- | 385 | if (mac_equals($mac, '01:80:C2:00:00:02')) $app = 'Ethernet OAM Protocol IEEE 802.3ah (also known as "slow protocols"), EtherType is 0x8809'; |
|
- | 386 | if (mac_equals($mac, '01:80:C2:00:00:03')) $app = 'Nearest non-TPMR Bridge group address IEEE Std 802.1X PAE address'; |
|
- | 387 | if (mac_equals($mac, '01:80:C2:00:00:03')) $app = 'Link Layer Discovery Protocol, EtherType is 0x88CC'; |
|
- | 388 | if (mac_equals($mac, '01:80:C2:00:00:04')) $app = 'IEEE MAC-specific Control Protocols group address'; |
|
- | 389 | if (mac_equals($mac, '01:80:C2:00:00:05')) $app = 'Reserved for future standardization'; |
|
- | 390 | if (mac_equals($mac, '01:80:C2:00:00:06')) $app = 'Reserved for future standardization'; |
|
- | 391 | if (mac_equals($mac, '01:80:C2:00:00:07')) $app = 'MEF Forum ELMI protocol group address'; |
|
- | 392 | if (mac_equals($mac, '01:80:C2:00:00:08')) $app = 'Provider Bridge group address'; |
|
- | 393 | if (mac_equals($mac, '01:80:C2:00:00:08')) $app = 'Spanning Tree Protocol (for provider bridges) IEEE 802.1ad, EtherType is 0x0802'; |
|
- | 394 | if (mac_equals($mac, '01:80:C2:00:00:09')) $app = 'Reserved for future standardization'; |
|
- | 395 | if (mac_equals($mac, '01:80:C2:00:00:10')) $app = 'All LANs Bridge Management group address (deprecated)'; |
|
- | 396 | if (mac_equals($mac, '01:80:C2:00:00:10')) $app = 'Bridge Management, EtherType is 0x0802'; |
|
- | 397 | if (mac_equals($mac, '01:80:C2:00:00:11')) $app = 'Load Server generic address'; |
|
- | 398 | if (mac_equals($mac, '01:80:C2:00:00:11')) $app = 'Load Server, EtherType is 0x0802'; |
|
- | 399 | if (mac_equals($mac, '01:80:C2:00:00:12')) $app = 'Loadable Device generic address'; |
|
- | 400 | if (mac_equals($mac, '01:80:C2:00:00:12')) $app = 'Loadable Device, EtherType is 0x0802'; |
|
- | 401 | if (mac_equals($mac, '01:80:C2:00:00:13')) $app = 'Transmission of IEEE 1905.1 control packets'; |
|
- | 402 | if (mac_equals($mac, '01:80:C2:00:00:14')) $app = 'All Level 1 Intermediate Systems address'; |
|
- | 403 | if (mac_equals($mac, '01:80:C2:00:00:14')) $app = 'OSI Route level 1 (within area), EtherType is 0x0802'; |
|
- | 404 | if (mac_equals($mac, '01:80:C2:00:00:15')) $app = 'All Level 2 Intermediate Systems address'; |
|
- | 405 | if (mac_equals($mac, '01:80:C2:00:00:15')) $app = 'OSI Route level 2 (between area), EtherType is 0x0802'; |
|
- | 406 | if (mac_equals($mac, '01:80:C2:00:00:16')) $app = 'All CONS End Systems address'; |
|
- | 407 | if (mac_equals($mac, '01:80:C2:00:00:17')) $app = 'All CONS SNARES address'; |
|
- | 408 | if (mac_equals($mac, '01:80:C2:00:00:18')) $app = 'Generic address for All Manager Stations'; |
|
- | 409 | if (mac_equals($mac, '01:80:C2:00:00:19')) $app = 'Groupcast with retries (GCR) MAC group address'; |
|
- | 410 | if (mac_between($mac, '01:80:C2:00:00:20', '01:80:C2:00:00:2F')) $app = 'Reserved for use by Multiple Registration Protocol (MRP) applications'; |
|
- | 411 | if (mac_equals($mac, '01:80:C2:00:00:21')) $app = 'GARP VLAN Registration Protocol (also known as IEEE 802.1q GVRP), EtherType is 0x88f5'; |
|
- | 412 | if (mac_between($mac, '01:80:C2:00:00:30', '01:80:C2:00:00:3F')) $app = 'Destination group MAC addresses for CCM and Linktrace messages'; |
|
- | 413 | if (mac_between($mac, '01:80:C2:00:00:30', '01:80:C2:00:00:3F')) $app = 'Ethernet CFM Protocol IEEE 802.1ag, EtherType is 0x8902'; |
|
- | 414 | if (mac_between($mac, '01:80:C2:00:00:50', '01:80:C2:00:00:FF')) $app = 'Unassigned standard group MAC address'; |
|
- | 415 | if (mac_equals($mac, '01:80:C2:00:01:00')) $app = 'Ring Management Directed Beacon multicast address'; |
|
- | 416 | if (mac_equals($mac, '01:80:C2:00:01:00')) $app = 'FDDI RMT Directed Beacon, EtherType is 0x0802'; |
|
- | 417 | if (mac_between($mac, '01:80:C2:00:01:01', '01:80:C2:00:01:0F')) $app = 'Assigned to ISO/IEC JTC1/SC25 for future use'; |
|
- | 418 | if (mac_equals($mac, '01:80:C2:00:01:10')) $app = 'Status Report Frame Status Report Protocol multicast address'; |
|
- | 419 | if (mac_equals($mac, '01:80:C2:00:01:10')) $app = 'FDDI status report frame, EtherType is 0x0802'; |
|
- | 420 | if (mac_between($mac, '01:80:C2:00:01:11', '01:80:C2:00:01:1F')) $app = 'Assigned to ISO/IEC JTC1/SC25 for future use'; |
|
- | 421 | if (mac_equals($mac, '01:80:C2:00:01:20')) $app = 'All FDDI Concentrator MACs'; |
|
- | 422 | if (mac_between($mac, '01:80:C2:00:01:21', '01:80:C2:00:01:2F')) $app = 'Assigned to ISO/IEC JTC1/SC25 for future use'; |
|
- | 423 | if (mac_equals($mac, '01:80:C2:00:01:30')) $app = 'Synchronous Bandwidth Allocation address'; |
|
- | 424 | if (mac_between($mac, '01:80:C2:00:01:31', '01:80:C2:00:01:FF')) $app = 'Assigned to ISO/IEC JTC1/SC25 for future use'; |
|
- | 425 | if (mac_between($mac, '01:80:C2:00:02:00', '01:80:C2:00:02:FF')) $app = 'Assigned to ETSI for future use'; |
|
- | 426 | if (mac_between($mac, '01:80:C2:00:03:00', '01:80:C2:FF-FF-FF')) $app = 'Unassigned standard group MAC address'; |
|
- | 427 | if (mac_equals($mac, '09:00:4C:00:00:00')) $app = 'BICC 802.1 management, EtherType is 0x0802'; |
|
- | 428 | if (mac_equals($mac, '09:00:4C:00:00:0C')) $app = 'BICC Remote bridge STA 802.1(D) Rev8, EtherType is 0x0802'; |
|
- | 429 | if (mac_equals($mac, '09:00:4C:00:00:02')) $app = 'BICC 802.1 management, EtherType is 0x0802'; |
|
- | 430 | if (mac_equals($mac, '09:00:4C:00:00:06')) $app = 'BICC Local bridge STA 802.1(D) Rev6, EtherType is 0x0802'; |
|
- | 431 | if (mac_between($mac, '33:33:00:00:00:00', '33:33:FF:FF:FF:FF')) $app = 'IPv6 multicast, EtherType is 0x86DD'; |
|
- | 432 | ||
- | 433 | // === FAQ "How to recognise an ISO 9542 ES-IS protocol's MAC address application?" === |
|
- | 434 | // https://standards.ieee.org/products-services/regauth/grpmac/public.html |
|
- | 435 | if (mac_equals($mac, '09:00:2B:00:00:04')) $app = 'All End System Network Entities address'; |
|
- | 436 | if (mac_equals($mac, '09:00:2B:00:00:05')) $app = 'All Intermediate System Network Entities address'; |
|
- | 437 | ||
- | 438 | // === FAQ "How to recognise an IANA MAC address application?" === |
|
- | 439 | // https://www.iana.org/assignments/ethernet-numbers/ethernet-numbers.xhtml |
|
- | 440 | // http://www.iana.org/go/rfc7042 |
|
- | 441 | // https://tools.ietf.org/html/rfc1060 |
|
- | 442 | if (mac_between($mac, '00:00:5E:00-52:14', '00:00:5E:00:52:FF')) $app = 'Unassigned (small allocations)'; |
|
- | 443 | if (mac_between($mac, '00:00:5E:00:00:00', '00:00:5E:00:00:FF')) $app = 'Reserved and require IESG Ratification for assignment'; |
|
- | 444 | if (mac_between($mac, '00:00:5E:00:03:00', '00:00:5E:00:51:FF')) $app = 'Unassigned'; |
|
- | 445 | if (mac_between($mac, '00:00:5E:00:52:00', '00:00:5E:00:52:FF')) $app = 'Is used for very small assignments. Currently, 3 out of these 256 values have been assigned.'; |
|
- | 446 | if (mac_between($mac, '00:00:5E:00:52:00', '00:00:5E:00:52:00')) $app = 'PacketPWEthA'; |
|
- | 447 | if (mac_between($mac, '00:00:5E:00:52:01', '00:00:5E:00:52:01')) $app = 'PacketPWEthB'; |
|
- | 448 | if (mac_between($mac, '00:00:5E:00:52:02', '00:00:5E:00:52:12')) $app = 'Unassigned (small allocations)'; |
|
- | 449 | if (mac_between($mac, '00:00:5E:00:53:00', '00:00:5E:00:53:FF')) $app = 'Assigned for use in documentation'; |
|
- | 450 | if (mac_between($mac, '00:00:5E:00:54:00', '00:00:5E:90:00:FF')) $app = 'Unassigned'; |
|
- | 451 | if (mac_between($mac, '00:00:5E:90:01:01', '00:00:5E:90:01:FF')) $app = 'Unassigned (small allocations requiring both unicast and multicast)'; |
|
- | 452 | //if (mac_between($mac, '00:00:5E:EF:10:00:00:00', '00:00:5E:EF:10:00:00:FF')) $app = 'General documentation'; |
|
- | 453 | //if (mac_between($mac, '00:00:5E:FF:FE:00:53:00', '00:00:5E:FF:FE:00:53:FF')) $app = 'EUI-48 derived documentation'; |
|
119 | // TODO |
454 | if (mac_between($mac, '01:00:5E:00:00:00', '01:00:5E:7F:FF:FF')) $app = 'DoD Internet Multicast (EtherType is 0x0800)'; // TODO: IPv4-Multicast (Dabei werden dann die unteren 23 Bit der IP-Multicast-Adresse direkt auf die untersten 23 Bit der MAC-Adresse abgebildet. Der IP-Multicast-Adresse 224.0.0.1 ist somit die Multicast-MAC-Adresse 01-00-5e-00-00-01 fest zugeordnet.) |
- | 455 | if (mac_between($mac, '01:00:5E:80:00:00', '01:00:5E:FF:FF:FF')) $app = 'DoD Internet'; |
|
- | 456 | if (mac_equals($mac, '01:00:5E:90:00:02')) $app = 'AllL1MI-ISs'; |
|
- | 457 | if (mac_equals($mac, '01:00:5E:90:00:03')) $app = 'AllL2MI-ISs'; |
|
- | 458 | if (mac_between($mac, '01:00:5E:90:00:04', '01:00:5E:90:00:FF')) $app = 'Unassigned (small allocations)'; |
|
- | 459 | if (mac_between($mac, '01:00:5E:90:01:01', '01:00:5E:90:01:FF')) $app = 'Unassigned (small allocations requiring both unicast and multicast)'; |
|
- | 460 | if (mac_between($mac, '01:00:5E:90:02:00', '01:00:5E:90:0F:FF')) $app = 'Unassigned'; |
|
- | 461 | if (mac_between($mac, '01:00:5E:90:02:00', '00:00:5E:FF:FF:FF')) $app = 'Unassigned'; |
|
- | 462 | if (mac_between($mac, '01:00:5E:90:10:00', '01:00:5E:90:10:FF')) $app = 'Documentation'; |
|
- | 463 | if (mac_between($mac, '01:00:5E:90:11:00', '01:00:5E:FF:FF:FF')) $app = 'Unassigned'; |
|
- | 464 | //if (mac_between($mac, '01:00:5E:EF:10:00:00:00', '01:00:5E:EF:10:00:00:FF')) $app = 'General documentation'; |
|
- | 465 | //if (mac_between($mac, '02:00:5E:00:00:00:00:00', '02:00:5E:0F:FF:FF:FF:FF')) $app = 'Reserved'; |
|
- | 466 | //if (mac_between($mac, '02:00:5E:10:00:00:00:00', '02:00:5E:10:00:00:00:FF')) $app = 'Documentation'; |
|
- | 467 | //if (mac_between($mac, '02:00:5E:10:00:00:01:00', '02:00:5E:EF:FF:FF:FF:FF')) $app = 'Unassigned'; |
|
- | 468 | //if (mac_between($mac, '02:00:5E:F0:00:00:00:00', '02:00:5E:FD:FF:FF:FF:FF')) $app = 'Reserved'; |
|
- | 469 | //if (mac_between($mac, '02:00:5E:FE:00:00:00:00', '02:00:5E:FE:FF:FF:FF:FF')) $app = 'IPv4 Addr Holders'; |
|
- | 470 | //if (mac_between($mac, '02:00:5E:FF:00:00:00:00', '02:00:5E:FF:FD:FF:FF:FF')) $app = 'Reserved'; |
|
- | 471 | //if (mac_between($mac, '02:00:5E:FF:FE:00:00:00', '02:00:5E:FF:FE:FF:FF:FF')) $app = 'IANA EUI-48 Holders'; |
|
- | 472 | //if (mac_between($mac, '02:00:5E:FF:FF:00:00:00', '02:00:5E:FF:FF:FF:FF:FF')) $app = 'Reserved'; |
|
- | 473 | //if (mac_between($mac, '03:00:5E:00:00:00:00:00', '03:00:5E:0F:FF:FF:FF:FF')) $app = 'Reserved'; |
|
- | 474 | //if (mac_between($mac, '03:00:5E:10:00:00:00:00', '03:00:5E:10:00:00:00:FF')) $app = 'Documentation'; |
|
- | 475 | //if (mac_between($mac, '03:00:5E:10:00:00:01:00', '03:00:5E:EF:FF:FF:FF:FF')) $app = 'Unassigned'; |
|
- | 476 | //if (mac_between($mac, '03:00:5E:F0:00:00:00:00', '03:00:5E:FD:FF:FF:FF:FF')) $app = 'Reserved'; |
|
- | 477 | //if (mac_between($mac, '03:00:5E:FF:00:00:00:00', '03:00:5E:FF:FD:FF:FF:FF')) $app = 'Reserved'; |
|
- | 478 | //if (mac_between($mac, '03:00:5E:FF:FE:00:00:00', '03:00:5E:FF:FE:FF:FF:FF')) $app = 'IANA EUI-48 Holders'; |
|
- | 479 | //if (mac_between($mac, '03:00:5E:FF:FF:00:00:00', '03:00:5E:FF:FF:FF:FF:FF')) $app = 'Reserved'; |
|
- | 480 | ||
- | 481 | // === FAQ "How to recognise a Cisco's MAC address application?" === |
|
- | 482 | // https://www.cisco.com/c/en/us/support/docs/switches/catalyst-4500-series-switches/13414-103.html |
|
120 | // FF-FF-FF-FF-FF-FF = Broadcast-Adresse |
483 | // https://tools.ietf.org/html/rfc1060 |
- | 484 | // https://en.wikipedia.org/wiki/Multicast_address#cite_note-15 |
|
- | 485 | // http://www.cavebear.com/archive/cavebear/Ethernet/Ethernet.txt |
|
- | 486 | if (mac_equals($mac, '01:00:0C:00:00:00')) $app = 'Inter Switch Link (ISL)'; |
|
- | 487 | if (mac_equals($mac, '01:00:0C:CC:CC:CC')) $app = 'CDP (Cisco Discovery Protocol), VTP (VLAN Trunking Protocol), EtherType is 0x0802'; |
|
- | 488 | if (mac_equals($mac, '01:00:0C:CC:CC:CC')) $app = 'Port Aggregation Protocol (PAgP), SNAP HDLC Protocol Type is 0x0104'; |
|
- | 489 | if (mac_equals($mac, '01:00:0C:CC:CC:CC')) $app = 'Unidirectional Link Detection (UDLD), SNAP HDLC Protocol Type is 0x0111'; |
|
- | 490 | if (mac_equals($mac, '01:00:0C:CC:CC:CC')) $app = 'Dynamic Trunking (DTP), SNAP HDLC Protocol Type is 0x2004'; |
|
- | 491 | if (mac_equals($mac, '01:00:0C:CC:CC:CC')) $app = 'VLAN Trunking (VTP), SNAP HDLC Protocol Type is 0x2003'; |
|
- | 492 | if (mac_equals($mac, '01:00:0C:CC:CC:CD')) $app = 'Cisco Shared Spanning Tree Protocol address, EtherType is 0x0802'; |
|
- | 493 | if (mac_equals($mac, '01:00:0C:CC:CC:CD')) $app = 'Spanning Tree PVSTP+, SNAP HDLC Protocol Type is 0x010B'; |
|
- | 494 | if (mac_equals($mac, '01:00:0C:CD:CD:CD')) $app = 'STP Uplink Fast, SNAP HDLC Protocol Type is 0x200A'; |
|
- | 495 | if (mac_equals($mac, '01:00:0C:CD:CD:CE')) $app = 'VLAN Bridge, SNAP HDLC Protocol Type is 0x010C'; |
|
- | 496 | if (mac_equals($mac, '01:00:0C:DD:DD:DD')) $app = 'CGMP (Cisco Group Management Protocol)'; |
|
- | 497 | ||
- | 498 | // === FAQ "How to recognise an ITU-T's MAC address application?" === |
|
- | 499 | // https://www.itu.int/en/ITU-T/studygroups/2017-2020/15/Documents/IEEE-assigned_OUIs-30-06-2017.docx |
|
- | 500 | if (mac_between($mac, '01:19:A7:00:00:00', '01:19:A7:00:00:FF')) $app = 'R-APS per G.8032'; |
|
- | 501 | if (mac_between($mac, '01:19:A7:52:76:90', '01:19:A7:52:76:9F')) $app = 'Multicast per G.9961'; |
|
- | 502 | ||
- | 503 | // === FAQ "How to recognise Digital Equipment Corporation's MAC address application?" === |
|
- | 504 | if (mac_equals($mac, '09:00:2B:00:00:00')) $app = 'DEC MUMPS, EtherType is 0x6009'; |
|
- | 505 | if (mac_equals($mac, '09:00:2B:00:00:0F')) $app = 'DEC Local Area Transport (LAT), EtherType is 0x6004'; |
|
- | 506 | if (mac_equals($mac, '09:00:2B:00:00:01')) $app = 'DEC DSM/DDP, EtherType is 0x8039'; |
|
- | 507 | if (mac_between($mac, '09:00:2B:00:00:10', '09:00:2B:00:00:1F')) $app = 'DEC Experimental'; |
|
- | 508 | if (mac_equals($mac, '09:00:2B:00:00:02')) $app = 'DEC VAXELN, EtherType is 0x803B'; |
|
- | 509 | if (mac_equals($mac, '09:00:2B:00:00:03')) $app = 'DEC Lanbridge Traffic Monitor (LTM), EtherType is 0x8038'; |
|
- | 510 | if (mac_equals($mac, '09:00:2B:00:00:04')) $app = 'DEC MAP End System'; |
|
- | 511 | if (mac_equals($mac, '09:00:2B:00:00:05')) $app = 'DEC MAP Intermediate System'; |
|
- | 512 | if (mac_equals($mac, '09:00:2B:00:00:06')) $app = 'DEC CSMA/CD Encryption, EtherType is 0x803D'; |
|
- | 513 | if (mac_equals($mac, '09:00:2B:00:00:07')) $app = 'DEC NetBios Emulator, EtherType is 0x8040'; |
|
- | 514 | if (mac_equals($mac, '09:00:2B:01:00:00')) $app = 'DEC LanBridge, EtherType is 0x8038'; |
|
- | 515 | if (mac_equals($mac, '09:00:2B:01:00:01')) $app = 'DEC LanBridge, EtherType is 0x8038'; |
|
- | 516 | if (mac_equals($mac, '09:00:2B:02:00:00')) $app = 'DEC DNA Level 2 Routing'; |
|
- | 517 | if (mac_equals($mac, '09:00:2B:02:01:00')) $app = 'DEC DNA Naming Service Advertisement, EtherType is 0x803C'; |
|
- | 518 | if (mac_equals($mac, '09:00:2B:02:01:01')) $app = 'DEC DNA Naming Service Solicitation, EtherType is 0x803C'; |
|
- | 519 | if (mac_equals($mac, '09:00:2B:02:01:02')) $app = 'DEC Distributed Time Service, EtherType is 0x803E'; |
|
- | 520 | if (mac_equals($mac, '09:00:2B:02:01:09')) $app = 'DEC Availability Manager for Distributed Systems DECamds, EtherType is 0x8048'; |
|
- | 521 | if (mac_between($mac, '09:00:2B:03:00:00', '09:00:2B:03:FF:FF')) $app = 'DEC default filtering by bridges'; |
|
- | 522 | if (mac_equals($mac, '09:00:2B:04:00:00')) $app = 'DEC Local Area System Transport (LAST), EtherType is 0x8041'; |
|
- | 523 | if (mac_equals($mac, '09:00:2B:23:00:00')) $app = 'DEC Argonaut Console, EtherType is 0x803A'; |
|
- | 524 | if (mac_equals($mac, 'AB:00:00:01:00:00')) $app = 'DEC Maintenance Operation Protocol (MOP) Dump/Load Assistance, EtherType is 0x6001'; |
|
- | 525 | if (mac_equals($mac, 'AB:00:00:02:00:00')) $app = 'DEC Maintenance Operation Protocol (MOP), EtherType is 0x6002'; |
|
- | 526 | if (mac_equals($mac, 'AB:00:00:03:00:00')) $app = 'DECNET Phase IV end node, EtherType is 0x6003'; |
|
- | 527 | if (mac_equals($mac, 'AB:00:00:04:00:00')) $app = 'DECNET Phase IV Router, EtherType is 0x6003'; |
|
- | 528 | if (mac_between($mac, 'AB:00:00:05:00:00', 'AB:00:03:FF:FF:FF')) $app = 'Reserved DEC'; |
|
- | 529 | if (mac_equals($mac, 'AB:00:03:00:00:00')) $app = 'DEC Local Area Transport (LAT) - old, EtherType is 0x6004'; |
|
- | 530 | if (mac_between($mac, 'AB:00:04:00:00:00', 'AB:00:04:00:FF:FF')) $app = 'Reserved DEC customer private use'; |
|
- | 531 | if (mac_between($mac, 'AB:00:04:01:00:00', 'AB:00:04:01:FF:FF')) $app = 'DEC Local Area VAX Cluster groups System Communication Architecture (SCA) EtherType is 0x6007'; |
|
- | 532 | ||
- | 533 | if ($app) { |
|
- | 534 | echo sprintf("%-32s %s\n", "Special use:", $app); |
|
- | 535 | } |
|
- | 536 | ||
- | 537 | } |
|
- | 538 | ||
- | 539 | /** |
|
- | 540 | * @param string $mac1 |
|
- | 541 | * @param string $mac2 |
|
- | 542 | * @return bool |
|
- | 543 | * @throws Exception |
|
- | 544 | */ |
|
- | 545 | function mac_equals(string $mac1, string $mac2): bool { |
|
- | 546 | return mac_between($mac1, $mac2, $mac2); |
|
- | 547 | } |
|
- | 548 | ||
- | 549 | /** |
|
- | 550 | * @param string $mac |
|
- | 551 | * @param string $low |
|
- | 552 | * @param string $high |
|
- | 553 | * @return bool |
|
- | 554 | * @throws Exception |
|
- | 555 | */ |
|
- | 556 | function mac_between(string $mac, string $low, string $high): bool { |
|
- | 557 | if (empty($high)) $high = $low; |
|
121 | 558 | ||
- | 559 | if (!mac_valid($mac)) throw new Exception("Invalid MAC: $mac"); |
|
- | 560 | if (!mac_valid($low)) throw new Exception("Invalid MAC: $low"); |
|
- | 561 | if (!mac_valid($high)) throw new Exception("Invalid MAC: $high"); |
|
122 | // TODO |
562 | |
123 | // IP-Multicast |
563 | $mac = strtoupper(preg_replace('@[^0-9A-F]@', '', $mac)); |
- | 564 | $low = strtoupper(preg_replace('@[^0-9A-F]@', '', $low)); |
|
124 | // 01-00-5E-00-00-00 bis 01-00-5E-7F-FF-FF (unterste 23 bit der MAC = unterste 23 Bit der IP) ... |
565 | $high = strtoupper(preg_replace('@[^0-9A-F]@', '', $high)); |
- | 566 | ||
- | 567 | $mac = gmp_init($mac, 16); |
|
125 | // 224.0.0.1 -> 01-00-5e-00-00-01 |
568 | $low = gmp_init($low, 16); |
126 | // erste 4 Bits durch Class D konvention belegt. 5 bits sind unbekannt |
569 | $high = gmp_init($high, 16); |
127 | 570 | ||
128 | // TODO: VRRP |
- | |
129 | // 00-00-5E-00-01-ID |
571 | return (gmp_cmp($mac, $low) >= 0) && (gmp_cmp($mac, $high) <= 0); |
130 | } |
572 | } |