Rev 21 | Rev 23 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 21 | Rev 22 | ||
---|---|---|---|
1 | <?php |
1 | <?php |
2 | 2 | ||
3 | /* |
3 | /* |
4 | * MAC (EUI-48 and EUI-64) utils for PHP |
4 | * MAC (EUI-48 and EUI-64) utils for PHP |
5 | * Copyright 2017 - 2023 Daniel Marschall, ViaThinkSoft |
5 | * Copyright 2017 - 2023 Daniel Marschall, ViaThinkSoft |
6 | * Version 2023-05-04 |
6 | * Version 2023-05-05 |
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 | * |
12 | * http://www.apache.org/licenses/LICENSE-2.0 |
12 | * http://www.apache.org/licenses/LICENSE-2.0 |
13 | * |
13 | * |
14 | * Unless required by applicable law or agreed to in writing, software |
14 | * Unless required by applicable law or agreed to in writing, software |
15 | * distributed under the License is distributed on an "AS IS" BASIS, |
15 | * distributed under the License is distributed on an "AS IS" BASIS, |
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 | // Very good resources for information about OUI, EUI, MAC, ... |
21 | // Very good resources for information about OUI, EUI, MAC, ... |
22 | // - https://mac-address.alldatafeeds.com/faq#how-to-recognise-mac-address-application |
22 | // - https://mac-address.alldatafeeds.com/faq#how-to-recognise-mac-address-application |
23 | // - https://standards.ieee.org/wp-content/uploads/import/documents/tutorials/eui.pdf |
23 | // - https://standards.ieee.org/wp-content/uploads/import/documents/tutorials/eui.pdf |
24 | // - https://en.m.wikipedia.org/wiki/Organizationally_unique_identifier |
24 | // - https://en.m.wikipedia.org/wiki/Organizationally_unique_identifier |
25 | 25 | ||
26 | const IEEE_MAC_REGISTRY = __DIR__ . '/../web-data'; |
26 | const IEEE_MAC_REGISTRY = __DIR__ . '/../web-data'; |
27 | 27 | ||
28 | /** |
28 | /** |
29 | * Checks if a MAC, EUI, ELI, AAI, SAI, or IPv6-Link-Local address is valid |
29 | * Checks if a MAC, EUI, ELI, AAI, SAI, or IPv6-Link-Local address is valid |
30 | * @param string $mac MAC, EUI, or IPv6-Link-Local Address |
30 | * @param string $mac MAC, EUI, or IPv6-Link-Local Address |
31 | * @return bool True if it is valid |
31 | * @return bool True if it is valid |
32 | */ |
32 | */ |
33 | function mac_valid(string $mac): bool { |
33 | function mac_valid(string $mac): bool { |
34 | $tmp = ipv6linklocal_to_mac48($mac); |
34 | $tmp = ipv6linklocal_to_mac48($mac); |
35 | if ($tmp !== false) $mac = $tmp; |
35 | if ($tmp !== false) $mac = $tmp; |
36 | 36 | ||
37 | $mac = str_replace(array('-', ':'), '', $mac); |
37 | $mac = str_replace(array('-', ':'), '', $mac); |
38 | $mac = strtoupper($mac); |
38 | $mac = strtoupper($mac); |
39 | 39 | ||
40 | if ((strlen($mac) != 12) && (strlen($mac) != 16)) return false; |
40 | if ((strlen($mac) != 12) && (strlen($mac) != 16)) return false; |
41 | 41 | ||
42 | $mac = preg_replace('@[0-9A-F]@', '', $mac); |
42 | $mac = preg_replace('@[0-9A-F]@', '', $mac); |
43 | 43 | ||
44 | return ($mac === ''); |
44 | return ($mac === ''); |
45 | } |
45 | } |
46 | 46 | ||
47 | /** |
47 | /** |
48 | * Returns the amount of bits of a MAC, EUI, ELI, AAI, or SAI |
48 | * Returns the amount of bits of a MAC, EUI, ELI, AAI, or SAI |
49 | * @param string $mac |
49 | * @param string $mac |
50 | * @return false|int |
50 | * @return false|int |
51 | */ |
51 | */ |
52 | function eui_bits(string $mac) { |
52 | function eui_bits(string $mac) { |
53 | if (!mac_valid($mac)) return false; |
53 | if (!mac_valid($mac)) return false; |
54 | $mac = mac_canonize($mac, ''); |
54 | $mac = mac_canonize($mac, ''); |
55 | return (int)(strlen($mac)*4); |
55 | return (int)(strlen($mac)*4); |
56 | } |
56 | } |
57 | 57 | ||
58 | /** |
58 | /** |
59 | * Canonizes a MAC, EUI, ELI, AAI, SAI, or IPv6-Link-Local address |
59 | * Canonizes a MAC, EUI, ELI, AAI, SAI, or IPv6-Link-Local address |
60 | * @param string $mac MAC, EUI, ELI, or IPv6-Link-Local Address |
60 | * @param string $mac MAC, EUI, ELI, or IPv6-Link-Local Address |
61 | * @param string $delimiter Desired delimiter for inserting between each octet |
61 | * @param string $delimiter Desired delimiter for inserting between each octet |
62 | * @return string|false The canonized address (Note: IPv6-Link-Local becomes EUI-64) |
62 | * @return string|false The canonized address (Note: IPv6-Link-Local becomes EUI-64) |
63 | */ |
63 | */ |
64 | function mac_canonize(string $mac, string $delimiter="-") { |
64 | function mac_canonize(string $mac, string $delimiter="-") { |
65 | if (!mac_valid($mac)) return false; |
65 | if (!mac_valid($mac)) return false; |
66 | 66 | ||
67 | $tmp = ipv6linklocal_to_mac48($mac); |
67 | $tmp = ipv6linklocal_to_mac48($mac); |
68 | if ($tmp !== false) $mac = $tmp; |
68 | if ($tmp !== false) $mac = $tmp; |
69 | 69 | ||
70 | $mac = strtoupper($mac); |
70 | $mac = strtoupper($mac); |
71 | $mac = preg_replace('@[^0-9A-F]@', '', $mac); |
71 | $mac = preg_replace('@[^0-9A-F]@', '', $mac); |
72 | if ((strlen($mac) != 12) && (strlen($mac) != 16)) return false; |
72 | if ((strlen($mac) != 12) && (strlen($mac) != 16)) return false; |
73 | $mac = preg_replace('@^(..)(..)(..)(..)(..)(..)(..)(..)$@', '\\1'.$delimiter.'\\2'.$delimiter.'\\3'.$delimiter.'\\4'.$delimiter.'\\5'.$delimiter.'\\6'.$delimiter.'\\7'.$delimiter.'\\8', $mac); |
73 | $mac = preg_replace('@^(..)(..)(..)(..)(..)(..)(..)(..)$@', '\\1'.$delimiter.'\\2'.$delimiter.'\\3'.$delimiter.'\\4'.$delimiter.'\\5'.$delimiter.'\\6'.$delimiter.'\\7'.$delimiter.'\\8', $mac); |
74 | return preg_replace('@^(..)(..)(..)(..)(..)(..)$@', '\\1'.$delimiter.'\\2'.$delimiter.'\\3'.$delimiter.'\\4'.$delimiter.'\\5'.$delimiter.'\\6', $mac); |
74 | return preg_replace('@^(..)(..)(..)(..)(..)(..)$@', '\\1'.$delimiter.'\\2'.$delimiter.'\\3'.$delimiter.'\\4'.$delimiter.'\\5'.$delimiter.'\\6', $mac); |
75 | } |
75 | } |
76 | 76 | ||
77 | /** |
77 | /** |
78 | * @param string $file |
78 | * @param string $file |
79 | * @param string $oui_name |
79 | * @param string $oui_name |
80 | * @param string $mac |
80 | * @param string $mac |
81 | * @return false|string |
81 | * @return false|string |
82 | */ |
82 | */ |
83 | function _lookup_ieee_registry(string $file, string $oui_name, string $mac) { |
83 | function _lookup_ieee_registry(string $file, string $oui_name, string $mac) { |
84 | $mac = mac_canonize($mac, ''); |
84 | $mac = mac_canonize($mac, ''); |
85 | if ($mac === false) return false; |
85 | if ($mac === false) return false; |
86 | $begin = substr($mac, 0, 2).'-'.substr($mac, 2, 2).'-'.substr($mac, 4, 2); |
86 | $begin = substr($mac, 0, 2).'-'.substr($mac, 2, 2).'-'.substr($mac, 4, 2); |
87 | $f = file_get_contents($file); |
87 | $f = file_get_contents($file); |
88 | 88 | ||
89 | $f = str_replace("\r", '', $f); |
89 | $f = str_replace("\r", '', $f); |
90 | 90 | ||
91 | # We are using a positive-lookahead because entries like the MA-M references have a blank line between organization and address |
91 | # We are using a positive-lookahead because entries like the MA-M references have a blank line between organization and address |
92 | 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); |
92 | 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); |
93 | foreach ($m as $n) { |
93 | foreach ($m as $n) { |
94 | preg_match('@(\S+)\s+\(base 16\)(.*)$@ism', $n[2], $m); |
94 | preg_match('@(\S+)\s+\(base 16\)(.*)$@ism', $n[2], $m); |
95 | 95 | ||
96 | if (preg_match('@(.+)-(.+)@ism', $m[1], $o)) { |
96 | if (preg_match('@(.+)-(.+)@ism', $m[1], $o)) { |
97 | $z = hexdec(substr($mac, 6, 6)); |
97 | $z = hexdec(substr($mac, 6, 6)); |
98 | $beg = hexdec($o[1]); |
98 | $beg = hexdec($o[1]); |
99 | $end = hexdec($o[2]); |
99 | $end = hexdec($o[2]); |
100 | if (($z < $beg) || ($z > $end)) continue; |
100 | if (($z < $beg) || ($z > $end)) continue; |
101 | } else { |
101 | } else { |
102 | $beg = 0x000000; |
102 | $beg = 0x000000; |
103 | $end = 0xFFFFFF; |
103 | $end = 0xFFFFFF; |
104 | } |
104 | } |
105 | 105 | ||
106 | $x = trim(preg_replace('@^\s+@im', '', $m[2])); |
106 | $x = trim(preg_replace('@^\s+@im', '', $m[2])); |
107 | 107 | ||
108 | # "PRIVATE" entries are only marked at the "(hex)" line, but not at the "(base16)" line |
108 | # "PRIVATE" entries are only marked at the "(hex)" line, but not at the "(base16)" line |
109 | if ($x == '') $x = trim($n[1]); |
109 | if ($x == '') $x = trim($n[1]); |
110 | 110 | ||
111 | $x = explode("\n", $x); |
111 | $x = explode("\n", $x); |
112 | 112 | ||
113 | $ra_len = strlen(dechex($end-$beg)); |
113 | $ra_len = strlen(dechex($end-$beg)); |
114 | 114 | ||
115 | $out = sprintf("%-32s 0x%s\n", "IEEE $oui_name part:", substr($mac, 0, 12-$ra_len)); |
115 | $out = sprintf("%-32s 0x%s\n", "IEEE $oui_name:", substr($mac, 0, 12-$ra_len)); |
116 | $out .= sprintf("%-32s 0x%s\n", "NIC specific part:", substr($mac, 12-$ra_len)); |
116 | $out .= sprintf("%-32s 0x%s\n", "Vendor-specific part:", substr($mac, 12-$ra_len)); |
117 | $out .= sprintf("%-32s %s\n", "Registrant:", $x[0]); |
117 | $out .= sprintf("%-32s %s\n", "Registrant:", $x[0]); |
118 | foreach ($x as $n => $y) { |
118 | foreach ($x as $n => $y) { |
119 | if ($n == 0) continue; |
119 | if ($n == 0) continue; |
120 | else if ($n == 1) $out .= sprintf("%-32s %s\n", "Address of registrant:", $y); |
120 | else if ($n == 1) $out .= sprintf("%-32s %s\n", "Address of registrant:", $y); |
121 | else if ($n >= 2) $out .= sprintf("%-32s %s\n", "", $y); |
121 | else if ($n >= 2) $out .= sprintf("%-32s %s\n", "", $y); |
122 | } |
122 | } |
123 | 123 | ||
124 | return $out; |
124 | return $out; |
125 | } |
125 | } |
126 | 126 | ||
127 | return false; |
127 | return false; |
128 | } |
128 | } |
129 | 129 | ||
130 | /** |
130 | /** |
131 | * Try to Decapsulate EUI-64 into MAC-48 or EUI-48 |
131 | * Try to Decapsulate EUI-64 into MAC-48 or EUI-48 |
132 | * @param string $eui64 |
132 | * @param string $eui64 |
133 | * @return false|string If EUI-64 can be converted into EUI-48, returns EUI-48, otherwise returns EUI-64. On invalid input, return false. |
133 | * @return false|string If EUI-64 can be converted into EUI-48, returns EUI-48, otherwise returns EUI-64. On invalid input, return false. |
134 | */ |
134 | */ |
135 | function eui64_to_eui48(string $eui64) { |
135 | function eui64_to_eui48(string $eui64) { |
136 | if (!mac_valid($eui64)) return false; |
136 | if (!mac_valid($eui64)) return false; |
137 | $eui64 = mac_canonize($eui64, ''); |
137 | $eui64 = mac_canonize($eui64, ''); |
138 | if (eui_bits($eui64) == 48) return mac_canonize($eui64); |
138 | if (eui_bits($eui64) == 48) return mac_canonize($eui64); |
139 | if (($eui64[1] != '0') && ($eui64[1] != '4') && ($eui64[1] != '8') && ($eui64[1] != 'C')) return false; // only allow EUI |
139 | if (($eui64[1] != '0') && ($eui64[1] != '4') && ($eui64[1] != '8') && ($eui64[1] != 'C')) return false; // only allow EUI |
140 | 140 | ||
141 | if (substr($eui64, 6, 4) == 'FFFF') { |
141 | if (substr($eui64, 6, 4) == 'FFFF') { |
142 | // EUI-64 to MAC-48 |
142 | // EUI-64 to MAC-48 |
143 | return mac_canonize(substr($eui64, 0, 6).substr($eui64, 10, 6)); |
143 | return mac_canonize(substr($eui64, 0, 6).substr($eui64, 10, 6)); |
144 | } else if (substr($eui64, 6, 4) == 'FFFE') { |
144 | } else if (substr($eui64, 6, 4) == 'FFFE') { |
145 | if ((hexdec($eui64[1])&2) == 2) { |
145 | if ((hexdec($eui64[1])&2) == 2) { |
146 | // Modified EUI-64 to MAC/EUI-48 |
146 | // Modified EUI-64 to MAC/EUI-48 |
147 | $eui64[1] = dechex(hexdec($eui64[1])&253); // remove bit |
147 | $eui64[1] = dechex(hexdec($eui64[1])&253); // remove bit |
148 | return mac_canonize(substr($eui64, 0, 6).substr($eui64, 10, 6)); |
148 | return mac_canonize(substr($eui64, 0, 6).substr($eui64, 10, 6)); |
149 | } else { |
149 | } else { |
150 | // EUI-64 to EUI-48 |
150 | // EUI-64 to EUI-48 |
151 | return mac_canonize(substr($eui64, 0, 6).substr($eui64, 10, 6)); |
151 | return mac_canonize(substr($eui64, 0, 6).substr($eui64, 10, 6)); |
152 | } |
152 | } |
153 | } else { |
153 | } else { |
154 | return mac_canonize($eui64); |
154 | return mac_canonize($eui64); |
155 | } |
155 | } |
156 | } |
156 | } |
157 | 157 | ||
158 | /** |
158 | /** |
159 | * MAC-48 to EUI-64 Encapsulation |
159 | * MAC-48 to EUI-64 Encapsulation |
160 | * @param string $mac48 MAC-48 address |
160 | * @param string $mac48 MAC-48 address |
161 | * @return false|string EUI-64 address |
161 | * @return false|string EUI-64 address |
162 | */ |
162 | */ |
163 | function mac48_to_eui64(string $mac48) { |
163 | function mac48_to_eui64(string $mac48) { |
164 | // Note: MAC-48 is used for network hardware; EUI-48 is used to identify other devices and software. |
164 | // Note: MAC-48 is used for network hardware; EUI-48 is used to identify other devices and software. |
165 | // MAC48-to-EUI64 Encapsulation uses 0xFFFF middle part |
165 | // MAC48-to-EUI64 Encapsulation uses 0xFFFF middle part |
166 | if (!mac_valid($mac48)) return false; |
166 | if (!mac_valid($mac48)) return false; |
167 | $mac48 = mac_canonize($mac48, ''); |
167 | $mac48 = mac_canonize($mac48, ''); |
168 | if (eui_bits($mac48) == 64) return mac_canonize($mac48); |
168 | if (eui_bits($mac48) == 64) return mac_canonize($mac48); |
169 | if (($mac48[1] != '0') && ($mac48[1] != '4') && ($mac48[1] != '8') && ($mac48[1] != 'C')) return false; // only allow EUI |
169 | if (($mac48[1] != '0') && ($mac48[1] != '4') && ($mac48[1] != '8') && ($mac48[1] != 'C')) return false; // only allow EUI |
170 | 170 | ||
171 | $eui64 = substr($mac48, 0, 6).'FFFF'.substr($mac48, 6, 6); |
171 | $eui64 = substr($mac48, 0, 6).'FFFF'.substr($mac48, 6, 6); |
172 | return mac_canonize($eui64); |
172 | return mac_canonize($eui64); |
173 | } |
173 | } |
174 | 174 | ||
175 | /** |
175 | /** |
176 | * EUI-48 to EUI-64 Encapsulation |
176 | * EUI-48 to EUI-64 Encapsulation |
177 | * @param string $eui48 EUI-48 address |
177 | * @param string $eui48 EUI-48 address |
178 | * @return false|string EUI-64 address |
178 | * @return false|string EUI-64 address |
179 | */ |
179 | */ |
180 | function eui48_to_eui64(string $eui48) { |
180 | function eui48_to_eui64(string $eui48) { |
181 | // Note: MAC-48 is used for network hardware; EUI-48 is used to identify other devices and software. |
181 | // Note: MAC-48 is used for network hardware; EUI-48 is used to identify other devices and software. |
182 | // EUI48-to-EUI64 Encapsulation uses 0xFFFF middle part |
182 | // EUI48-to-EUI64 Encapsulation uses 0xFFFF middle part |
183 | if (!mac_valid($eui48)) return false; |
183 | if (!mac_valid($eui48)) return false; |
184 | $eui48 = mac_canonize($eui48, ''); |
184 | $eui48 = mac_canonize($eui48, ''); |
185 | if (eui_bits($eui48) == 64) return mac_canonize($eui48); |
185 | if (eui_bits($eui48) == 64) return mac_canonize($eui48); |
186 | if (($eui48[1] != '0') && ($eui48[1] != '4') && ($eui48[1] != '8') && ($eui48[1] != 'C')) return false; // only allow EUI |
186 | if (($eui48[1] != '0') && ($eui48[1] != '4') && ($eui48[1] != '8') && ($eui48[1] != 'C')) return false; // only allow EUI |
187 | 187 | ||
188 | $eui64 = substr($eui48, 0, 6).'FFFE'.substr($eui48, 6, 6); |
188 | $eui64 = substr($eui48, 0, 6).'FFFE'.substr($eui48, 6, 6); |
189 | return mac_canonize($eui64); |
189 | return mac_canonize($eui64); |
190 | } |
190 | } |
191 | 191 | ||
192 | /** |
192 | /** |
193 | * MAC/EUI-48 to Modified EUI-64 Encapsulation |
193 | * MAC/EUI-48 to Modified EUI-64 Encapsulation |
194 | * @param string $eui48 MAC-48 or EUI-48 address |
194 | * @param string $eui48 MAC-48 or EUI-48 address |
195 | * @return false|string Modified EUI-64 address |
195 | * @return false|string Modified EUI-64 address |
196 | */ |
196 | */ |
197 | function maceui48_to_modeui64(string $eui48) { |
197 | function maceui48_to_modeui64(string $eui48) { |
198 | // Note: MAC-48 is used for network hardware; EUI-48 is used to identify other devices and software. |
198 | // Note: MAC-48 is used for network hardware; EUI-48 is used to identify other devices and software. |
199 | // EUI48-to-ModifiedEUI64 Encapsulation uses 0xFFFE middle part (SIC! This was a mistake by IETF, since it should actually be 0xFFFF!) |
199 | // EUI48-to-ModifiedEUI64 Encapsulation uses 0xFFFE middle part (SIC! This was a mistake by IETF, since it should actually be 0xFFFF!) |
200 | if (!mac_valid($eui48)) return false; |
200 | if (!mac_valid($eui48)) return false; |
201 | $eui48 = mac_canonize($eui48, ''); |
201 | $eui48 = mac_canonize($eui48, ''); |
202 | if (eui_bits($eui48) == 64) return mac_canonize($eui48); |
202 | if (eui_bits($eui48) == 64) return mac_canonize($eui48); |
203 | if (($eui48[1] != '0') && ($eui48[1] != '4') && ($eui48[1] != '8') && ($eui48[1] != 'C')) return false; // only allow EUI |
203 | if (($eui48[1] != '0') && ($eui48[1] != '4') && ($eui48[1] != '8') && ($eui48[1] != 'C')) return false; // only allow EUI |
204 | 204 | ||
205 | $eui64 = substr($eui48, 0, 6).'FFFE'.substr($eui48, 6, 6); |
205 | $eui64 = substr($eui48, 0, 6).'FFFE'.substr($eui48, 6, 6); |
206 | 206 | ||
207 | $eui64[1] = dechex(hexdec($eui64[1]) | 2); // flip seventh bit |
207 | $eui64[1] = dechex(hexdec($eui64[1]) | 2); // flip seventh bit |
208 | 208 | ||
209 | return mac_canonize($eui64); |
209 | return mac_canonize($eui64); |
210 | } |
210 | } |
211 | 211 | ||
212 | /** |
212 | /** |
213 | * Try to convert IPv6-Link-Local address to MAC-48 |
213 | * Try to convert IPv6-Link-Local address to MAC-48 |
214 | * @param string $ipv6 IPv6-Link-Local address |
214 | * @param string $ipv6 IPv6-Link-Local address |
215 | * @return false|string MAC-48 (or IPv6 if it was no LinkLocal address, or Modified EUI-64 if it decapsulation failed) |
215 | * @return false|string MAC-48 (or IPv6 if it was no LinkLocal address, or Modified EUI-64 if it decapsulation failed) |
216 | */ |
216 | */ |
217 | function ipv6linklocal_to_mac48(string $ipv6) { |
217 | function ipv6linklocal_to_mac48(string $ipv6) { |
218 | // https://stackoverflow.com/questions/12095835/quick-way-of-expanding-ipv6-addresses-with-php (modified) |
218 | // https://stackoverflow.com/questions/12095835/quick-way-of-expanding-ipv6-addresses-with-php (modified) |
219 | $tmp = inet_pton($ipv6); |
219 | $tmp = inet_pton($ipv6); |
220 | if ($tmp === false) return false; |
220 | if ($tmp === false) return false; |
221 | $hex = unpack("H*hex", $tmp); |
221 | $hex = unpack("H*hex", $tmp); |
222 | $ipv6 = substr(preg_replace("/([A-f0-9]{4})/", "$1:", $hex['hex']), 0, -1); |
222 | $ipv6 = substr(preg_replace("/([A-f0-9]{4})/", "$1:", $hex['hex']), 0, -1); |
223 | 223 | ||
224 | // Remove "fe80::" to convert IPv6-Link-Local address back to EUI-64 |
224 | // Remove "fe80::" to convert IPv6-Link-Local address back to EUI-64 |
225 | // see https://support.lenovo.com/de/de/solutions/ht509925-how-to-convert-a-mac-address-into-an-ipv6-link-local-address-eui-64 |
225 | // see https://support.lenovo.com/de/de/solutions/ht509925-how-to-convert-a-mac-address-into-an-ipv6-link-local-address-eui-64 |
226 | $cnt = 0; |
226 | $cnt = 0; |
227 | $mac = preg_replace('@^fe80:0000:0000:0000:@i', '', $ipv6, -1, $cnt); |
227 | $mac = preg_replace('@^fe80:0000:0000:0000:@i', '', $ipv6, -1, $cnt); |
228 | if ($cnt == 0) return false; |
228 | if ($cnt == 0) return false; |
229 | 229 | ||
230 | // Set LAA to UAA again |
230 | // Set LAA to UAA again |
231 | $mac_uaa_64 = $mac; |
231 | $mac_uaa_64 = $mac; |
232 | $mac_uaa_64[1] = dechex(hexdec($mac_uaa_64[1]) & 253); |
232 | $mac_uaa_64[1] = dechex(hexdec($mac_uaa_64[1]) & 253); |
233 | 233 | ||
234 | $mac_uaa_48 = eui64_to_eui48($mac_uaa_64); |
234 | $mac_uaa_48 = eui64_to_eui48($mac_uaa_64); |
235 | if (eui_bits($mac_uaa_48) == 48) { |
235 | if (eui_bits($mac_uaa_48) == 48) { |
236 | return $mac_uaa_48; // Output MAC-48 (UAA) |
236 | return $mac_uaa_48; // Output MAC-48 (UAA) |
237 | } else { |
237 | } else { |
238 | return $mac; // Failed decapsulation; output Modified EUI-64 instead |
238 | return $mac; // Failed decapsulation; output Modified EUI-64 instead |
239 | } |
239 | } |
240 | } |
240 | } |
241 | 241 | ||
242 | /** |
242 | /** |
243 | * Converts MAC-48 or EUI-48 to IPv6-Link-Local (based on Modified EUI-64) |
243 | * Converts MAC-48 or EUI-48 to IPv6-Link-Local (based on Modified EUI-64) |
244 | * @param string $mac |
244 | * @param string $mac |
245 | * @return false|string |
245 | * @return false|string |
246 | */ |
246 | */ |
247 | function maceui_to_ipv6linklocal(string $mac) { |
247 | function maceui_to_ipv6linklocal(string $mac) { |
248 | if (!mac_valid($mac)) return false; |
248 | if (!mac_valid($mac)) return false; |
249 | if (eui_bits($mac) == 48) { |
249 | if (eui_bits($mac) == 48) { |
250 | $mac = maceui48_to_modeui64($mac); |
250 | $mac = maceui48_to_modeui64($mac); |
251 | } |
251 | } |
252 | $mac = mac_canonize($mac, ''); |
252 | $mac = mac_canonize($mac, ''); |
253 | $mac = str_pad($mac, 16, '0', STR_PAD_LEFT); |
253 | $mac = str_pad($mac, 16, '0', STR_PAD_LEFT); |
254 | return strtolower('fe80::'.substr($mac,0, 4).':'.substr($mac,4, 4).':'.substr($mac,8, 4).':'.substr($mac,12, 4)); |
254 | return strtolower('fe80::'.substr($mac,0, 4).':'.substr($mac,4, 4).':'.substr($mac,8, 4).':'.substr($mac,12, 4)); |
255 | } |
255 | } |
256 | 256 | ||
257 | /** |
257 | /** |
258 | * @param string $mac |
258 | * @param string $mac |
259 | * @return string |
259 | * @return string |
260 | * @throws Exception |
260 | * @throws Exception |
261 | */ |
261 | */ |
262 | function mac_type(string $mac): string { |
262 | function mac_type(string $mac): string { |
263 | // Format MAC for machine readability |
263 | // Format MAC for machine readability |
264 | $mac = mac_canonize($mac, ''); |
264 | $mac = mac_canonize($mac, ''); |
265 | 265 | ||
266 | /** |
266 | /** |
267 | * |
267 | * |
268 | * ZYXM |
268 | * ZYXM |
269 | * 0 0000 EUI (OUI) |
269 | * 0 0000 EUI (OUI) |
270 | * 1 0001 |
270 | * 1 0001 [Multicast] |
271 | * 2 0010 AAI |
271 | * 2 0010 AAI |
272 | * 3 0011 |
272 | * 3 0011 [Multicast] |
273 | * 4 0100 EUI (OUI) |
273 | * 4 0100 EUI (OUI) |
274 | * 5 0101 |
274 | * 5 0101 [Multicast] |
275 | * 6 0110 Reserved |
275 | * 6 0110 Reserved |
276 | * 7 0111 |
276 | * 7 0111 [Multicast] |
277 | * 8 1000 EUI (OUI) |
277 | * 8 1000 EUI (OUI) |
278 | * 9 1001 |
278 | * 9 1001 [Multicast] |
279 | * A 1010 ELI (CID) |
279 | * A 1010 ELI (CID) |
280 | * B 1011 |
280 | * B 1011 [Multicast] |
281 | * C 1100 EUI (OUI) |
281 | * C 1100 EUI (OUI) |
282 | * D 1101 |
282 | * D 1101 [Multicast] |
283 | * E 1110 SAI |
283 | * E 1110 SAI |
284 | * F 1111 |
284 | * F 1111 [Multicast] |
285 | * |
285 | * |
286 | */ |
286 | */ |
287 | 287 | ||
288 | $type = ''; |
288 | $type = ''; |
289 | $tmp = ipv6linklocal_to_mac48($mac); |
289 | $tmp = ipv6linklocal_to_mac48($mac); |
290 | if ($tmp !== false) { |
290 | if ($tmp !== false) { |
291 | $mac = $tmp; |
291 | $mac = $tmp; |
292 | $type = 'IPv6-Link-Local'; |
292 | $type = 'IPv6-Link-Local'; |
293 | } |
293 | } |
294 | if (!mac_valid($mac)) throw new Exception("Invalid MAC address"); |
294 | if (!mac_valid($mac)) throw new Exception("Invalid MAC address"); |
295 | if ($tmp === false) { |
295 | if ($tmp === false) { |
296 | if ($mac[1] == '2') { |
296 | if (($mac[1] == '2') || ($mac[1] == '3')) { |
297 | /* |
297 | /* |
298 | * AAI: Administratively Assigned Identifier |
298 | * AAI: Administratively Assigned Identifier |
299 | * Administrators who wish to assign local MAC addresses in an |
299 | * Administrators who wish to assign local MAC addresses in an |
300 | * arbitrary fashion (for example, randomly) and yet maintain |
300 | * arbitrary fashion (for example, randomly) and yet maintain |
301 | * compatibility with other assignment protocols operating under the |
301 | * compatibility with other assignment protocols operating under the |
302 | * SLAP on the same LAN may assign a local MAC address as AAI. |
302 | * SLAP on the same LAN may assign a local MAC address as AAI. |
303 | */ |
303 | */ |
304 | $type = 'AAI-' . eui_bits($mac).' (Administratively Assigned Identifier)'; |
304 | $type = 'AAI-' . eui_bits($mac).' (Administratively Assigned Identifier)'; |
305 | } else if ($mac[1] == '6') { |
305 | } else if (($mac[1] == '6') || ($mac[1] == '7')) { |
306 | /* |
306 | /* |
307 | * Reserved |
307 | * Reserved |
308 | * may be administratively used and assigned in accordance with the |
308 | * may be administratively used and assigned in accordance with the |
309 | * considerations specified for AAI usage, without effect on SLAP |
309 | * considerations specified for AAI usage, without effect on SLAP |
310 | * assignments. However, administrators should be cognizant of |
310 | * assignments. However, administrators should be cognizant of |
311 | * possible future specifications… that would render administrative |
311 | * possible future specifications… that would render administrative |
312 | * assignment incompatible with the SLAP. |
312 | * assignment incompatible with the SLAP. |
313 | */ |
313 | */ |
314 | $type = 'Reserved-' . eui_bits($mac); |
314 | $type = 'Reserved-' . eui_bits($mac); |
315 | } else if ($mac[1] == 'A') { |
315 | } else if (($mac[1] == 'A') || ($mac[1] == 'B')) { |
316 | /* |
316 | /* |
317 | * ELI: Extended Local Identifier |
317 | * ELI: Extended Local Identifier |
318 | * An ELI is based on a 24 bit CID |
318 | * An ELI is based on a 24 bit CID |
319 | * A CID has ZYXM bits set to 1010 (0b1010 = 0xA) |
319 | * A CID has ZYXM bits set to 1010 (0b1010 = 0xA) |
320 | * Since X=1 (U/L=1), the CID cannot be used to form a universal UAA MAC (only a local LAA MAC) |
320 | * Since X=1 (U/L=1), the CID cannot be used to form a universal UAA MAC (only a local LAA MAC) |
321 | */ |
321 | */ |
322 | $type = 'ELI-' . eui_bits($mac).' (Extended Local Identifier)'; |
322 | $type = 'ELI-' . eui_bits($mac).' (Extended Local Identifier)'; |
323 | } else if ($mac[1] == 'E') { |
323 | } else if (($mac[1] == 'E') || ($mac[1] == 'F')) { |
324 | /* |
324 | /* |
325 | * SAI: Standard Assigned Identifier |
325 | * SAI: Standard Assigned Identifier |
326 | * Specification of the use of the SAI quadrant for SLAP address |
326 | * Specification of the use of the SAI quadrant for SLAP address |
327 | * assignments is reserved for the standard forthcoming from IEEE |
327 | * assignments is reserved for the standard forthcoming from IEEE |
328 | * P802.1CQ. |
328 | * P802.1CQ. |
329 | * An SAI is assigned by a protocol specified in an IEEE 802 standard. |
329 | * An SAI is assigned by a protocol specified in an IEEE 802 standard. |
330 | * Multiple protocols for assigning SAI may be specified within various |
330 | * Multiple protocols for assigning SAI may be specified within various |
331 | * IEEE 802 standards. Coexistence of such protocols may be supported |
331 | * IEEE 802 standards. Coexistence of such protocols may be supported |
332 | * by restricting each to assignments within a subspace of SAI space. |
332 | * by restricting each to assignments within a subspace of SAI space. |
333 | * In some cases, an SAI assignment protocol may assign the SAI to convey |
333 | * In some cases, an SAI assignment protocol may assign the SAI to convey |
334 | * specific information. Such information may be interpreted by receivers |
334 | * specific information. Such information may be interpreted by receivers |
335 | * and bridges that recognize the specific SAI assignment protocol, as |
335 | * and bridges that recognize the specific SAI assignment protocol, as |
336 | * identified by the subspace of the SAI. The functionality of receivers |
336 | * identified by the subspace of the SAI. The functionality of receivers |
337 | * and bridges that do not recognize the protocol is not affected. |
337 | * and bridges that do not recognize the protocol is not affected. |
338 | */ |
338 | */ |
339 | $type = 'SAI-' . eui_bits($mac).' (Standard Assigned Identifier)'; |
339 | $type = 'SAI-' . eui_bits($mac).' (Standard Assigned Identifier)'; |
340 | } else if ((hexdec($mac[1])&1) == 1) { |
340 | } else { |
341 | $type = 'Multicast MAC-'.eui_bits($mac); |
- | |
342 | } else if (($mac[1] == '0') || ($mac[1] == '4') || ($mac[1] == '8') || ($mac[1] == 'C')) { |
- | |
343 | /* |
341 | /* |
344 | * Extended Unique Identifier |
342 | * Extended Unique Identifier |
345 | * Based on an OUI-24, OUI-28, or OUI-36 |
343 | * Based on an OUI-24, OUI-28, or OUI-36 |
346 | */ |
344 | */ |
347 | if (eui_bits($mac) == 48) { |
345 | if (eui_bits($mac) == 48) { |
348 | // The name "MAC-48" has been deprecated by IEEE |
346 | // The name "MAC-48" has been deprecated by IEEE |
349 | //$type = 'MAC-48 (network hardware) or EUI-48 (other devices and software)'; |
347 | //$type = 'MAC-48 (network hardware) or EUI-48 (other devices and software)'; |
350 | $type = 'EUI-48 (Extended Unique Identifier)'; |
348 | $type = 'EUI-48 (Extended Unique Identifier)'; |
351 | } else if (eui_bits($mac) == 64) { |
349 | } else if (eui_bits($mac) == 64) { |
352 | if (substr($mac, 6, 4) == 'FFFE') { |
350 | if (substr($mac, 6, 4) == 'FFFE') { |
353 | if ((hexdec($mac[1]) & 2) == 2) { |
351 | if ((hexdec($mac[1]) & 2) == 2) { |
354 | $type = 'EUI-64 (Extended Unique Identifier, MAC/EUI-48 to Modified EUI-64 Encapsulation)'; |
352 | $type = 'EUI-64 (Extended Unique Identifier, MAC/EUI-48 to Modified EUI-64 Encapsulation)'; |
355 | } else { |
353 | } else { |
356 | $type = 'EUI-64 (Extended Unique Identifier, EUI-48 to EUI-64 Encapsulation)'; |
354 | $type = 'EUI-64 (Extended Unique Identifier, EUI-48 to EUI-64 Encapsulation)'; |
357 | } |
355 | } |
358 | } else if (substr($mac, 6, 4) == 'FFFF') { |
356 | } else if (substr($mac, 6, 4) == 'FFFF') { |
359 | $type = 'EUI-64 (Extended Unique Identifier, MAC-48 to EUI-64 Encapsulation)'; |
357 | $type = 'EUI-64 (Extended Unique Identifier, MAC-48 to EUI-64 Encapsulation)'; |
360 | } else { |
358 | } else { |
361 | $type = 'EUI-64 (Extended Unique Identifier)'; |
359 | $type = 'EUI-64 (Extended Unique Identifier)'; |
362 | } |
360 | } |
363 | } else { |
361 | } else { |
364 | assert(false); /** @phpstan-ignore-line */ |
362 | assert(false); /** @phpstan-ignore-line */ |
365 | } |
363 | } |
366 | } |
364 | } |
367 | } |
365 | } |
- | 366 | ||
- | 367 | if ((hexdec($mac[1])&1) == 1) { |
|
- | 368 | // Question: https://networkengineering.stackexchange.com/questions/83121/can-eli-aai-sai-addresses-be-multicast |
|
- | 369 | // Are there "Multicast ELI", "Multicast AAI", "Multicast SAI"? |
|
- | 370 | // Some documents of IEEE suggest this, but I am not 100% sure! |
|
- | 371 | ||
- | 372 | /* https://standards.ieee.org/wp-content/uploads/import/documents/tutorials/eui.pdf writes: |
|
- | 373 | * - The assignee of an OUI or OUI-36 is exclusively authorized to assign group |
|
- | 374 | * MAC addresses, with I/G=1, by extending a modified version of the assigned |
|
- | 375 | * OUI or OUI-36 in which the M bit is set to 1. Such addresses are not EUIs and |
|
- | 376 | * do not globally identify hardware instances, even though U/L=0. |
|
- | 377 | * - The assignee of a CID may assign local group MAC addresses by extending a modified version of |
|
- | 378 | * the assigned CID by setting the M bit to 1 (so that I/G=1). The resulting |
|
- | 379 | * extended identifier is an ELI. |
|
- | 380 | */ |
|
- | 381 | ||
- | 382 | // TODO: If "Multicast EUI" is not an EUI, how should we name it instead?! |
|
- | 383 | $type = "Multicast $type"; |
|
- | 384 | } |
|
- | 385 | ||
368 | return $type; |
386 | return $type; |
369 | } |
387 | } |
370 | 388 | ||
371 | /** |
389 | /** |
372 | * Prints information about an IPv6-Link-Local address, MAC, EUI, ELI, AAI, or SAI. |
390 | * Prints information about an IPv6-Link-Local address, MAC, EUI, ELI, AAI, or SAI. |
373 | * @param string $mac IPv6-Link-Local address, MAC, EUI, ELI, AAI, or SAI |
391 | * @param string $mac IPv6-Link-Local address, MAC, EUI, ELI, AAI, or SAI |
374 | * @return void |
392 | * @return void |
375 | * @throws Exception |
393 | * @throws Exception |
376 | */ |
394 | */ |
377 | function decode_mac(string $mac) { |
395 | function decode_mac(string $mac) { |
378 | 396 | ||
379 | // TODO: Should we decode Multicast MAC to its IP (see https://ipcisco.com/lesson/multicast-mac-addresses/)? |
397 | // TODO: Should we decode Multicast MAC to its IP (see https://ipcisco.com/lesson/multicast-mac-addresses/)? |
380 | // TODO: Is an ELI with M=1 a Multicast-ELI, or isn't it an ELI anymore? Same question for SAI and AAI |
- | |
381 | 398 | ||
382 | echo sprintf("%-32s %s\n", "Input:", $mac); |
399 | echo sprintf("%-32s %s\n", "Input:", $mac); |
383 | 400 | ||
384 | // Format MAC for machine readability |
401 | // Format MAC for machine readability |
385 | $mac = mac_canonize($mac, ''); |
402 | $mac = mac_canonize($mac, ''); |
386 | 403 | ||
387 | $type = mac_type($mac); |
404 | $type = mac_type($mac); |
388 | echo sprintf("%-32s %s\n", "Type:", $type); |
405 | echo sprintf("%-32s %s\n", "Type:", $type); |
389 | 406 | ||
390 | echo "\n"; |
407 | echo "\n"; |
391 | 408 | ||
392 | // Show various representations |
409 | // Show various representations |
393 | if ($mac[1] == 'A') { |
410 | if ($mac[1] == 'A') { |
394 | // Note: There does not seem to exist an algorithm for encapsulating/converting ELI-48 <=> ELI-64 |
411 | // Note: There does not seem to exist an algorithm for encapsulating/converting ELI-48 <=> ELI-64 |
395 | echo sprintf("%-32s %s\n", "ELI-".eui_bits($mac).":", mac_canonize($mac)); |
412 | echo sprintf("%-32s %s\n", "ELI-".eui_bits($mac).":", mac_canonize($mac)); |
396 | $mac48 = eui64_to_eui48($mac); |
413 | $mac48 = eui64_to_eui48($mac); |
397 | echo sprintf("%-32s %s\n", "MAC-48 (Local):", (eui_bits($mac48) != 48) ? 'Not available' : $mac48); |
414 | echo sprintf("%-32s %s\n", "MAC-48 (Local):", (eui_bits($mac48) != 48) ? 'Not available' : $mac48); |
398 | } else if (($mac[1] == '0') || ($mac[1] == '4') || ($mac[1] == '8') || ($mac[1] == 'C')) { |
415 | } else if (($mac[1] == '0') || ($mac[1] == '4') || ($mac[1] == '8') || ($mac[1] == 'C')) { |
399 | $eui48 = eui64_to_eui48($mac); |
416 | $eui48 = eui64_to_eui48($mac); |
400 | echo sprintf("%-32s %s\n", "EUI-48 or MAC-48:", (eui_bits($eui48) != 48) ? 'Not available' : $eui48); |
417 | echo sprintf("%-32s %s\n", "EUI-48 or MAC-48:", (eui_bits($eui48) != 48) ? 'Not available' : $eui48); |
401 | if (eui_bits($mac) == 48) { |
418 | if (eui_bits($mac) == 48) { |
402 | $eui64 = mac48_to_eui64($mac); |
419 | $eui64 = mac48_to_eui64($mac); |
403 | echo sprintf("%-32s %s\n", "EUI-64:", ((eui_bits($eui64) != 64) ? 'Not available' : $eui64).' (MAC-48 to EUI-64 Encapsulation)'); |
420 | echo sprintf("%-32s %s\n", "EUI-64:", ((eui_bits($eui64) != 64) ? 'Not available' : $eui64).' (MAC-48 to EUI-64 Encapsulation)'); |
404 | $eui64 = eui48_to_eui64($mac); |
421 | $eui64 = eui48_to_eui64($mac); |
405 | echo sprintf("%-32s %s\n", "", ((eui_bits($eui64) != 64) ? 'Not available' : $eui64).' (EUI-48 to EUI-64 Encapsulation)'); |
422 | echo sprintf("%-32s %s\n", "", ((eui_bits($eui64) != 64) ? 'Not available' : $eui64).' (EUI-48 to EUI-64 Encapsulation)'); |
406 | $eui64 = maceui48_to_modeui64($mac); |
423 | $eui64 = maceui48_to_modeui64($mac); |
407 | echo sprintf("%-32s %s\n", "", ((eui_bits($eui64) != 64) ? 'Not available' : $eui64).' (MAC/EUI-48 to Modified EUI-64 Encapsulation)'); |
424 | echo sprintf("%-32s %s\n", "", ((eui_bits($eui64) != 64) ? 'Not available' : $eui64).' (MAC/EUI-48 to Modified EUI-64 Encapsulation)'); |
408 | $ipv6 = maceui_to_ipv6linklocal($mac); |
425 | $ipv6 = maceui_to_ipv6linklocal($mac); |
409 | echo sprintf("%-32s %s\n", "IPv6-Link-Local address:", $ipv6); |
426 | echo sprintf("%-32s %s\n", "IPv6-Link-Local address:", $ipv6); |
410 | } else { |
427 | } else { |
411 | $eui64 = mac_canonize($mac); |
428 | $eui64 = mac_canonize($mac); |
412 | echo sprintf("%-32s %s\n", "EUI-64:", $eui64); |
429 | echo sprintf("%-32s %s\n", "EUI-64:", $eui64); |
413 | } |
430 | } |
414 | } |
431 | } |
415 | 432 | ||
416 | // Vergabestelle |
433 | // Vergabestelle |
417 | $ul = hexdec($mac[1]) & 2; // Bit #LSB+1 of Byte 1 |
434 | $ul = hexdec($mac[1]) & 2; // Bit #LSB+1 of Byte 1 |
418 | $ul_ = ($ul == 0) ? '[0] Universally Administered Address (UAA)' : '[1] Locally Administered Address (LAA)'; |
435 | $ul_ = ($ul == 0) ? '[0] Universally Administered Address (UAA)' : '[1] Locally Administered Address (LAA)'; |
419 | echo sprintf("%-32s %s\n", "Administration type (U/L flag):", $ul_); |
436 | echo sprintf("%-32s %s\n", "Administration type (U/L flag):", $ul_); |
420 | 437 | ||
421 | // Empfaengergruppe |
438 | // Empfaengergruppe |
422 | $ig = hexdec($mac[1]) & 1; // Bit #LSB+0 of Byte 1 |
439 | $ig = hexdec($mac[1]) & 1; // Bit #LSB+0 of Byte 1 |
423 | $ig_ = ($ig == 0) ? '[0] Unicast (Individual)' : '[1] Multicast (Group)'; |
440 | $ig_ = ($ig == 0) ? '[0] Unicast (Individual)' : '[1] Multicast (Group)'; |
424 | echo sprintf("%-32s %s\n", "Transmission type (I/G flag):", $ig_); |
441 | echo sprintf("%-32s %s\n", "Transmission type (I/G flag):", $ig_); |
425 | 442 | ||
426 | // Query IEEE registries |
443 | // Query IEEE registries |
427 | if (count(glob(IEEE_MAC_REGISTRY.DIRECTORY_SEPARATOR.'*.txt')) > 0) { |
444 | if (count(glob(IEEE_MAC_REGISTRY.DIRECTORY_SEPARATOR.'*.txt')) > 0) { |
- | 445 | $alt_mac = $mac; |
|
- | 446 | $alt_mac[1] = dechex(hexdec($alt_mac[1])^1); // switch Unicat<=>Multicast in order to find the vendor |
|
- | 447 | ||
428 | if ($mac[1] == 'A') { |
448 | if ($mac[1] == 'A') { |
429 | // Query the CID registry |
449 | // Query the CID registry |
430 | if ( |
450 | if ( |
431 | ($x = _lookup_ieee_registry(IEEE_MAC_REGISTRY . DIRECTORY_SEPARATOR . 'cid.txt', 'CID', $mac)) |
451 | ($x = _lookup_ieee_registry(IEEE_MAC_REGISTRY . DIRECTORY_SEPARATOR . 'cid.txt', 'CID', $mac)) || |
- | 452 | ($x = _lookup_ieee_registry(IEEE_MAC_REGISTRY . DIRECTORY_SEPARATOR . 'cid.txt', 'CID', $alt_mac)) |
|
432 | ) { |
453 | ) { |
433 | echo $x; |
454 | echo $x; |
434 | } |
455 | } |
435 | } else { |
456 | } else { |
436 | // Query the OUI registries |
457 | // Query the OUI registries |
437 | // TODO: Should we try to convert Unicast<=>Multicast if one of them can't be found? |
- | |
438 | if ( |
458 | if ( |
439 | # 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] |
459 | # 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] |
440 | # 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. |
460 | # 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. |
441 | ($x = _lookup_ieee_registry(IEEE_MAC_REGISTRY . DIRECTORY_SEPARATOR . 'iab.txt', 'IAB', $mac)) || |
461 | ($x = _lookup_ieee_registry(IEEE_MAC_REGISTRY . DIRECTORY_SEPARATOR . 'iab.txt', 'IAB', $mac)) || |
442 | ($x = _lookup_ieee_registry(IEEE_MAC_REGISTRY . DIRECTORY_SEPARATOR . 'oui36.txt', 'OUI-36 (MA-S)', $mac)) || |
462 | ($x = _lookup_ieee_registry(IEEE_MAC_REGISTRY . DIRECTORY_SEPARATOR . 'oui36.txt', 'OUI-36 (MA-S)', $mac)) || |
- | 463 | ($x = _lookup_ieee_registry(IEEE_MAC_REGISTRY . DIRECTORY_SEPARATOR . 'mam.txt', '28 bit identifier (MA-M)', $mac)) || |
|
443 | ($x = _lookup_ieee_registry(IEEE_MAC_REGISTRY . DIRECTORY_SEPARATOR . 'mam.txt', 'OUI-28 (MA-M)', $mac)) || |
464 | ($x = _lookup_ieee_registry(IEEE_MAC_REGISTRY . DIRECTORY_SEPARATOR . 'oui.txt', 'OUI (MA-L)', $mac)) || |
- | 465 | ($x = _lookup_ieee_registry(IEEE_MAC_REGISTRY . DIRECTORY_SEPARATOR . 'iab.txt', 'IAB', $alt_mac)) || |
|
- | 466 | ($x = _lookup_ieee_registry(IEEE_MAC_REGISTRY . DIRECTORY_SEPARATOR . 'oui36.txt', 'OUI-36 (MA-S)', $alt_mac)) || |
|
- | 467 | ($x = _lookup_ieee_registry(IEEE_MAC_REGISTRY . DIRECTORY_SEPARATOR . 'mam.txt', '28 bit identifier (MA-M)', $alt_mac)) || |
|
444 | ($x = _lookup_ieee_registry(IEEE_MAC_REGISTRY . DIRECTORY_SEPARATOR . 'oui.txt', 'OUI-24 (MA-L)', $mac)) |
468 | ($x = _lookup_ieee_registry(IEEE_MAC_REGISTRY . DIRECTORY_SEPARATOR . 'oui.txt', 'OUI (MA-L)', $alt_mac)) |
445 | ) { |
469 | ) { |
446 | echo $x; |
470 | echo $x; |
447 | } |
471 | } |
448 | } |
472 | } |
449 | } |
473 | } |
450 | 474 | ||
451 | $vm = ''; |
475 | $vm = ''; |
452 | // === FAQ "Detection rules which don't have their dedicated page yet" === |
476 | // === FAQ "Detection rules which don't have their dedicated page yet" === |
453 | // https://wiki.xenproject.org/wiki/Xen_Networking |
477 | // https://wiki.xenproject.org/wiki/Xen_Networking |
454 | // https://mcpmag.com/articles/2007/11/27/hey-vm-whats-your-hypervisor.aspx |
478 | // https://mcpmag.com/articles/2007/11/27/hey-vm-whats-your-hypervisor.aspx |
455 | // https://www.techrepublic.com/blog/data-center/mac-address-scorecard-for-common-virtual-machine-platforms |
479 | // https://www.techrepublic.com/blog/data-center/mac-address-scorecard-for-common-virtual-machine-platforms |
456 | if (mac_between($mac, '00:16:3E:00:00:00', '00:16:3E:FF:FF:FF')) $vm = "Red Hat Xen, XenSource, Novell Xen"; |
480 | if (mac_between($mac, '00:16:3E:00:00:00', '00:16:3E:FF:FF:FF')) $vm = "Red Hat Xen, XenSource, Novell Xen"; |
457 | // http://techgenix.com/mac-address-pool-duplication-hyper-v/ |
481 | // http://techgenix.com/mac-address-pool-duplication-hyper-v/ |
458 | // https://docs.microsoft.com/en-us/system-center/vmm/network-mac?view=sc-vmm-1807 |
482 | // https://docs.microsoft.com/en-us/system-center/vmm/network-mac?view=sc-vmm-1807 |
459 | // https://blogs.technet.microsoft.com/gbanin/2014/08/27/how-to-solve-mac-address-conflict-on-hyper-v/ |
483 | // https://blogs.technet.microsoft.com/gbanin/2014/08/27/how-to-solve-mac-address-conflict-on-hyper-v/ |
460 | if (mac_between($mac, '00:1D:D8:B7:1C:00', '00:1D:D8:F4:1F:FF')) $vm = "Microsoft SCVMM (System Center Virtual Machine Manager)"; |
484 | if (mac_between($mac, '00:1D:D8:B7:1C:00', '00:1D:D8:F4:1F:FF')) $vm = "Microsoft SCVMM (System Center Virtual Machine Manager)"; |
461 | // https://mcpmag.com/articles/2007/11/27/hey-vm-whats-your-hypervisor.aspx |
485 | // https://mcpmag.com/articles/2007/11/27/hey-vm-whats-your-hypervisor.aspx |
462 | // https://www.techrepublic.com/blog/data-center/mac-address-scorecard-for-common-virtual-machine-platforms/ |
486 | // https://www.techrepublic.com/blog/data-center/mac-address-scorecard-for-common-virtual-machine-platforms/ |
463 | // https://blogs.technet.microsoft.com/medv/2011/01/24/how-to-manage-vm-mac-addresses-with-the-globalimagedata-xml-file-in-med-v-v1/ |
487 | // https://blogs.technet.microsoft.com/medv/2011/01/24/how-to-manage-vm-mac-addresses-with-the-globalimagedata-xml-file-in-med-v-v1/ |
464 | if (mac_between($mac, '00:03:FF:00:00:00', '00:03:FF:FF:FF:FF')) $vm = "Microsoft Virtual PC / Virtual Server"; |
488 | if (mac_between($mac, '00:03:FF:00:00:00', '00:03:FF:FF:FF:FF')) $vm = "Microsoft Virtual PC / Virtual Server"; |
465 | // https://mcpmag.com/articles/2007/11/27/hey-vm-whats-your-hypervisor.aspx |
489 | // https://mcpmag.com/articles/2007/11/27/hey-vm-whats-your-hypervisor.aspx |
466 | if (mac_between($mac, '00:18:51:00:00:00', '00:18:51:FF:FF:FF')) $vm = "SWsoft"; |
490 | if (mac_between($mac, '00:18:51:00:00:00', '00:18:51:FF:FF:FF')) $vm = "SWsoft"; |
467 | // https://macaddress.io/statistics/company/17619 |
491 | // https://macaddress.io/statistics/company/17619 |
468 | if (mac_between($mac, '58:9C:FC:00:00:00', '58:9C:FC:FF:FF:FF')) $vm = "bhyve by FreebsdF"; |
492 | if (mac_between($mac, '58:9C:FC:00:00:00', '58:9C:FC:FF:FF:FF')) $vm = "bhyve by FreebsdF"; |
469 | // https://macaddress.io/statistics/company/17388 |
493 | // https://macaddress.io/statistics/company/17388 |
470 | if (mac_between($mac, '50:6B:8D:00:00:00', '50:6B:8D:FF:FF:FF')) $vm = "Nutanix AHV"; |
494 | if (mac_between($mac, '50:6B:8D:00:00:00', '50:6B:8D:FF:FF:FF')) $vm = "Nutanix AHV"; |
471 | // https://www.centos.org/forums/viewtopic.php?t=26739 |
495 | // https://www.centos.org/forums/viewtopic.php?t=26739 |
472 | if (mac_between($mac, '54:52:00:00:00:00', '54:52:FF:FF:FF:FF')) $vm = "KVM (proxmox)"; |
496 | if (mac_between($mac, '54:52:00:00:00:00', '54:52:FF:FF:FF:FF')) $vm = "KVM (proxmox)"; |
473 | // Self tested (alldatafeeds.com) |
497 | // Self tested (alldatafeeds.com) |
474 | if (mac_between($mac, '96:00:00:00:00:00', '96:00:FF:FF:FF:FF')) $vm = "Hetzner vServer (based on KVM and libvirt)"; |
498 | if (mac_between($mac, '96:00:00:00:00:00', '96:00:FF:FF:FF:FF')) $vm = "Hetzner vServer (based on KVM and libvirt)"; |
475 | // === FAQ "How to recognise a VMware's virtual machine by its MAC address?" === |
499 | // === FAQ "How to recognise a VMware's virtual machine by its MAC address?" === |
476 | if (mac_between($mac, '00:50:56:00:00:00', '00:50:56:FF:FF:FF')) $vm = "VMware vSphere, VMware Workstation, VMware ESX Server"; |
500 | if (mac_between($mac, '00:50:56:00:00:00', '00:50:56:FF:FF:FF')) $vm = "VMware vSphere, VMware Workstation, VMware ESX Server"; |
477 | if (mac_between($mac, '00:50:56:80:00:00', '00:50:56:BF:FF:FF')) $vm = "VMware vSphere managed by vCenter Server"; |
501 | if (mac_between($mac, '00:50:56:80:00:00', '00:50:56:BF:FF:FF')) $vm = "VMware vSphere managed by vCenter Server"; |
478 | 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"; |
502 | 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"; |
479 | if (mac_between($mac, '00:05:69:00:00:00', '00:05:69:FF:FF:FF')) $vm = "VMware ESX, VMware GSX Server"; |
503 | if (mac_between($mac, '00:05:69:00:00:00', '00:05:69:FF:FF:FF')) $vm = "VMware ESX, VMware GSX Server"; |
480 | if (mac_between($mac, '00:1C:14:00:00:00', '00:1C:14:FF:FF:FF')) $vm = "VMWare"; |
504 | if (mac_between($mac, '00:1C:14:00:00:00', '00:1C:14:FF:FF:FF')) $vm = "VMWare"; |
481 | // === FAQ "machine by its MAC address?" === |
505 | // === FAQ "machine by its MAC address?" === |
482 | if (mac_between($mac, '00:1C:42:00:00:00', '00:1C:42:FF:FF:FF')) $vm = "Parallels Virtual Machine"; |
506 | if (mac_between($mac, '00:1C:42:00:00:00', '00:1C:42:FF:FF:FF')) $vm = "Parallels Virtual Machine"; |
483 | // === FAQ "How to recognise a Docker container by its MAC address?" === |
507 | // === FAQ "How to recognise a Docker container by its MAC address?" === |
484 | if (mac_between($mac, '02:42:00:00:00:00', '02:42:FF:FF:FF:FF')) $vm = "Docker container"; |
508 | if (mac_between($mac, '02:42:00:00:00:00', '02:42:FF:FF:FF:FF')) $vm = "Docker container"; |
485 | // === FAQ =How to recognise a Microsoft Hyper-V's virtual machine by its MAC address?" === |
509 | // === FAQ =How to recognise a Microsoft Hyper-V's virtual machine by its MAC address?" === |
486 | if (mac_between($mac, '00:15:5D:00:00:00', '00:15:5D:FF:FF:FF')) $vm = "Microsoft Hyper-V"; |
510 | if (mac_between($mac, '00:15:5D:00:00:00', '00:15:5D:FF:FF:FF')) $vm = "Microsoft Hyper-V"; |
487 | // === FAQ "How to recognise an Oracle Virtual machine by its MAC address?" === |
511 | // === FAQ "How to recognise an Oracle Virtual machine by its MAC address?" === |
488 | if (mac_between($mac, '08:00:27:00:00:00', '08:00:27:FF:FF:FF')) $vm = "Oracle VirtualBox 5.2"; // Pcs Systemtechnik GmbH |
512 | if (mac_between($mac, '08:00:27:00:00:00', '08:00:27:FF:FF:FF')) $vm = "Oracle VirtualBox 5.2"; // Pcs Systemtechnik GmbH |
489 | 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) |
513 | 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) |
490 | if (mac_between($mac, '00:21:F6:00:00:00', '00:21:F6:FF:FF:FF')) $vm = "Oracle VirtualBox 3.3"; |
514 | if (mac_between($mac, '00:21:F6:00:00:00', '00:21:F6:FF:FF:FF')) $vm = "Oracle VirtualBox 3.3"; |
491 | if (mac_between($mac, '00:14:4F:00:00:00', '00:14:4F:FF:FF:FF')) $vm = "Oracle VM Server for SPARC"; |
515 | if (mac_between($mac, '00:14:4F:00:00:00', '00:14:4F:FF:FF:FF')) $vm = "Oracle VM Server for SPARC"; |
492 | if (mac_between($mac, '00:0F:4B:00:00:00', '00:0F:4B:FF:FF:FF')) $vm = "Oracle Virtual Iron 4"; |
516 | if (mac_between($mac, '00:0F:4B:00:00:00', '00:0F:4B:FF:FF:FF')) $vm = "Oracle Virtual Iron 4"; |
493 | 517 | ||
494 | if ($vm) { |
518 | if ($vm) { |
495 | echo sprintf("%-32s %s\n", "Special use:", "Virtual machine $vm"); |
519 | echo sprintf("%-32s %s\n", "Special use:", "Virtual machine $vm"); |
496 | } |
520 | } |
497 | 521 | ||
498 | $app = ''; |
522 | $app = ''; |
499 | 523 | ||
500 | // === FAQ "Other MAC address applications" |
524 | // === FAQ "Other MAC address applications" |
501 | // http://www.cavebear.com/archive/cavebear/Ethernet/Ethernet.txt |
525 | // http://www.cavebear.com/archive/cavebear/Ethernet/Ethernet.txt |
502 | // https://tools.ietf.org/html/rfc1060 |
526 | // https://tools.ietf.org/html/rfc1060 |
503 | 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'; |
527 | 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'; |
504 | if (mac_equals($mac, '01:00:1D:00:00:00')) $app = 'Cabletron PC-OV PC discover (on demand), EtherType is 0x0802'; |
528 | if (mac_equals($mac, '01:00:1D:00:00:00')) $app = 'Cabletron PC-OV PC discover (on demand), EtherType is 0x0802'; |
505 | if (mac_equals($mac, '01:00:1D:42:00:00')) $app = 'Cabletron PC-OV Bridge discover (on demand), EtherType is 0x0802'; |
529 | if (mac_equals($mac, '01:00:1D:42:00:00')) $app = 'Cabletron PC-OV Bridge discover (on demand), EtherType is 0x0802'; |
506 | if (mac_equals($mac, '01:00:1D:52:00:00')) $app = 'Cabletron PC-OV MMAC discover (on demand), EtherType is 0x0802'; |
530 | if (mac_equals($mac, '01:00:1D:52:00:00')) $app = 'Cabletron PC-OV MMAC discover (on demand), EtherType is 0x0802'; |
507 | if (mac_between($mac, '01:00:3C:00:00:00' , '01:00:3C:FF:FF:FF')) $app = 'Auspex Systems (Serverguard)'; |
531 | if (mac_between($mac, '01:00:3C:00:00:00' , '01:00:3C:FF:FF:FF')) $app = 'Auspex Systems (Serverguard)'; |
508 | if (mac_equals($mac, '01:00:10:00:00:20')) $app = 'Hughes Lan Systems Terminal Server S/W download, EtherType is 0x0802'; |
532 | if (mac_equals($mac, '01:00:10:00:00:20')) $app = 'Hughes Lan Systems Terminal Server S/W download, EtherType is 0x0802'; |
509 | if (mac_equals($mac, '01:00:10:FF:FF:20')) $app = 'Hughes Lan Systems Terminal Server S/W request, EtherType is 0x0802'; |
533 | if (mac_equals($mac, '01:00:10:FF:FF:20')) $app = 'Hughes Lan Systems Terminal Server S/W request, EtherType is 0x0802'; |
510 | if (mac_equals($mac, '01:00:81:00:00:00')) $app = 'Synoptics Network Management'; |
534 | if (mac_equals($mac, '01:00:81:00:00:00')) $app = 'Synoptics Network Management'; |
511 | if (mac_equals($mac, '01:00:81:00:00:02')) $app = 'Synoptics Network Management'; |
535 | if (mac_equals($mac, '01:00:81:00:00:02')) $app = 'Synoptics Network Management'; |
512 | if (mac_equals($mac, '01:00:81:00:01:00')) $app = 'Bay Networks (Synoptics) autodiscovery, EtherType is 0x0802 SNAP type is 0x01A2'; |
536 | if (mac_equals($mac, '01:00:81:00:01:00')) $app = 'Bay Networks (Synoptics) autodiscovery, EtherType is 0x0802 SNAP type is 0x01A2'; |
513 | if (mac_equals($mac, '01:00:81:00:01:01')) $app = 'Bay Networks (Synoptics) autodiscovery, EtherType is 0x0802 SNAP type is 0x01A1'; |
537 | if (mac_equals($mac, '01:00:81:00:01:01')) $app = 'Bay Networks (Synoptics) autodiscovery, EtherType is 0x0802 SNAP type is 0x01A1'; |
514 | 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'; |
538 | 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'; |
515 | if (mac_equals($mac, '01:80:24:00:00:00')) $app = 'Kalpana Etherswitch every 60 seconds, EtherType is 0x0802'; |
539 | if (mac_equals($mac, '01:80:24:00:00:00')) $app = 'Kalpana Etherswitch every 60 seconds, EtherType is 0x0802'; |
516 | if (mac_equals($mac, '01:DD:00:FF:FF:FF')) $app = 'Ungermann-Bass boot-me requests, EtherType is 0x7002'; |
540 | if (mac_equals($mac, '01:DD:00:FF:FF:FF')) $app = 'Ungermann-Bass boot-me requests, EtherType is 0x7002'; |
517 | if (mac_equals($mac, '01:DD:01:00:00:00')) $app = 'Ungermann-Bass Spanning Tree, EtherType is 0x7005'; |
541 | if (mac_equals($mac, '01:DD:01:00:00:00')) $app = 'Ungermann-Bass Spanning Tree, EtherType is 0x7005'; |
518 | if (mac_equals($mac, '03:00:00:00:00:10')) $app = 'OS/2 1.3 EE + Communications Manager, EtherType is 0x80D5'; |
542 | if (mac_equals($mac, '03:00:00:00:00:10')) $app = 'OS/2 1.3 EE + Communications Manager, EtherType is 0x80D5'; |
519 | if (mac_equals($mac, '03:00:00:00:00:40')) $app = 'OS/2 1.3 EE + Communications Manager, EtherType is 0x80D5'; |
543 | if (mac_equals($mac, '03:00:00:00:00:40')) $app = 'OS/2 1.3 EE + Communications Manager, EtherType is 0x80D5'; |
520 | if (mac_equals($mac, '03:00:00:00:01:00')) $app = 'OSI All-IS Multicast, EtherType is 0x0802'; |
544 | if (mac_equals($mac, '03:00:00:00:01:00')) $app = 'OSI All-IS Multicast, EtherType is 0x0802'; |
521 | if (mac_equals($mac, '03:00:00:00:02:00')) $app = 'OSI All-ES Multicast, EtherType is 0x0802'; |
545 | if (mac_equals($mac, '03:00:00:00:02:00')) $app = 'OSI All-ES Multicast, EtherType is 0x0802'; |
522 | if (mac_equals($mac, '03:00:00:80:00:00')) $app = 'Discovery Client, EtherType is 0x0802'; |
546 | if (mac_equals($mac, '03:00:00:80:00:00')) $app = 'Discovery Client, EtherType is 0x0802'; |
523 | if (mac_equals($mac, '03:00:FF:FF:FF:FF')) $app = 'All Stations address, EtherType is 0x0802'; |
547 | if (mac_equals($mac, '03:00:FF:FF:FF:FF')) $app = 'All Stations address, EtherType is 0x0802'; |
524 | if (mac_between($mac, '09:00:0D:00:00:00', '09:00:0D:FF:FF:FF')) $app = 'ICL Oslan Multicast, EtherType is 0x0802'; |
548 | if (mac_between($mac, '09:00:0D:00:00:00', '09:00:0D:FF:FF:FF')) $app = 'ICL Oslan Multicast, EtherType is 0x0802'; |
525 | if (mac_equals($mac, '09:00:0D:02:00:00')) $app = 'ICL Oslan Service discover only on boot'; |
549 | if (mac_equals($mac, '09:00:0D:02:00:00')) $app = 'ICL Oslan Service discover only on boot'; |
526 | if (mac_equals($mac, '09:00:0D:02:0A:3C')) $app = 'ICL Oslan Service discover only on boot'; |
550 | if (mac_equals($mac, '09:00:0D:02:0A:3C')) $app = 'ICL Oslan Service discover only on boot'; |
527 | if (mac_equals($mac, '09:00:0D:02:0A:38')) $app = 'ICL Oslan Service discover only on boot'; |
551 | if (mac_equals($mac, '09:00:0D:02:0A:38')) $app = 'ICL Oslan Service discover only on boot'; |
528 | if (mac_equals($mac, '09:00:0D:02:0A:39')) $app = 'ICL Oslan Service discover only on boot'; |
552 | if (mac_equals($mac, '09:00:0D:02:0A:39')) $app = 'ICL Oslan Service discover only on boot'; |
529 | if (mac_equals($mac, '09:00:0D:02:FF:FF')) $app = 'ICL Oslan Service discover only on boot'; |
553 | if (mac_equals($mac, '09:00:0D:02:FF:FF')) $app = 'ICL Oslan Service discover only on boot'; |
530 | if (mac_equals($mac, '09:00:0D:09:00:00')) $app = 'ICL Oslan Service discover as required'; |
554 | if (mac_equals($mac, '09:00:0D:09:00:00')) $app = 'ICL Oslan Service discover as required'; |
531 | if (mac_equals($mac, '09:00:1E:00:00:00')) $app = 'Apollo DOMAIN, EtherType is 0x8019'; |
555 | if (mac_equals($mac, '09:00:1E:00:00:00')) $app = 'Apollo DOMAIN, EtherType is 0x8019'; |
532 | if (mac_equals($mac, '09:00:02:04:00:01')) $app = 'Vitalink printer messages, EtherType is 0x8080'; |
556 | if (mac_equals($mac, '09:00:02:04:00:01')) $app = 'Vitalink printer messages, EtherType is 0x8080'; |
533 | if (mac_equals($mac, '09:00:02:04:00:02')) $app = 'Vitalink bridge management, EtherType is 0x8080'; |
557 | if (mac_equals($mac, '09:00:02:04:00:02')) $app = 'Vitalink bridge management, EtherType is 0x8080'; |
534 | if (mac_equals($mac, '09:00:4C:00:00:0F')) $app = 'BICC Remote bridge adaptive routing (e.g. to Retix), EtherType is 0x0802'; |
558 | if (mac_equals($mac, '09:00:4C:00:00:0F')) $app = 'BICC Remote bridge adaptive routing (e.g. to Retix), EtherType is 0x0802'; |
535 | if (mac_equals($mac, '09:00:4E:00:00:02')) $app = 'Novell IPX, EtherType is 0x8137'; |
559 | if (mac_equals($mac, '09:00:4E:00:00:02')) $app = 'Novell IPX, EtherType is 0x8137'; |
536 | if (mac_equals($mac, '09:00:6A:00:01:00')) $app = 'TOP NetBIOS'; |
560 | if (mac_equals($mac, '09:00:6A:00:01:00')) $app = 'TOP NetBIOS'; |
537 | if (mac_equals($mac, '09:00:7C:01:00:01')) $app = 'Vitalink DLS Multicast'; |
561 | if (mac_equals($mac, '09:00:7C:01:00:01')) $app = 'Vitalink DLS Multicast'; |
538 | if (mac_equals($mac, '09:00:7C:01:00:03')) $app = 'Vitalink DLS Inlink'; |
562 | if (mac_equals($mac, '09:00:7C:01:00:03')) $app = 'Vitalink DLS Inlink'; |
539 | if (mac_equals($mac, '09:00:7C:01:00:04')) $app = 'Vitalink DLS and non DLS Multicast'; |
563 | if (mac_equals($mac, '09:00:7C:01:00:04')) $app = 'Vitalink DLS and non DLS Multicast'; |
540 | if (mac_equals($mac, '09:00:7C:02:00:05')) $app = 'Vitalink diagnostics, EtherType is 0x8080'; |
564 | if (mac_equals($mac, '09:00:7C:02:00:05')) $app = 'Vitalink diagnostics, EtherType is 0x8080'; |
541 | if (mac_equals($mac, '09:00:7C:05:00:01')) $app = 'Vitalink gateway, EtherType is 0x8080'; |
565 | if (mac_equals($mac, '09:00:7C:05:00:01')) $app = 'Vitalink gateway, EtherType is 0x8080'; |
542 | if (mac_equals($mac, '09:00:7C:05:00:02')) $app = 'Vitalink Network Validation Message'; |
566 | if (mac_equals($mac, '09:00:7C:05:00:02')) $app = 'Vitalink Network Validation Message'; |
543 | if (mac_equals($mac, '09:00:09:00:00:01')) $app = 'HP Probe, EtherType is 0x8005 or 0x0802'; |
567 | if (mac_equals($mac, '09:00:09:00:00:01')) $app = 'HP Probe, EtherType is 0x8005 or 0x0802'; |
544 | if (mac_equals($mac, '09:00:09:00:00:04')) $app = 'HP DTC, EtherType is 0x8005'; |
568 | if (mac_equals($mac, '09:00:09:00:00:04')) $app = 'HP DTC, EtherType is 0x8005'; |
545 | if (mac_equals($mac, '09:00:26:01:00:01')) $app = 'Vitalink TransLAN bridge management, EtherType is 0x8038'; |
569 | if (mac_equals($mac, '09:00:26:01:00:01')) $app = 'Vitalink TransLAN bridge management, EtherType is 0x8038'; |
546 | if (mac_equals($mac, '09:00:39:00:70:00')) $app = 'Spider Systems Bridge'; |
570 | if (mac_equals($mac, '09:00:39:00:70:00')) $app = 'Spider Systems Bridge'; |
547 | if (mac_between($mac, '09:00:56:00:00:00', '09:00:56:FE:FF:FF')) $app = 'Stanford reserved'; |
571 | if (mac_between($mac, '09:00:56:00:00:00', '09:00:56:FE:FF:FF')) $app = 'Stanford reserved'; |
548 | 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'; |
572 | 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'; |
549 | if (mac_equals($mac, '09:00:77:00:00:00')) $app = 'Retix Bridge Local Management System, EtherType is 0x0802'; |
573 | if (mac_equals($mac, '09:00:77:00:00:00')) $app = 'Retix Bridge Local Management System, EtherType is 0x0802'; |
550 | if (mac_equals($mac, '09:00:77:00:00:01')) $app = 'Retix spanning tree bridges, EtherType is 0x0802'; |
574 | if (mac_equals($mac, '09:00:77:00:00:01')) $app = 'Retix spanning tree bridges, EtherType is 0x0802'; |
551 | if (mac_equals($mac, '09:00:77:00:00:02')) $app = 'Retix Bridge Adaptive routing, EtherType is 0x0802'; |
575 | if (mac_equals($mac, '09:00:77:00:00:02')) $app = 'Retix Bridge Adaptive routing, EtherType is 0x0802'; |
552 | if (mac_equals($mac, '09:00:87:80:FF:FF')) $app = 'Xyplex Terminal Servers, EtherType is 0x0889'; |
576 | if (mac_equals($mac, '09:00:87:80:FF:FF')) $app = 'Xyplex Terminal Servers, EtherType is 0x0889'; |
553 | if (mac_equals($mac, '09:00:87:90:FF:FF')) $app = 'Xyplex Terminal Servers, EtherType is 0x0889'; |
577 | if (mac_equals($mac, '09:00:87:90:FF:FF')) $app = 'Xyplex Terminal Servers, EtherType is 0x0889'; |
554 | if (mac_between($mac, '44:38:39:FF:00:00', '44:38:39:FF:FF:FF')) $app = 'Multi-Chassis Link Aggregation (Cumulus Linux)'; |
578 | if (mac_between($mac, '44:38:39:FF:00:00', '44:38:39:FF:FF:FF')) $app = 'Multi-Chassis Link Aggregation (Cumulus Linux)'; |
555 | if (mac_equals($mac, 'FF:FF:00:40:00:01')) $app = 'LANtastic, EtherType is 0x81D6'; |
579 | if (mac_equals($mac, 'FF:FF:00:40:00:01')) $app = 'LANtastic, EtherType is 0x81D6'; |
556 | if (mac_equals($mac, 'FF:FF:00:60:00:04')) $app = 'LANtastic, EtherType is 0x81D6'; |
580 | if (mac_equals($mac, 'FF:FF:00:60:00:04')) $app = 'LANtastic, EtherType is 0x81D6'; |
557 | if (mac_equals($mac, 'FF:FF:01:E0:00:04')) $app = 'LANtastic'; |
581 | if (mac_equals($mac, 'FF:FF:01:E0:00:04')) $app = 'LANtastic'; |
558 | 582 | ||
559 | // === FAQ "The "CF" series MAC addresses" === |
583 | // === FAQ "The "CF" series MAC addresses" === |
560 | // https://www.iana.org/assignments/ppp-numbers/ppp-numbers.xhtml |
584 | // https://www.iana.org/assignments/ppp-numbers/ppp-numbers.xhtml |
561 | // https://tools.ietf.org/html/rfc2153 |
585 | // https://tools.ietf.org/html/rfc2153 |
562 | // https://tools.ietf.org/html/rfc7042#section-2.3.2 |
586 | // https://tools.ietf.org/html/rfc7042#section-2.3.2 |
563 | if (mac_between($mac, 'CF:00:00:00:00:00', 'CF:00:00:FF:FF:FF')) $app = 'Reserved'; |
587 | if (mac_between($mac, 'CF:00:00:00:00:00', 'CF:00:00:FF:FF:FF')) $app = 'Reserved'; |
564 | if (mac_equals($mac, 'CF:00:00:00:00:00')) $app = 'Used for Ethernet loopback tests'; |
588 | if (mac_equals($mac, 'CF:00:00:00:00:00')) $app = 'Used for Ethernet loopback tests'; |
565 | 589 | ||
566 | // === FAQ "How to recognise a Broadcast MAC address application?" === |
590 | // === FAQ "How to recognise a Broadcast MAC address application?" === |
567 | // According to https://standards.ieee.org/wp-content/uploads/import/documents/tutorials/eui.pdf FFFFFFFFFFFF can be used as NULL EUI |
591 | // According to https://standards.ieee.org/wp-content/uploads/import/documents/tutorials/eui.pdf FFFFFFFFFFFF can be used as NULL EUI |
568 | if (mac_equals($mac, 'FF:FF:FF:FF:FF:FF')) echo sprintf("%-32s %s\n", "Special use:", "Broadcast messaging or Null-EUI"); |
592 | if (mac_equals($mac, 'FF:FF:FF:FF:FF:FF')) echo sprintf("%-32s %s\n", "Special use:", "Broadcast messaging or Null-EUI"); |
569 | 593 | ||
570 | // === FAQ "How to recognise a Virtual Router ID by MAC address?" === |
594 | // === FAQ "How to recognise a Virtual Router ID by MAC address?" === |
571 | // https://tools.ietf.org/html/rfc7042#section-5.1 |
595 | // https://tools.ietf.org/html/rfc7042#section-5.1 |
572 | // https://tools.ietf.org/html/rfc5798 |
596 | // https://tools.ietf.org/html/rfc5798 |
573 | if (mac_between($mac, '00:00:5E:00:01:00', '00:00:5E:00:01:FF')) $app = 'IPv4 Virtual Router Redundancy Protocol (VRRP)'; |
597 | if (mac_between($mac, '00:00:5E:00:01:00', '00:00:5E:00:01:FF')) $app = 'IPv4 Virtual Router Redundancy Protocol (VRRP)'; |
574 | if (mac_between($mac, '00:00:5E:00:02:00', '00:00:5E:00:02:FF')) $app = 'IPv6 Virtual Router Redundancy Protocol'; |
598 | if (mac_between($mac, '00:00:5E:00:02:00', '00:00:5E:00:02:FF')) $app = 'IPv6 Virtual Router Redundancy Protocol'; |
575 | 599 | ||
576 | // === FAQ "How to recognise an IP frame by MAC address?" === |
600 | // === FAQ "How to recognise an IP frame by MAC address?" === |
577 | // https://tools.ietf.org/html/rfc1060 |
601 | // https://tools.ietf.org/html/rfc1060 |
578 | // https://en.wikipedia.org/wiki/Multicast_address#cite_note-15 |
602 | // https://en.wikipedia.org/wiki/Multicast_address#cite_note-15 |
579 | // https://tools.ietf.org/html/rfc2464 |
603 | // https://tools.ietf.org/html/rfc2464 |
580 | // https://www.iana.org/go/rfc1112 |
604 | // https://www.iana.org/go/rfc1112 |
581 | // http://www.cavebear.com/archive/cavebear/Ethernet/Ethernet.txt |
605 | // http://www.cavebear.com/archive/cavebear/Ethernet/Ethernet.txt |
582 | if (mac_between($mac, '01:00:5E:00:00:00', '01:00:5E:7F:FF:FF')) $app = 'IPv4 Multicast (EtherType is 0x0800)'; |
606 | if (mac_between($mac, '01:00:5E:00:00:00', '01:00:5E:7F:FF:FF')) $app = 'IPv4 Multicast (EtherType is 0x0800)'; |
583 | 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. |
607 | 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. |
584 | if (mac_between($mac, '00:00:5E:00:52:13', '00:00:5E:00:52:13')) $app = 'Proxy Mobile IPv6'; |
608 | if (mac_between($mac, '00:00:5E:00:52:13', '00:00:5E:00:52:13')) $app = 'Proxy Mobile IPv6'; |
585 | if (mac_between($mac, '00:00:5E:FE:C0:00:02:00', '00:00:5E:FE:C0:00:02:FF')) $app = 'IPv4 derived documentation'; |
609 | if (mac_between($mac, '00:00:5E:FE:C0:00:02:00', '00:00:5E:FE:C0:00:02:FF')) $app = 'IPv4 derived documentation'; |
586 | if (mac_between($mac, '00:00:5E:FE:C6:33:64:00', '00:00:5E:FE:C6:33:64:FF')) $app = 'IPv4 derived documentation'; |
610 | if (mac_between($mac, '00:00:5E:FE:C6:33:64:00', '00:00:5E:FE:C6:33:64:FF')) $app = 'IPv4 derived documentation'; |
587 | if (mac_between($mac, '00:00:5E:FE:CB:00:71:00', '00:00:5E:FE:CB:00:71:FF')) $app = 'IPv4 derived documentation'; |
611 | if (mac_between($mac, '00:00:5E:FE:CB:00:71:00', '00:00:5E:FE:CB:00:71:FF')) $app = 'IPv4 derived documentation'; |
588 | if (mac_equals($mac, '00:00:5E:FE:EA:C0:00:02')) $app = 'IPv4 multicast derived documentation'; |
612 | if (mac_equals($mac, '00:00:5E:FE:EA:C0:00:02')) $app = 'IPv4 multicast derived documentation'; |
589 | if (mac_equals($mac, '00:00:5E:FE:EA:C6:33:64')) $app = 'IPv4 multicast derived documentation'; |
613 | if (mac_equals($mac, '00:00:5E:FE:EA:C6:33:64')) $app = 'IPv4 multicast derived documentation'; |
590 | if (mac_equals($mac, '00:00:5E:FE:EA:CB:00:71')) $app = 'IPv4 multicast derived documentation'; |
614 | if (mac_equals($mac, '00:00:5E:FE:EA:CB:00:71')) $app = 'IPv4 multicast derived documentation'; |
591 | if (mac_between($mac, '01:00:5E:FE:C0:00:02:00', '01:00:5E:FE:C0:00:02:FF')) $app = 'IPv4 derived documentation'; |
615 | if (mac_between($mac, '01:00:5E:FE:C0:00:02:00', '01:00:5E:FE:C0:00:02:FF')) $app = 'IPv4 derived documentation'; |
592 | if (mac_between($mac, '01:00:5E:FE:C6:33:64:00', '01:00:5E:FE:C6:33:64:FF')) $app = 'IPv4 derived documentation'; |
616 | if (mac_between($mac, '01:00:5E:FE:C6:33:64:00', '01:00:5E:FE:C6:33:64:FF')) $app = 'IPv4 derived documentation'; |
593 | if (mac_between($mac, '01:00:5E:FE:CB:00:71:00', '01:00:5E:FE:CB:00:71:FF')) $app = 'IPv4 derived documentation'; |
617 | if (mac_between($mac, '01:00:5E:FE:CB:00:71:00', '01:00:5E:FE:CB:00:71:FF')) $app = 'IPv4 derived documentation'; |
594 | if (mac_equals($mac, '01:00:5E:FE:EA:C0:00:02')) $app = 'IPv4 multicast derived documentation'; |
618 | if (mac_equals($mac, '01:00:5E:FE:EA:C0:00:02')) $app = 'IPv4 multicast derived documentation'; |
595 | if (mac_equals($mac, '01:00:5E:FE:EA:C6:33:64')) $app = 'IPv4 multicast derived documentation'; |
619 | if (mac_equals($mac, '01:00:5E:FE:EA:C6:33:64')) $app = 'IPv4 multicast derived documentation'; |
596 | if (mac_equals($mac, '01:00:5E:FE:EA:CB:00:71')) $app = 'IPv4 multicast derived documentation'; |
620 | if (mac_equals($mac, '01:00:5E:FE:EA:CB:00:71')) $app = 'IPv4 multicast derived documentation'; |
597 | 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'; |
621 | 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'; |
598 | if (mac_between($mac, '02:00:5E:FE:00:00:00:00', '02:00:5E:FE:FF:FF:FF:FF')) $app = 'IPv4 Addr Holders'; |
622 | if (mac_between($mac, '02:00:5E:FE:00:00:00:00', '02:00:5E:FE:FF:FF:FF:FF')) $app = 'IPv4 Addr Holders'; |
599 | if (mac_equals($mac, '03:00:00:20:00:00')) $app = 'IP multicast address'; |
623 | if (mac_equals($mac, '03:00:00:20:00:00')) $app = 'IP multicast address'; |
600 | if (mac_equals($mac, 'C0:00:00:04:00:00')) $app = 'IP multicast address'; |
624 | if (mac_equals($mac, 'C0:00:00:04:00:00')) $app = 'IP multicast address'; |
601 | if (mac_between($mac, '03:00:5E:FE:00:00:00:00', '03:00:5E:FE:FF:FF:FF:FF')) $app = 'IPv4 Addr Holders'; |
625 | if (mac_between($mac, '03:00:5E:FE:00:00:00:00', '03:00:5E:FE:FF:FF:FF:FF')) $app = 'IPv4 Addr Holders'; |
602 | 626 | ||
603 | // === FAQ "How to recognise a MPLS multicast frame by MAC address?" === |
627 | // === FAQ "How to recognise a MPLS multicast frame by MAC address?" === |
604 | // http://www.iana.org/go/rfc5332 |
628 | // http://www.iana.org/go/rfc5332 |
605 | // http://www.iana.org/go/rfc7213 |
629 | // http://www.iana.org/go/rfc7213 |
606 | if (mac_between($mac, '01:00:5E:80:00:00', '01:00:5E:8F:FF:FF')) $app = 'MPLS multicast (EtherType is 0x8847 or 0x8848)'; |
630 | if (mac_between($mac, '01:00:5E:80:00:00', '01:00:5E:8F:FF:FF')) $app = 'MPLS multicast (EtherType is 0x8847 or 0x8848)'; |
607 | if (mac_equals($mac, '01:00:5E:90:00:00')) $app = 'MPLS-TP p2p'; |
631 | if (mac_equals($mac, '01:00:5E:90:00:00')) $app = 'MPLS-TP p2p'; |
608 | 632 | ||
609 | // === FAQ "How to recognise a Bidirectional Forwarding Detection (BFD) on Link Aggregation Group (LAG) interfaces by MAC address?" === |
633 | // === FAQ "How to recognise a Bidirectional Forwarding Detection (BFD) on Link Aggregation Group (LAG) interfaces by MAC address?" === |
610 | // http://www.iana.org/go/rfc7130 |
634 | // http://www.iana.org/go/rfc7130 |
611 | if (mac_equals($mac, '01:00:5E:90:00:01')) $app = 'Bidirectional Forwarding Detection (BFD) on Link Aggregation Group (LAG) interfaces'; |
635 | if (mac_equals($mac, '01:00:5E:90:00:01')) $app = 'Bidirectional Forwarding Detection (BFD) on Link Aggregation Group (LAG) interfaces'; |
612 | 636 | ||
613 | // === FAQ "How to recognise Token Ring specific functions by MAC address?" === |
637 | // === FAQ "How to recognise Token Ring specific functions by MAC address?" === |
614 | // https://tools.ietf.org/html/rfc1060 |
638 | // https://tools.ietf.org/html/rfc1060 |
615 | // https://tools.ietf.org/html/rfc1469 |
639 | // https://tools.ietf.org/html/rfc1469 |
616 | // https://standards.ieee.org/products-services/regauth/grpmac/public.html |
640 | // https://standards.ieee.org/products-services/regauth/grpmac/public.html |
617 | // https://tools.ietf.org/html/rfc2470 |
641 | // https://tools.ietf.org/html/rfc2470 |
618 | // http://www.cavebear.com/archive/cavebear/Ethernet/Ethernet.txt |
642 | // http://www.cavebear.com/archive/cavebear/Ethernet/Ethernet.txt |
619 | if (mac_equals($mac, '03:00:00:00:00:01')) $app = 'NetBIOS (Token Ring)'; |
643 | if (mac_equals($mac, '03:00:00:00:00:01')) $app = 'NetBIOS (Token Ring)'; |
620 | if (mac_equals($mac, '03:00:00:00:00:02')) $app = 'Locate - Directory Server (Token Ring)'; |
644 | if (mac_equals($mac, '03:00:00:00:00:02')) $app = 'Locate - Directory Server (Token Ring)'; |
621 | if (mac_equals($mac, '03:00:00:00:00:04')) $app = 'Synchronous Bandwidth Manager (Token Ring)'; |
645 | if (mac_equals($mac, '03:00:00:00:00:04')) $app = 'Synchronous Bandwidth Manager (Token Ring)'; |
622 | if (mac_equals($mac, '03:00:00:00:00:08')) $app = 'Configuration Report Server (Token Ring)'; |
646 | if (mac_equals($mac, '03:00:00:00:00:08')) $app = 'Configuration Report Server (Token Ring)'; |
623 | if (mac_equals($mac, '03:00:00:00:00:10')) $app = 'Ring Error Monitor (Token Ring)'; |
647 | if (mac_equals($mac, '03:00:00:00:00:10')) $app = 'Ring Error Monitor (Token Ring)'; |
624 | if (mac_equals($mac, '03:00:00:00:00:20')) $app = 'Network Server Heartbeat (Token Ring)'; |
648 | if (mac_equals($mac, '03:00:00:00:00:20')) $app = 'Network Server Heartbeat (Token Ring)'; |
625 | if (mac_equals($mac, '03:00:00:00:00:40')) $app = 'Ring Parameter Monitor (Token Ring)'; |
649 | if (mac_equals($mac, '03:00:00:00:00:40')) $app = 'Ring Parameter Monitor (Token Ring)'; |
626 | if (mac_equals($mac, '03:00:00:00:00:80')) $app = 'Active Monitor (Token Ring)'; |
650 | if (mac_equals($mac, '03:00:00:00:00:80')) $app = 'Active Monitor (Token Ring)'; |
627 | if (mac_equals($mac, '03:00:00:00:04:00')) $app = 'LAN Manager (Token Ring)'; |
651 | if (mac_equals($mac, '03:00:00:00:04:00')) $app = 'LAN Manager (Token Ring)'; |
628 | if (mac_equals($mac, '03:00:00:00:08:00')) $app = 'Ring Wiring Concentrator (Token Ring)'; |
652 | if (mac_equals($mac, '03:00:00:00:08:00')) $app = 'Ring Wiring Concentrator (Token Ring)'; |
629 | if (mac_equals($mac, '03:00:00:00:10:00')) $app = 'LAN Gateway (Token Ring)'; |
653 | if (mac_equals($mac, '03:00:00:00:10:00')) $app = 'LAN Gateway (Token Ring)'; |
630 | if (mac_equals($mac, '03:00:00:00:20:00')) $app = 'Ring Authorization Server (Token Ring)'; |
654 | if (mac_equals($mac, '03:00:00:00:20:00')) $app = 'Ring Authorization Server (Token Ring)'; |
631 | if (mac_equals($mac, '03:00:00:00:40:00')) $app = 'IMPL Server (Token Ring)'; |
655 | if (mac_equals($mac, '03:00:00:00:40:00')) $app = 'IMPL Server (Token Ring)'; |
632 | if (mac_equals($mac, '03:00:00:00:80:00')) $app = 'Bridge (Token Ring)'; |
656 | if (mac_equals($mac, '03:00:00:00:80:00')) $app = 'Bridge (Token Ring)'; |
633 | if (mac_equals($mac, '03:00:00:20:00:00')) $app = 'Single Token-Ring functional address'; |
657 | if (mac_equals($mac, '03:00:00:20:00:00')) $app = 'Single Token-Ring functional address'; |
634 | if (mac_equals($mac, '03:00:00:00:00:08')) $app = 'Configuration Report Server (CRS) MAC Group address'; |
658 | if (mac_equals($mac, '03:00:00:00:00:08')) $app = 'Configuration Report Server (CRS) MAC Group address'; |
635 | if (mac_equals($mac, '03:00:00:00:00:10')) $app = 'Ring Error Monitor (REM) MAC Group address'; |
659 | if (mac_equals($mac, '03:00:00:00:00:10')) $app = 'Ring Error Monitor (REM) MAC Group address'; |
636 | if (mac_equals($mac, '03:00:00:00:00:40')) $app = 'Ring Parameter Server (RPS) MAC group address'; |
660 | if (mac_equals($mac, '03:00:00:00:00:40')) $app = 'Ring Parameter Server (RPS) MAC group address'; |
637 | if (mac_equals($mac, '03:00:00:00:01:00')) $app = 'All Intermediate System Network Entities address'; |
661 | if (mac_equals($mac, '03:00:00:00:01:00')) $app = 'All Intermediate System Network Entities address'; |
638 | 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'; |
662 | 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'; |
639 | if (mac_equals($mac, '03:00:00:00:04:00')) $app = 'Generic address for all Manager Stations'; |
663 | if (mac_equals($mac, '03:00:00:00:04:00')) $app = 'Generic address for all Manager Stations'; |
640 | if (mac_equals($mac, '03:00:00:00:08:00')) $app = 'All CONs SNARES address'; |
664 | if (mac_equals($mac, '03:00:00:00:08:00')) $app = 'All CONs SNARES address'; |
641 | if (mac_equals($mac, '03:00:00:00:10:00')) $app = 'All CONs End System address'; |
665 | if (mac_equals($mac, '03:00:00:00:10:00')) $app = 'All CONs End System address'; |
642 | if (mac_equals($mac, '03:00:00:00:20:00')) $app = 'Loadable Device Generic address'; |
666 | if (mac_equals($mac, '03:00:00:00:20:00')) $app = 'Loadable Device Generic address'; |
643 | if (mac_equals($mac, '03:00:00:00:40:00')) $app = 'Load Server Generic address'; |
667 | if (mac_equals($mac, '03:00:00:00:40:00')) $app = 'Load Server Generic address'; |
644 | if (mac_equals($mac, '03:00:00:40:00:00')) $app = 'Generic address for all Agent Stations'; |
668 | if (mac_equals($mac, '03:00:00:40:00:00')) $app = 'Generic address for all Agent Stations'; |
645 | if (mac_equals($mac, 'C0:00:00:04:00:00')) $app = 'Single Token-Ring functional address'; |
669 | if (mac_equals($mac, 'C0:00:00:04:00:00')) $app = 'Single Token-Ring functional address'; |
646 | 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'; |
670 | 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'; |
647 | if (mac_equals($mac, '03:00:40:00:00:00')) $app = 'IPv6 multicast over Token Ring: all-Routers addresses (FF0X::2)'; |
671 | if (mac_equals($mac, '03:00:40:00:00:00')) $app = 'IPv6 multicast over Token Ring: all-Routers addresses (FF0X::2)'; |
648 | 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'; |
672 | 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'; |
649 | 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'; |
673 | 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'; |
650 | 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'; |
674 | 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'; |
651 | 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'; |
675 | 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'; |
652 | 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'; |
676 | 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'; |
653 | 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'; |
677 | 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'; |
654 | 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'; |
678 | 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'; |
655 | 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'; |
679 | 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'; |
656 | 680 | ||
657 | // === FAQ "How to recognise an AppleTalk protocols by MAC address?" === |
681 | // === FAQ "How to recognise an AppleTalk protocols by MAC address?" === |
658 | // https://tools.ietf.org/html/rfc1060 |
682 | // https://tools.ietf.org/html/rfc1060 |
659 | // http://www.cavebear.com/archive/cavebear/Ethernet/Ethernet.txt |
683 | // http://www.cavebear.com/archive/cavebear/Ethernet/Ethernet.txt |
660 | if (mac_between($mac, '09:00:07:00:00:00', '09:00:07:00:00:FC')) $app = 'AppleTalk zone multicast addresses (EtherType is 0x0802)'; |
684 | if (mac_between($mac, '09:00:07:00:00:00', '09:00:07:00:00:FC')) $app = 'AppleTalk zone multicast addresses (EtherType is 0x0802)'; |
661 | if (mac_equals($mac, '09:00:07:FF:FF:FF')) $app = 'AppleTalk broadcast address (EtherType is 0x0802)'; |
685 | if (mac_equals($mac, '09:00:07:FF:FF:FF')) $app = 'AppleTalk broadcast address (EtherType is 0x0802)'; |
662 | 686 | ||
663 | // === FAQ "How to recognise a TRILL protocols by MAC address?" === |
687 | // === FAQ "How to recognise a TRILL protocols by MAC address?" === |
664 | // http://www.iana.org/go/rfc7455 |
688 | // http://www.iana.org/go/rfc7455 |
665 | // https://tools.ietf.org/html/draft-ietf-trill-oam-framework-04 |
689 | // https://tools.ietf.org/html/draft-ietf-trill-oam-framework-04 |
666 | // https://standards.ieee.org/products-services/regauth/grpmac/public.html |
690 | // https://standards.ieee.org/products-services/regauth/grpmac/public.html |
667 | // https://tools.ietf.org/html/rfc7455#appendix-C |
691 | // https://tools.ietf.org/html/rfc7455#appendix-C |
668 | if (mac_between($mac, '00:00:5E:90:01:00', '00:00:5E:90:01:00')) $app = 'TRILL OAM'; |
692 | if (mac_between($mac, '00:00:5E:90:01:00', '00:00:5E:90:01:00')) $app = 'TRILL OAM'; |
669 | if (mac_equals($mac, '01:00:5E:90:01:00')) $app = 'TRILL OAM'; |
693 | if (mac_equals($mac, '01:00:5E:90:01:00')) $app = 'TRILL OAM'; |
670 | 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'; |
694 | 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'; |
671 | 695 | ||
672 | // === FAQ "How to recognise an IEEE 802.1X MAC address application?" === |
696 | // === FAQ "How to recognise an IEEE 802.1X MAC address application?" === |
673 | 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'; |
697 | 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'; |
674 | 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'; |
698 | 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'; |
675 | 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'; |
699 | 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'; |
676 | if (mac_equals($mac, '01:1B:19:00:00:00')) $app = 'General group address - An 802.1Q VLAN Bridge would forward the frame unchanged.'; |
700 | if (mac_equals($mac, '01:1B:19:00:00:00')) $app = 'General group address - An 802.1Q VLAN Bridge would forward the frame unchanged.'; |
677 | if (mac_equals($mac, '01:1B:19:00:00:00')) $app = 'Precision Time Protocol (PTP) version 2 over Ethernet, EtherType is 0x88F7'; |
701 | if (mac_equals($mac, '01:1B:19:00:00:00')) $app = 'Precision Time Protocol (PTP) version 2 over Ethernet, EtherType is 0x88F7'; |
678 | if (mac_equals($mac, '01:80:C2:00:00:00')) $app = 'Bridge Group address Nearest Customer Bridge group address'; |
702 | if (mac_equals($mac, '01:80:C2:00:00:00')) $app = 'Bridge Group address Nearest Customer Bridge group address'; |
679 | if (mac_equals($mac, '01:80:C2:00:00:00')) $app = 'Spanning Tree Protocol (for bridges) IEEE 802.1D, EtherType is 0x0802'; |
703 | if (mac_equals($mac, '01:80:C2:00:00:00')) $app = 'Spanning Tree Protocol (for bridges) IEEE 802.1D, EtherType is 0x0802'; |
680 | if (mac_equals($mac, '01:80:C2:00:00:00')) $app = 'Link Layer Discovery Protocol, EtherType is 0x88CC'; |
704 | if (mac_equals($mac, '01:80:C2:00:00:00')) $app = 'Link Layer Discovery Protocol, EtherType is 0x88CC'; |
681 | if (mac_between($mac, '01:80:C2:00:00:00', '01:80:C2:00:00:0F')) $app = 'The initial bridging/link protocols block'; |
705 | if (mac_between($mac, '01:80:C2:00:00:00', '01:80:C2:00:00:0F')) $app = 'The initial bridging/link protocols block'; |
682 | 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'; |
706 | 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'; |
683 | if (mac_between($mac, '01:80:C2:00:00:00', '01:80:C2:00:00:0F')) $app = 'IEEE Pause, 802.3x'; |
707 | if (mac_between($mac, '01:80:C2:00:00:00', '01:80:C2:00:00:0F')) $app = 'IEEE Pause, 802.3x'; |
684 | if (mac_equals($mac, '01:80:C2:00:00:0A')) $app = 'Reserved for future standardization'; |
708 | if (mac_equals($mac, '01:80:C2:00:00:0A')) $app = 'Reserved for future standardization'; |
685 | if (mac_equals($mac, '01:80:C2:00:00:0B')) $app = 'EDE-SS PEP Address'; |
709 | if (mac_equals($mac, '01:80:C2:00:00:0B')) $app = 'EDE-SS PEP Address'; |
686 | if (mac_equals($mac, '01:80:C2:00:00:0C')) $app = 'Reserved for future standardization'; |
710 | if (mac_equals($mac, '01:80:C2:00:00:0C')) $app = 'Reserved for future standardization'; |
687 | if (mac_equals($mac, '01:80:C2:00:00:0D')) $app = 'Provider Bridge MVRP address'; |
711 | if (mac_equals($mac, '01:80:C2:00:00:0D')) $app = 'Provider Bridge MVRP address'; |
688 | 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'; |
712 | 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'; |
689 | if (mac_equals($mac, '01:80:C2:00:00:0E')) $app = 'Nearest Bridge group address'; |
713 | if (mac_equals($mac, '01:80:C2:00:00:0E')) $app = 'Nearest Bridge group address'; |
690 | if (mac_equals($mac, '01:80:C2:00:00:0E')) $app = 'Link Layer Discovery Protocol, EtherType is 0x88CC'; |
714 | if (mac_equals($mac, '01:80:C2:00:00:0E')) $app = 'Link Layer Discovery Protocol, EtherType is 0x88CC'; |
691 | if (mac_equals($mac, '01:80:C2:00:00:0E')) $app = 'Precision Time Protocol (PTP) version 2 over Ethernet, EtherType is 0x88F7'; |
715 | if (mac_equals($mac, '01:80:C2:00:00:0E')) $app = 'Precision Time Protocol (PTP) version 2 over Ethernet, EtherType is 0x88F7'; |
692 | if (mac_equals($mac, '01:80:C2:00:00:01')) $app = 'IEEE MAC-specific Control Protocols group address'; |
716 | if (mac_equals($mac, '01:80:C2:00:00:01')) $app = 'IEEE MAC-specific Control Protocols group address'; |
693 | if (mac_equals($mac, '01:80:C2:00:00:01')) $app = 'Ethernet flow control (Pause frame) IEEE 802.3x, EtherType is 0x8808'; |
717 | if (mac_equals($mac, '01:80:C2:00:00:01')) $app = 'Ethernet flow control (Pause frame) IEEE 802.3x, EtherType is 0x8808'; |
694 | if (mac_equals($mac, '01:80:C2:00:00:1A')) $app = 'Generic Address for All Agent Stations'; |
718 | if (mac_equals($mac, '01:80:C2:00:00:1A')) $app = 'Generic Address for All Agent Stations'; |
695 | if (mac_equals($mac, '01:80:C2:00:00:1B')) $app = 'All Multicast Capable End Systems address'; |
719 | if (mac_equals($mac, '01:80:C2:00:00:1B')) $app = 'All Multicast Capable End Systems address'; |
696 | if (mac_equals($mac, '01:80:C2:00:00:1C')) $app = 'All Multicast Announcements address'; |
720 | if (mac_equals($mac, '01:80:C2:00:00:1C')) $app = 'All Multicast Announcements address'; |
697 | if (mac_equals($mac, '01:80:C2:00:00:1D')) $app = 'All Multicast Capable Intermediate Systems address'; |
721 | if (mac_equals($mac, '01:80:C2:00:00:1D')) $app = 'All Multicast Capable Intermediate Systems address'; |
698 | if (mac_equals($mac, '01:80:C2:00:00:1E')) $app = 'All DTR Concentrators MAC group address'; |
722 | if (mac_equals($mac, '01:80:C2:00:00:1E')) $app = 'All DTR Concentrators MAC group address'; |
699 | if (mac_equals($mac, '01:80:C2:00:00:1F')) $app = 'EDE-CC PEP Address'; |
723 | if (mac_equals($mac, '01:80:C2:00:00:1F')) $app = 'EDE-CC PEP Address'; |
700 | 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'; |
724 | 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'; |
701 | 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'; |
725 | 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'; |
702 | if (mac_equals($mac, '01:80:C2:00:00:03')) $app = 'Nearest non-TPMR Bridge group address IEEE Std 802.1X PAE address'; |
726 | if (mac_equals($mac, '01:80:C2:00:00:03')) $app = 'Nearest non-TPMR Bridge group address IEEE Std 802.1X PAE address'; |
703 | if (mac_equals($mac, '01:80:C2:00:00:03')) $app = 'Link Layer Discovery Protocol, EtherType is 0x88CC'; |
727 | if (mac_equals($mac, '01:80:C2:00:00:03')) $app = 'Link Layer Discovery Protocol, EtherType is 0x88CC'; |
704 | if (mac_equals($mac, '01:80:C2:00:00:04')) $app = 'IEEE MAC-specific Control Protocols group address'; |
728 | if (mac_equals($mac, '01:80:C2:00:00:04')) $app = 'IEEE MAC-specific Control Protocols group address'; |
705 | if (mac_equals($mac, '01:80:C2:00:00:05')) $app = 'Reserved for future standardization'; |
729 | if (mac_equals($mac, '01:80:C2:00:00:05')) $app = 'Reserved for future standardization'; |
706 | if (mac_equals($mac, '01:80:C2:00:00:06')) $app = 'Reserved for future standardization'; |
730 | if (mac_equals($mac, '01:80:C2:00:00:06')) $app = 'Reserved for future standardization'; |
707 | if (mac_equals($mac, '01:80:C2:00:00:07')) $app = 'MEF Forum ELMI protocol group address'; |
731 | if (mac_equals($mac, '01:80:C2:00:00:07')) $app = 'MEF Forum ELMI protocol group address'; |
708 | if (mac_equals($mac, '01:80:C2:00:00:08')) $app = 'Provider Bridge group address'; |
732 | if (mac_equals($mac, '01:80:C2:00:00:08')) $app = 'Provider Bridge group address'; |
709 | if (mac_equals($mac, '01:80:C2:00:00:08')) $app = 'Spanning Tree Protocol (for provider bridges) IEEE 802.1ad, EtherType is 0x0802'; |
733 | if (mac_equals($mac, '01:80:C2:00:00:08')) $app = 'Spanning Tree Protocol (for provider bridges) IEEE 802.1ad, EtherType is 0x0802'; |
710 | if (mac_equals($mac, '01:80:C2:00:00:09')) $app = 'Reserved for future standardization'; |
734 | if (mac_equals($mac, '01:80:C2:00:00:09')) $app = 'Reserved for future standardization'; |
711 | if (mac_equals($mac, '01:80:C2:00:00:10')) $app = 'All LANs Bridge Management group address (deprecated)'; |
735 | if (mac_equals($mac, '01:80:C2:00:00:10')) $app = 'All LANs Bridge Management group address (deprecated)'; |
712 | if (mac_equals($mac, '01:80:C2:00:00:10')) $app = 'Bridge Management, EtherType is 0x0802'; |
736 | if (mac_equals($mac, '01:80:C2:00:00:10')) $app = 'Bridge Management, EtherType is 0x0802'; |
713 | if (mac_equals($mac, '01:80:C2:00:00:11')) $app = 'Load Server generic address'; |
737 | if (mac_equals($mac, '01:80:C2:00:00:11')) $app = 'Load Server generic address'; |
714 | if (mac_equals($mac, '01:80:C2:00:00:11')) $app = 'Load Server, EtherType is 0x0802'; |
738 | if (mac_equals($mac, '01:80:C2:00:00:11')) $app = 'Load Server, EtherType is 0x0802'; |
715 | if (mac_equals($mac, '01:80:C2:00:00:12')) $app = 'Loadable Device generic address'; |
739 | if (mac_equals($mac, '01:80:C2:00:00:12')) $app = 'Loadable Device generic address'; |
716 | if (mac_equals($mac, '01:80:C2:00:00:12')) $app = 'Loadable Device, EtherType is 0x0802'; |
740 | if (mac_equals($mac, '01:80:C2:00:00:12')) $app = 'Loadable Device, EtherType is 0x0802'; |
717 | if (mac_equals($mac, '01:80:C2:00:00:13')) $app = 'Transmission of IEEE 1905.1 control packets'; |
741 | if (mac_equals($mac, '01:80:C2:00:00:13')) $app = 'Transmission of IEEE 1905.1 control packets'; |
718 | if (mac_equals($mac, '01:80:C2:00:00:14')) $app = 'All Level 1 Intermediate Systems address'; |
742 | if (mac_equals($mac, '01:80:C2:00:00:14')) $app = 'All Level 1 Intermediate Systems address'; |
719 | if (mac_equals($mac, '01:80:C2:00:00:14')) $app = 'OSI Route level 1 (within area), EtherType is 0x0802'; |
743 | if (mac_equals($mac, '01:80:C2:00:00:14')) $app = 'OSI Route level 1 (within area), EtherType is 0x0802'; |
720 | if (mac_equals($mac, '01:80:C2:00:00:15')) $app = 'All Level 2 Intermediate Systems address'; |
744 | if (mac_equals($mac, '01:80:C2:00:00:15')) $app = 'All Level 2 Intermediate Systems address'; |
721 | if (mac_equals($mac, '01:80:C2:00:00:15')) $app = 'OSI Route level 2 (between area), EtherType is 0x0802'; |
745 | if (mac_equals($mac, '01:80:C2:00:00:15')) $app = 'OSI Route level 2 (between area), EtherType is 0x0802'; |
722 | if (mac_equals($mac, '01:80:C2:00:00:16')) $app = 'All CONS End Systems address'; |
746 | if (mac_equals($mac, '01:80:C2:00:00:16')) $app = 'All CONS End Systems address'; |
723 | if (mac_equals($mac, '01:80:C2:00:00:17')) $app = 'All CONS SNARES address'; |
747 | if (mac_equals($mac, '01:80:C2:00:00:17')) $app = 'All CONS SNARES address'; |
724 | if (mac_equals($mac, '01:80:C2:00:00:18')) $app = 'Generic address for All Manager Stations'; |
748 | if (mac_equals($mac, '01:80:C2:00:00:18')) $app = 'Generic address for All Manager Stations'; |
725 | if (mac_equals($mac, '01:80:C2:00:00:19')) $app = 'Groupcast with retries (GCR) MAC group address'; |
749 | if (mac_equals($mac, '01:80:C2:00:00:19')) $app = 'Groupcast with retries (GCR) MAC group address'; |
726 | 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'; |
750 | 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'; |
727 | 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'; |
751 | 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'; |
728 | 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'; |
752 | 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'; |
729 | 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'; |
753 | 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'; |
730 | if (mac_between($mac, '01:80:C2:00:00:50', '01:80:C2:00:00:FF')) $app = 'Unassigned standard group MAC address'; |
754 | if (mac_between($mac, '01:80:C2:00:00:50', '01:80:C2:00:00:FF')) $app = 'Unassigned standard group MAC address'; |
731 | if (mac_equals($mac, '01:80:C2:00:01:00')) $app = 'Ring Management Directed Beacon multicast address'; |
755 | if (mac_equals($mac, '01:80:C2:00:01:00')) $app = 'Ring Management Directed Beacon multicast address'; |
732 | if (mac_equals($mac, '01:80:C2:00:01:00')) $app = 'FDDI RMT Directed Beacon, EtherType is 0x0802'; |
756 | if (mac_equals($mac, '01:80:C2:00:01:00')) $app = 'FDDI RMT Directed Beacon, EtherType is 0x0802'; |
733 | 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'; |
757 | 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'; |
734 | if (mac_equals($mac, '01:80:C2:00:01:10')) $app = 'Status Report Frame Status Report Protocol multicast address'; |
758 | if (mac_equals($mac, '01:80:C2:00:01:10')) $app = 'Status Report Frame Status Report Protocol multicast address'; |
735 | if (mac_equals($mac, '01:80:C2:00:01:10')) $app = 'FDDI status report frame, EtherType is 0x0802'; |
759 | if (mac_equals($mac, '01:80:C2:00:01:10')) $app = 'FDDI status report frame, EtherType is 0x0802'; |
736 | 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'; |
760 | 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'; |
737 | if (mac_equals($mac, '01:80:C2:00:01:20')) $app = 'All FDDI Concentrator MACs'; |
761 | if (mac_equals($mac, '01:80:C2:00:01:20')) $app = 'All FDDI Concentrator MACs'; |
738 | 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'; |
762 | 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'; |
739 | if (mac_equals($mac, '01:80:C2:00:01:30')) $app = 'Synchronous Bandwidth Allocation address'; |
763 | if (mac_equals($mac, '01:80:C2:00:01:30')) $app = 'Synchronous Bandwidth Allocation address'; |
740 | 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'; |
764 | 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'; |
741 | if (mac_between($mac, '01:80:C2:00:02:00', '01:80:C2:00:02:FF')) $app = 'Assigned to ETSI for future use'; |
765 | if (mac_between($mac, '01:80:C2:00:02:00', '01:80:C2:00:02:FF')) $app = 'Assigned to ETSI for future use'; |
742 | if (mac_between($mac, '01:80:C2:00:03:00', '01:80:C2:FF-FF-FF')) $app = 'Unassigned standard group MAC address'; |
766 | if (mac_between($mac, '01:80:C2:00:03:00', '01:80:C2:FF-FF-FF')) $app = 'Unassigned standard group MAC address'; |
743 | if (mac_equals($mac, '09:00:4C:00:00:00')) $app = 'BICC 802.1 management, EtherType is 0x0802'; |
767 | if (mac_equals($mac, '09:00:4C:00:00:00')) $app = 'BICC 802.1 management, EtherType is 0x0802'; |
744 | if (mac_equals($mac, '09:00:4C:00:00:0C')) $app = 'BICC Remote bridge STA 802.1(D) Rev8, EtherType is 0x0802'; |
768 | if (mac_equals($mac, '09:00:4C:00:00:0C')) $app = 'BICC Remote bridge STA 802.1(D) Rev8, EtherType is 0x0802'; |
745 | if (mac_equals($mac, '09:00:4C:00:00:02')) $app = 'BICC 802.1 management, EtherType is 0x0802'; |
769 | if (mac_equals($mac, '09:00:4C:00:00:02')) $app = 'BICC 802.1 management, EtherType is 0x0802'; |
746 | if (mac_equals($mac, '09:00:4C:00:00:06')) $app = 'BICC Local bridge STA 802.1(D) Rev6, EtherType is 0x0802'; |
770 | if (mac_equals($mac, '09:00:4C:00:00:06')) $app = 'BICC Local bridge STA 802.1(D) Rev6, EtherType is 0x0802'; |
747 | if (mac_between($mac, '33:33:00:00:00:00', '33:33:FF:FF:FF:FF')) $app = 'IPv6 multicast, EtherType is 0x86DD'; |
771 | if (mac_between($mac, '33:33:00:00:00:00', '33:33:FF:FF:FF:FF')) $app = 'IPv6 multicast, EtherType is 0x86DD'; |
748 | 772 | ||
749 | // === FAQ "How to recognise an ISO 9542 ES-IS protocol's MAC address application?" === |
773 | // === FAQ "How to recognise an ISO 9542 ES-IS protocol's MAC address application?" === |
750 | // https://standards.ieee.org/products-services/regauth/grpmac/public.html |
774 | // https://standards.ieee.org/products-services/regauth/grpmac/public.html |
751 | if (mac_equals($mac, '09:00:2B:00:00:04')) $app = 'All End System Network Entities address'; |
775 | if (mac_equals($mac, '09:00:2B:00:00:04')) $app = 'All End System Network Entities address'; |
752 | if (mac_equals($mac, '09:00:2B:00:00:05')) $app = 'All Intermediate System Network Entities address'; |
776 | if (mac_equals($mac, '09:00:2B:00:00:05')) $app = 'All Intermediate System Network Entities address'; |
753 | 777 | ||
754 | // === FAQ "How to recognise an IANA MAC address application?" === |
778 | // === FAQ "How to recognise an IANA MAC address application?" === |
755 | // https://www.iana.org/assignments/ethernet-numbers/ethernet-numbers.xhtml |
779 | // https://www.iana.org/assignments/ethernet-numbers/ethernet-numbers.xhtml |
756 | // http://www.iana.org/go/rfc7042 |
780 | // http://www.iana.org/go/rfc7042 |
757 | // https://tools.ietf.org/html/rfc1060 |
781 | // https://tools.ietf.org/html/rfc1060 |
758 | if (mac_between($mac, '00:00:5E:00-52:14', '00:00:5E:00:52:FF')) $app = 'Unassigned (small allocations)'; |
782 | if (mac_between($mac, '00:00:5E:00-52:14', '00:00:5E:00:52:FF')) $app = 'Unassigned (small allocations)'; |
759 | if (mac_between($mac, '00:00:5E:00:00:00', '00:00:5E:00:00:FF')) $app = 'Reserved and require IESG Ratification for assignment'; |
783 | if (mac_between($mac, '00:00:5E:00:00:00', '00:00:5E:00:00:FF')) $app = 'Reserved and require IESG Ratification for assignment'; |
760 | if (mac_between($mac, '00:00:5E:00:03:00', '00:00:5E:00:51:FF')) $app = 'Unassigned'; |
784 | if (mac_between($mac, '00:00:5E:00:03:00', '00:00:5E:00:51:FF')) $app = 'Unassigned'; |
761 | 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.'; |
785 | 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.'; |
762 | if (mac_between($mac, '00:00:5E:00:52:00', '00:00:5E:00:52:00')) $app = 'PacketPWEthA'; |
786 | if (mac_between($mac, '00:00:5E:00:52:00', '00:00:5E:00:52:00')) $app = 'PacketPWEthA'; |
763 | if (mac_between($mac, '00:00:5E:00:52:01', '00:00:5E:00:52:01')) $app = 'PacketPWEthB'; |
787 | if (mac_between($mac, '00:00:5E:00:52:01', '00:00:5E:00:52:01')) $app = 'PacketPWEthB'; |
764 | if (mac_between($mac, '00:00:5E:00:52:02', '00:00:5E:00:52:12')) $app = 'Unassigned (small allocations)'; |
788 | if (mac_between($mac, '00:00:5E:00:52:02', '00:00:5E:00:52:12')) $app = 'Unassigned (small allocations)'; |
765 | if (mac_between($mac, '00:00:5E:00:53:00', '00:00:5E:00:53:FF')) $app = 'Assigned for use in documentation'; |
789 | if (mac_between($mac, '00:00:5E:00:53:00', '00:00:5E:00:53:FF')) $app = 'Assigned for use in documentation'; |
766 | if (mac_between($mac, '00:00:5E:00:54:00', '00:00:5E:90:00:FF')) $app = 'Unassigned'; |
790 | if (mac_between($mac, '00:00:5E:00:54:00', '00:00:5E:90:00:FF')) $app = 'Unassigned'; |
767 | 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)'; |
791 | 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)'; |
768 | if (mac_between($mac, '00:00:5E:EF:10:00:00:00', '00:00:5E:EF:10:00:00:FF')) $app = 'General documentation'; |
792 | if (mac_between($mac, '00:00:5E:EF:10:00:00:00', '00:00:5E:EF:10:00:00:FF')) $app = 'General documentation'; |
769 | 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'; |
793 | 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'; |
770 | 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.) |
794 | 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.) |
771 | if (mac_between($mac, '01:00:5E:80:00:00', '01:00:5E:FF:FF:FF')) $app = 'DoD Internet'; |
795 | if (mac_between($mac, '01:00:5E:80:00:00', '01:00:5E:FF:FF:FF')) $app = 'DoD Internet'; |
772 | if (mac_equals($mac, '01:00:5E:90:00:02')) $app = 'AllL1MI-ISs'; |
796 | if (mac_equals($mac, '01:00:5E:90:00:02')) $app = 'AllL1MI-ISs'; |
773 | if (mac_equals($mac, '01:00:5E:90:00:03')) $app = 'AllL2MI-ISs'; |
797 | if (mac_equals($mac, '01:00:5E:90:00:03')) $app = 'AllL2MI-ISs'; |
774 | if (mac_between($mac, '01:00:5E:90:00:04', '01:00:5E:90:00:FF')) $app = 'Unassigned (small allocations)'; |
798 | if (mac_between($mac, '01:00:5E:90:00:04', '01:00:5E:90:00:FF')) $app = 'Unassigned (small allocations)'; |
775 | 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)'; |
799 | 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)'; |
776 | if (mac_between($mac, '01:00:5E:90:02:00', '01:00:5E:90:0F:FF')) $app = 'Unassigned'; |
800 | if (mac_between($mac, '01:00:5E:90:02:00', '01:00:5E:90:0F:FF')) $app = 'Unassigned'; |
777 | if (mac_between($mac, '01:00:5E:90:02:00', '00:00:5E:FF:FF:FF')) $app = 'Unassigned'; |
801 | if (mac_between($mac, '01:00:5E:90:02:00', '00:00:5E:FF:FF:FF')) $app = 'Unassigned'; |
778 | if (mac_between($mac, '01:00:5E:90:10:00', '01:00:5E:90:10:FF')) $app = 'Documentation'; |
802 | if (mac_between($mac, '01:00:5E:90:10:00', '01:00:5E:90:10:FF')) $app = 'Documentation'; |
779 | if (mac_between($mac, '01:00:5E:90:11:00', '01:00:5E:FF:FF:FF')) $app = 'Unassigned'; |
803 | if (mac_between($mac, '01:00:5E:90:11:00', '01:00:5E:FF:FF:FF')) $app = 'Unassigned'; |
780 | if (mac_between($mac, '01:00:5E:EF:10:00:00:00', '01:00:5E:EF:10:00:00:FF')) $app = 'General documentation'; |
804 | if (mac_between($mac, '01:00:5E:EF:10:00:00:00', '01:00:5E:EF:10:00:00:FF')) $app = 'General documentation'; |
781 | if (mac_between($mac, '02:00:5E:00:00:00:00:00', '02:00:5E:0F:FF:FF:FF:FF')) $app = 'Reserved'; |
805 | if (mac_between($mac, '02:00:5E:00:00:00:00:00', '02:00:5E:0F:FF:FF:FF:FF')) $app = 'Reserved'; |
782 | if (mac_between($mac, '02:00:5E:10:00:00:00:00', '02:00:5E:10:00:00:00:FF')) $app = 'Documentation'; |
806 | if (mac_between($mac, '02:00:5E:10:00:00:00:00', '02:00:5E:10:00:00:00:FF')) $app = 'Documentation'; |
783 | if (mac_between($mac, '02:00:5E:10:00:00:01:00', '02:00:5E:EF:FF:FF:FF:FF')) $app = 'Unassigned'; |
807 | if (mac_between($mac, '02:00:5E:10:00:00:01:00', '02:00:5E:EF:FF:FF:FF:FF')) $app = 'Unassigned'; |
784 | if (mac_between($mac, '02:00:5E:F0:00:00:00:00', '02:00:5E:FD:FF:FF:FF:FF')) $app = 'Reserved'; |
808 | if (mac_between($mac, '02:00:5E:F0:00:00:00:00', '02:00:5E:FD:FF:FF:FF:FF')) $app = 'Reserved'; |
785 | if (mac_between($mac, '02:00:5E:FE:00:00:00:00', '02:00:5E:FE:FF:FF:FF:FF')) $app = 'IPv4 Addr Holders'; |
809 | if (mac_between($mac, '02:00:5E:FE:00:00:00:00', '02:00:5E:FE:FF:FF:FF:FF')) $app = 'IPv4 Addr Holders'; |
786 | if (mac_between($mac, '02:00:5E:FF:00:00:00:00', '02:00:5E:FF:FD:FF:FF:FF')) $app = 'Reserved'; |
810 | if (mac_between($mac, '02:00:5E:FF:00:00:00:00', '02:00:5E:FF:FD:FF:FF:FF')) $app = 'Reserved'; |
787 | 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'; |
811 | 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'; |
788 | if (mac_between($mac, '02:00:5E:FF:FF:00:00:00', '02:00:5E:FF:FF:FF:FF:FF')) $app = 'Reserved'; |
812 | if (mac_between($mac, '02:00:5E:FF:FF:00:00:00', '02:00:5E:FF:FF:FF:FF:FF')) $app = 'Reserved'; |
789 | if (mac_between($mac, '03:00:5E:00:00:00:00:00', '03:00:5E:0F:FF:FF:FF:FF')) $app = 'Reserved'; |
813 | if (mac_between($mac, '03:00:5E:00:00:00:00:00', '03:00:5E:0F:FF:FF:FF:FF')) $app = 'Reserved'; |
790 | if (mac_between($mac, '03:00:5E:10:00:00:00:00', '03:00:5E:10:00:00:00:FF')) $app = 'Documentation'; |
814 | if (mac_between($mac, '03:00:5E:10:00:00:00:00', '03:00:5E:10:00:00:00:FF')) $app = 'Documentation'; |
791 | if (mac_between($mac, '03:00:5E:10:00:00:01:00', '03:00:5E:EF:FF:FF:FF:FF')) $app = 'Unassigned'; |
815 | if (mac_between($mac, '03:00:5E:10:00:00:01:00', '03:00:5E:EF:FF:FF:FF:FF')) $app = 'Unassigned'; |
792 | if (mac_between($mac, '03:00:5E:F0:00:00:00:00', '03:00:5E:FD:FF:FF:FF:FF')) $app = 'Reserved'; |
816 | if (mac_between($mac, '03:00:5E:F0:00:00:00:00', '03:00:5E:FD:FF:FF:FF:FF')) $app = 'Reserved'; |
793 | if (mac_between($mac, '03:00:5E:FF:00:00:00:00', '03:00:5E:FF:FD:FF:FF:FF')) $app = 'Reserved'; |
817 | if (mac_between($mac, '03:00:5E:FF:00:00:00:00', '03:00:5E:FF:FD:FF:FF:FF')) $app = 'Reserved'; |
794 | 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'; |
818 | 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'; |
795 | if (mac_between($mac, '03:00:5E:FF:FF:00:00:00', '03:00:5E:FF:FF:FF:FF:FF')) $app = 'Reserved'; |
819 | if (mac_between($mac, '03:00:5E:FF:FF:00:00:00', '03:00:5E:FF:FF:FF:FF:FF')) $app = 'Reserved'; |
796 | 820 | ||
797 | // === FAQ "How to recognise a Cisco's MAC address application?" === |
821 | // === FAQ "How to recognise a Cisco's MAC address application?" === |
798 | // https://www.cisco.com/c/en/us/support/docs/switches/catalyst-4500-series-switches/13414-103.html |
822 | // https://www.cisco.com/c/en/us/support/docs/switches/catalyst-4500-series-switches/13414-103.html |
799 | // https://tools.ietf.org/html/rfc1060 |
823 | // https://tools.ietf.org/html/rfc1060 |
800 | // https://en.wikipedia.org/wiki/Multicast_address#cite_note-15 |
824 | // https://en.wikipedia.org/wiki/Multicast_address#cite_note-15 |
801 | // http://www.cavebear.com/archive/cavebear/Ethernet/Ethernet.txt |
825 | // http://www.cavebear.com/archive/cavebear/Ethernet/Ethernet.txt |
802 | if (mac_equals($mac, '01:00:0C:00:00:00')) $app = 'Inter Switch Link (ISL)'; |
826 | if (mac_equals($mac, '01:00:0C:00:00:00')) $app = 'Inter Switch Link (ISL)'; |
803 | if (mac_equals($mac, '01:00:0C:CC:CC:CC')) $app = 'CDP (Cisco Discovery Protocol), VTP (VLAN Trunking Protocol), EtherType is 0x0802'; |
827 | if (mac_equals($mac, '01:00:0C:CC:CC:CC')) $app = 'CDP (Cisco Discovery Protocol), VTP (VLAN Trunking Protocol), EtherType is 0x0802'; |
804 | if (mac_equals($mac, '01:00:0C:CC:CC:CC')) $app = 'Port Aggregation Protocol (PAgP), SNAP HDLC Protocol Type is 0x0104'; |
828 | if (mac_equals($mac, '01:00:0C:CC:CC:CC')) $app = 'Port Aggregation Protocol (PAgP), SNAP HDLC Protocol Type is 0x0104'; |
805 | if (mac_equals($mac, '01:00:0C:CC:CC:CC')) $app = 'Unidirectional Link Detection (UDLD), SNAP HDLC Protocol Type is 0x0111'; |
829 | if (mac_equals($mac, '01:00:0C:CC:CC:CC')) $app = 'Unidirectional Link Detection (UDLD), SNAP HDLC Protocol Type is 0x0111'; |
806 | if (mac_equals($mac, '01:00:0C:CC:CC:CC')) $app = 'Dynamic Trunking (DTP), SNAP HDLC Protocol Type is 0x2004'; |
830 | if (mac_equals($mac, '01:00:0C:CC:CC:CC')) $app = 'Dynamic Trunking (DTP), SNAP HDLC Protocol Type is 0x2004'; |
807 | if (mac_equals($mac, '01:00:0C:CC:CC:CC')) $app = 'VLAN Trunking (VTP), SNAP HDLC Protocol Type is 0x2003'; |
831 | if (mac_equals($mac, '01:00:0C:CC:CC:CC')) $app = 'VLAN Trunking (VTP), SNAP HDLC Protocol Type is 0x2003'; |
808 | if (mac_equals($mac, '01:00:0C:CC:CC:CD')) $app = 'Cisco Shared Spanning Tree Protocol address, EtherType is 0x0802'; |
832 | if (mac_equals($mac, '01:00:0C:CC:CC:CD')) $app = 'Cisco Shared Spanning Tree Protocol address, EtherType is 0x0802'; |
809 | if (mac_equals($mac, '01:00:0C:CC:CC:CD')) $app = 'Spanning Tree PVSTP+, SNAP HDLC Protocol Type is 0x010B'; |
833 | if (mac_equals($mac, '01:00:0C:CC:CC:CD')) $app = 'Spanning Tree PVSTP+, SNAP HDLC Protocol Type is 0x010B'; |
810 | if (mac_equals($mac, '01:00:0C:CD:CD:CD')) $app = 'STP Uplink Fast, SNAP HDLC Protocol Type is 0x200A'; |
834 | if (mac_equals($mac, '01:00:0C:CD:CD:CD')) $app = 'STP Uplink Fast, SNAP HDLC Protocol Type is 0x200A'; |
811 | if (mac_equals($mac, '01:00:0C:CD:CD:CE')) $app = 'VLAN Bridge, SNAP HDLC Protocol Type is 0x010C'; |
835 | if (mac_equals($mac, '01:00:0C:CD:CD:CE')) $app = 'VLAN Bridge, SNAP HDLC Protocol Type is 0x010C'; |
812 | if (mac_equals($mac, '01:00:0C:DD:DD:DD')) $app = 'CGMP (Cisco Group Management Protocol)'; |
836 | if (mac_equals($mac, '01:00:0C:DD:DD:DD')) $app = 'CGMP (Cisco Group Management Protocol)'; |
813 | 837 | ||
814 | // === FAQ "How to recognise an ITU-T's MAC address application?" === |
838 | // === FAQ "How to recognise an ITU-T's MAC address application?" === |
815 | // https://www.itu.int/en/ITU-T/studygroups/2017-2020/15/Documents/IEEE-assigned_OUIs-30-06-2017.docx |
839 | // https://www.itu.int/en/ITU-T/studygroups/2017-2020/15/Documents/IEEE-assigned_OUIs-30-06-2017.docx |
816 | if (mac_between($mac, '01:19:A7:00:00:00', '01:19:A7:00:00:FF')) $app = 'R-APS per G.8032'; |
840 | if (mac_between($mac, '01:19:A7:00:00:00', '01:19:A7:00:00:FF')) $app = 'R-APS per G.8032'; |
817 | if (mac_between($mac, '01:19:A7:52:76:90', '01:19:A7:52:76:9F')) $app = 'Multicast per G.9961'; |
841 | if (mac_between($mac, '01:19:A7:52:76:90', '01:19:A7:52:76:9F')) $app = 'Multicast per G.9961'; |
818 | 842 | ||
819 | // === FAQ "How to recognise Digital Equipment Corporation's MAC address application?" === |
843 | // === FAQ "How to recognise Digital Equipment Corporation's MAC address application?" === |
820 | if (mac_equals($mac, '09:00:2B:00:00:00')) $app = 'DEC MUMPS, EtherType is 0x6009'; |
844 | if (mac_equals($mac, '09:00:2B:00:00:00')) $app = 'DEC MUMPS, EtherType is 0x6009'; |
821 | if (mac_equals($mac, '09:00:2B:00:00:0F')) $app = 'DEC Local Area Transport (LAT), EtherType is 0x6004'; |
845 | if (mac_equals($mac, '09:00:2B:00:00:0F')) $app = 'DEC Local Area Transport (LAT), EtherType is 0x6004'; |
822 | if (mac_equals($mac, '09:00:2B:00:00:01')) $app = 'DEC DSM/DDP, EtherType is 0x8039'; |
846 | if (mac_equals($mac, '09:00:2B:00:00:01')) $app = 'DEC DSM/DDP, EtherType is 0x8039'; |
823 | if (mac_between($mac, '09:00:2B:00:00:10', '09:00:2B:00:00:1F')) $app = 'DEC Experimental'; |
847 | if (mac_between($mac, '09:00:2B:00:00:10', '09:00:2B:00:00:1F')) $app = 'DEC Experimental'; |
824 | if (mac_equals($mac, '09:00:2B:00:00:02')) $app = 'DEC VAXELN, EtherType is 0x803B'; |
848 | if (mac_equals($mac, '09:00:2B:00:00:02')) $app = 'DEC VAXELN, EtherType is 0x803B'; |
825 | if (mac_equals($mac, '09:00:2B:00:00:03')) $app = 'DEC Lanbridge Traffic Monitor (LTM), EtherType is 0x8038'; |
849 | if (mac_equals($mac, '09:00:2B:00:00:03')) $app = 'DEC Lanbridge Traffic Monitor (LTM), EtherType is 0x8038'; |
826 | if (mac_equals($mac, '09:00:2B:00:00:04')) $app = 'DEC MAP End System'; |
850 | if (mac_equals($mac, '09:00:2B:00:00:04')) $app = 'DEC MAP End System'; |
827 | if (mac_equals($mac, '09:00:2B:00:00:05')) $app = 'DEC MAP Intermediate System'; |
851 | if (mac_equals($mac, '09:00:2B:00:00:05')) $app = 'DEC MAP Intermediate System'; |
828 | if (mac_equals($mac, '09:00:2B:00:00:06')) $app = 'DEC CSMA/CD Encryption, EtherType is 0x803D'; |
852 | if (mac_equals($mac, '09:00:2B:00:00:06')) $app = 'DEC CSMA/CD Encryption, EtherType is 0x803D'; |
829 | if (mac_equals($mac, '09:00:2B:00:00:07')) $app = 'DEC NetBios Emulator, EtherType is 0x8040'; |
853 | if (mac_equals($mac, '09:00:2B:00:00:07')) $app = 'DEC NetBios Emulator, EtherType is 0x8040'; |
830 | if (mac_equals($mac, '09:00:2B:01:00:00')) $app = 'DEC LanBridge, EtherType is 0x8038'; |
854 | if (mac_equals($mac, '09:00:2B:01:00:00')) $app = 'DEC LanBridge, EtherType is 0x8038'; |
831 | if (mac_equals($mac, '09:00:2B:01:00:01')) $app = 'DEC LanBridge, EtherType is 0x8038'; |
855 | if (mac_equals($mac, '09:00:2B:01:00:01')) $app = 'DEC LanBridge, EtherType is 0x8038'; |
832 | if (mac_equals($mac, '09:00:2B:02:00:00')) $app = 'DEC DNA Level 2 Routing'; |
856 | if (mac_equals($mac, '09:00:2B:02:00:00')) $app = 'DEC DNA Level 2 Routing'; |
833 | if (mac_equals($mac, '09:00:2B:02:01:00')) $app = 'DEC DNA Naming Service Advertisement, EtherType is 0x803C'; |
857 | if (mac_equals($mac, '09:00:2B:02:01:00')) $app = 'DEC DNA Naming Service Advertisement, EtherType is 0x803C'; |
834 | if (mac_equals($mac, '09:00:2B:02:01:01')) $app = 'DEC DNA Naming Service Solicitation, EtherType is 0x803C'; |
858 | if (mac_equals($mac, '09:00:2B:02:01:01')) $app = 'DEC DNA Naming Service Solicitation, EtherType is 0x803C'; |
835 | if (mac_equals($mac, '09:00:2B:02:01:02')) $app = 'DEC Distributed Time Service, EtherType is 0x803E'; |
859 | if (mac_equals($mac, '09:00:2B:02:01:02')) $app = 'DEC Distributed Time Service, EtherType is 0x803E'; |
836 | if (mac_equals($mac, '09:00:2B:02:01:09')) $app = 'DEC Availability Manager for Distributed Systems DECamds, EtherType is 0x8048'; |
860 | if (mac_equals($mac, '09:00:2B:02:01:09')) $app = 'DEC Availability Manager for Distributed Systems DECamds, EtherType is 0x8048'; |
837 | if (mac_between($mac, '09:00:2B:03:00:00', '09:00:2B:03:FF:FF')) $app = 'DEC default filtering by bridges'; |
861 | if (mac_between($mac, '09:00:2B:03:00:00', '09:00:2B:03:FF:FF')) $app = 'DEC default filtering by bridges'; |
838 | if (mac_equals($mac, '09:00:2B:04:00:00')) $app = 'DEC Local Area System Transport (LAST), EtherType is 0x8041'; |
862 | if (mac_equals($mac, '09:00:2B:04:00:00')) $app = 'DEC Local Area System Transport (LAST), EtherType is 0x8041'; |
839 | if (mac_equals($mac, '09:00:2B:23:00:00')) $app = 'DEC Argonaut Console, EtherType is 0x803A'; |
863 | if (mac_equals($mac, '09:00:2B:23:00:00')) $app = 'DEC Argonaut Console, EtherType is 0x803A'; |
840 | if (mac_equals($mac, 'AB:00:00:01:00:00')) $app = 'DEC Maintenance Operation Protocol (MOP) Dump/Load Assistance, EtherType is 0x6001'; |
864 | if (mac_equals($mac, 'AB:00:00:01:00:00')) $app = 'DEC Maintenance Operation Protocol (MOP) Dump/Load Assistance, EtherType is 0x6001'; |
841 | if (mac_equals($mac, 'AB:00:00:02:00:00')) $app = 'DEC Maintenance Operation Protocol (MOP), EtherType is 0x6002'; |
865 | if (mac_equals($mac, 'AB:00:00:02:00:00')) $app = 'DEC Maintenance Operation Protocol (MOP), EtherType is 0x6002'; |
842 | if (mac_equals($mac, 'AB:00:00:03:00:00')) $app = 'DECNET Phase IV end node, EtherType is 0x6003'; |
866 | if (mac_equals($mac, 'AB:00:00:03:00:00')) $app = 'DECNET Phase IV end node, EtherType is 0x6003'; |
843 | if (mac_equals($mac, 'AB:00:00:04:00:00')) $app = 'DECNET Phase IV Router, EtherType is 0x6003'; |
867 | if (mac_equals($mac, 'AB:00:00:04:00:00')) $app = 'DECNET Phase IV Router, EtherType is 0x6003'; |
844 | if (mac_between($mac, 'AB:00:00:05:00:00', 'AB:00:03:FF:FF:FF')) $app = 'Reserved DEC'; |
868 | if (mac_between($mac, 'AB:00:00:05:00:00', 'AB:00:03:FF:FF:FF')) $app = 'Reserved DEC'; |
845 | if (mac_equals($mac, 'AB:00:03:00:00:00')) $app = 'DEC Local Area Transport (LAT) - old, EtherType is 0x6004'; |
869 | if (mac_equals($mac, 'AB:00:03:00:00:00')) $app = 'DEC Local Area Transport (LAT) - old, EtherType is 0x6004'; |
846 | if (mac_between($mac, 'AB:00:04:00:00:00', 'AB:00:04:00:FF:FF')) $app = 'Reserved DEC customer private use'; |
870 | if (mac_between($mac, 'AB:00:04:00:00:00', 'AB:00:04:00:FF:FF')) $app = 'Reserved DEC customer private use'; |
847 | 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'; |
871 | 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'; |
848 | 872 | ||
849 | // https://standards.ieee.org/products-programs/regauth/grpmac/public/ |
873 | // https://standards.ieee.org/products-programs/regauth/grpmac/public/ |
850 | // TODO: Check for duplicates between these and the ones at the top |
874 | // TODO: Check for duplicates between these and the ones at the top |
851 | // IEEE Std 802.1D and IEEE Std 802.1Q Reserved Addresses |
875 | // IEEE Std 802.1D and IEEE Std 802.1Q Reserved Addresses |
852 | if (mac_equals($mac, '01-80-C2-00-00-00')) $app = 'IEEE Std 802.1Q / Bridge Group address, Nearest Customer Bridge group address'; |
876 | if (mac_equals($mac, '01-80-C2-00-00-00')) $app = 'IEEE Std 802.1Q / Bridge Group address, Nearest Customer Bridge group address'; |
853 | if (mac_equals($mac, '01-80-C2-00-00-01')) $app = 'IEEE Std 802.1Q / IEEE MAC-specific Control Protocols group address'; |
877 | if (mac_equals($mac, '01-80-C2-00-00-01')) $app = 'IEEE Std 802.1Q / IEEE MAC-specific Control Protocols group address'; |
854 | if (mac_equals($mac, '01-80-C2-00-00-02')) $app = 'IEEE Std 802.1Q / IEEE 802.3 Slow_Protocols_Multicast address'; |
878 | if (mac_equals($mac, '01-80-C2-00-00-02')) $app = 'IEEE Std 802.1Q / IEEE 802.3 Slow_Protocols_Multicast address'; |
855 | if (mac_equals($mac, '01-80-C2-00-00-03')) $app = 'IEEE Std 802.1Q / Nearest non-TPMR Bridge group address, IEEE Std 802.1X PAE address'; |
879 | if (mac_equals($mac, '01-80-C2-00-00-03')) $app = 'IEEE Std 802.1Q / Nearest non-TPMR Bridge group address, IEEE Std 802.1X PAE address'; |
856 | if (mac_equals($mac, '01-80-C2-00-00-04')) $app = 'IEEE Std 802.1Q / IEEE MAC-specific Control Protocols group address'; |
880 | if (mac_equals($mac, '01-80-C2-00-00-04')) $app = 'IEEE Std 802.1Q / IEEE MAC-specific Control Protocols group address'; |
857 | if (mac_equals($mac, '01-80-C2-00-00-05')) $app = 'IEEE Std 802.1Q / Reserved for future standardization'; |
881 | if (mac_equals($mac, '01-80-C2-00-00-05')) $app = 'IEEE Std 802.1Q / Reserved for future standardization'; |
858 | if (mac_equals($mac, '01-80-C2-00-00-06')) $app = 'IEEE Std 802.1Q / Reserved for future standardization'; |
882 | if (mac_equals($mac, '01-80-C2-00-00-06')) $app = 'IEEE Std 802.1Q / Reserved for future standardization'; |
859 | if (mac_equals($mac, '01-80-C2-00-00-07')) $app = 'IEEE Std 802.1Q / MEF Forum ELMI protocol group address'; |
883 | if (mac_equals($mac, '01-80-C2-00-00-07')) $app = 'IEEE Std 802.1Q / MEF Forum ELMI protocol group address'; |
860 | if (mac_equals($mac, '01-80-C2-00-00-08')) $app = 'IEEE Std 802.1Q / Provider Bridge group address'; |
884 | if (mac_equals($mac, '01-80-C2-00-00-08')) $app = 'IEEE Std 802.1Q / Provider Bridge group address'; |
861 | if (mac_equals($mac, '01-80-C2-00-00-09')) $app = 'IEEE Std 802.1Q / Reserved for future standardization'; |
885 | if (mac_equals($mac, '01-80-C2-00-00-09')) $app = 'IEEE Std 802.1Q / Reserved for future standardization'; |
862 | if (mac_equals($mac, '01-80-C2-00-00-0A')) $app = 'IEEE Std 802.1Q / Reserved for future standardization'; |
886 | if (mac_equals($mac, '01-80-C2-00-00-0A')) $app = 'IEEE Std 802.1Q / Reserved for future standardization'; |
863 | if (mac_equals($mac, '01-80-C2-00-00-0B')) $app = 'IEEE Std 802.1Q / EDE-SS PEP Address'; |
887 | if (mac_equals($mac, '01-80-C2-00-00-0B')) $app = 'IEEE Std 802.1Q / EDE-SS PEP Address'; |
864 | if (mac_equals($mac, '01-80-C2-00-00-0C')) $app = 'IEEE Std 802.1Q / Reserved for future standardization'; |
888 | if (mac_equals($mac, '01-80-C2-00-00-0C')) $app = 'IEEE Std 802.1Q / Reserved for future standardization'; |
865 | if (mac_equals($mac, '01-80-C2-00-00-0D')) $app = 'IEEE Std 802.1Q / Provider Bridge MVRP address'; |
889 | if (mac_equals($mac, '01-80-C2-00-00-0D')) $app = 'IEEE Std 802.1Q / Provider Bridge MVRP address'; |
866 | if (mac_equals($mac, '01-80-C2-00-00-0E')) $app = 'IEEE Std 802.1Q / Individual LAN Scope group address, Nearest Bridge group address'; |
890 | if (mac_equals($mac, '01-80-C2-00-00-0E')) $app = 'IEEE Std 802.1Q / Individual LAN Scope group address, Nearest Bridge group address'; |
867 | if (mac_equals($mac, '01-80-C2-00-00-0F')) $app = 'IEEE Std 802.1Q / Reserved for future standardization'; |
891 | if (mac_equals($mac, '01-80-C2-00-00-0F')) $app = 'IEEE Std 802.1Q / Reserved for future standardization'; |
868 | // Standard Group MAC Addresses |
892 | // Standard Group MAC Addresses |
869 | if (mac_equals($mac, '01-80-C2-00-00-10')) $app = 'All LANs Bridge Management Group Address (deprecated)'; |
893 | if (mac_equals($mac, '01-80-C2-00-00-10')) $app = 'All LANs Bridge Management Group Address (deprecated)'; |
870 | if (mac_equals($mac, '01-80-C2-00-00-11')) $app = 'Load Server Generic Address'; |
894 | if (mac_equals($mac, '01-80-C2-00-00-11')) $app = 'Load Server Generic Address'; |
871 | if (mac_equals($mac, '01-80-C2-00-00-12')) $app = 'Loadable Device Generic Address'; |
895 | if (mac_equals($mac, '01-80-C2-00-00-12')) $app = 'Loadable Device Generic Address'; |
872 | if (mac_equals($mac, '01-80-C2-00-00-13')) $app = 'Transmission of IEEE 1905.1 control packets'; |
896 | if (mac_equals($mac, '01-80-C2-00-00-13')) $app = 'Transmission of IEEE 1905.1 control packets'; |
873 | if (mac_equals($mac, '01-80-C2-00-00-14')) $app = 'All Level 1 Intermediate Systems Address'; |
897 | if (mac_equals($mac, '01-80-C2-00-00-14')) $app = 'All Level 1 Intermediate Systems Address'; |
874 | if (mac_equals($mac, '01-80-C2-00-00-15')) $app = 'All Level 2 Intermediate Systems Address'; |
898 | if (mac_equals($mac, '01-80-C2-00-00-15')) $app = 'All Level 2 Intermediate Systems Address'; |
875 | if (mac_equals($mac, '01-80-C2-00-00-16')) $app = 'All CONS End Systems Address'; |
899 | if (mac_equals($mac, '01-80-C2-00-00-16')) $app = 'All CONS End Systems Address'; |
876 | if (mac_equals($mac, '01-80-C2-00-00-17')) $app = 'All CONS SNARES Address'; |
900 | if (mac_equals($mac, '01-80-C2-00-00-17')) $app = 'All CONS SNARES Address'; |
877 | if (mac_equals($mac, '01-80-C2-00-00-18')) $app = 'Generic Address for All Manager Stations'; |
901 | if (mac_equals($mac, '01-80-C2-00-00-18')) $app = 'Generic Address for All Manager Stations'; |
878 | if (mac_equals($mac, '01-80-C2-00-00-19')) $app = 'Groupcast with retries (GCR) MAC Group Address'; |
902 | if (mac_equals($mac, '01-80-C2-00-00-19')) $app = 'Groupcast with retries (GCR) MAC Group Address'; |
879 | if (mac_equals($mac, '01-80-C2-00-00-1A')) $app = 'Generic Address for All Agent Stations'; |
903 | if (mac_equals($mac, '01-80-C2-00-00-1A')) $app = 'Generic Address for All Agent Stations'; |
880 | if (mac_equals($mac, '01-80-C2-00-00-1B')) $app = 'All Multicast Capable End Systems Address'; |
904 | if (mac_equals($mac, '01-80-C2-00-00-1B')) $app = 'All Multicast Capable End Systems Address'; |
881 | if (mac_equals($mac, '01-80-C2-00-00-1C')) $app = 'All Multicast Announcements Address'; |
905 | if (mac_equals($mac, '01-80-C2-00-00-1C')) $app = 'All Multicast Announcements Address'; |
882 | if (mac_equals($mac, '01-80-C2-00-00-1D')) $app = 'All Multicast Capable Intermediate Systems Address'; |
906 | if (mac_equals($mac, '01-80-C2-00-00-1D')) $app = 'All Multicast Capable Intermediate Systems Address'; |
883 | if (mac_equals($mac, '01-80-C2-00-00-1E')) $app = 'All DTR Concentrators MAC Group Address'; |
907 | if (mac_equals($mac, '01-80-C2-00-00-1E')) $app = 'All DTR Concentrators MAC Group Address'; |
884 | if (mac_equals($mac, '01-80-C2-00-00-1F')) $app = 'EDE-CC PEP Address'; |
908 | if (mac_equals($mac, '01-80-C2-00-00-1F')) $app = 'EDE-CC PEP Address'; |
885 | 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'; |
909 | 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'; |
886 | 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'; |
910 | 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'; |
887 | 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'; |
911 | 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'; |
888 | if (mac_between($mac, '01-80-C2-00-00-50','01-80-C2-00-00-FF')) $app = 'unassigned'; |
912 | if (mac_between($mac, '01-80-C2-00-00-50','01-80-C2-00-00-FF')) $app = 'unassigned'; |
889 | if (mac_equals($mac, '01-80-C2-00-01-00')) $app = 'Ring Management Directed Beacon Multicast Address'; |
913 | if (mac_equals($mac, '01-80-C2-00-01-00')) $app = 'Ring Management Directed Beacon Multicast Address'; |
890 | 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'; |
914 | 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'; |
891 | if (mac_equals($mac, '01-80-C2-00-01-10')) $app = 'Status Report Frame Status Report Protocol Multicast Address'; |
915 | if (mac_equals($mac, '01-80-C2-00-01-10')) $app = 'Status Report Frame Status Report Protocol Multicast Address'; |
892 | 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'; |
916 | 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'; |
893 | if (mac_equals($mac, '01-80-C2-00-01-20')) $app = 'ISO/IEC 9314-2 All FDDI Concentrator MACs'; |
917 | if (mac_equals($mac, '01-80-C2-00-01-20')) $app = 'ISO/IEC 9314-2 All FDDI Concentrator MACs'; |
894 | 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'; |
918 | 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'; |
895 | if (mac_equals($mac, '01-80-C2-00-01-30')) $app = 'ISO/IEC 9314-6 Synchronous Bandwidth Allocation Address'; |
919 | if (mac_equals($mac, '01-80-C2-00-01-30')) $app = 'ISO/IEC 9314-6 Synchronous Bandwidth Allocation Address'; |
896 | 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'; |
920 | 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'; |
897 | if (mac_between($mac, '01-80-C2-00-02-00','01-80-C2-00-02-FF')) $app = 'Assigned to ETSI for future use'; |
921 | if (mac_between($mac, '01-80-C2-00-02-00','01-80-C2-00-02-FF')) $app = 'Assigned to ETSI for future use'; |
898 | if (mac_between($mac, '01-80-C2-00-03-00', '01-80-C2-FF-FF-FF')) $app = 'unassigned'; |
922 | if (mac_between($mac, '01-80-C2-00-03-00', '01-80-C2-FF-FF-FF')) $app = 'unassigned'; |
899 | if (mac_equals($mac, '09-00-2B-00-00-04')) $app = 'ISO 9542 All End System Network Entities Address'; |
923 | if (mac_equals($mac, '09-00-2B-00-00-04')) $app = 'ISO 9542 All End System Network Entities Address'; |
900 | if (mac_equals($mac, '09-00-2B-00-00-05')) $app = 'ISO 9542 All Intermediate System Network Entities Address'; |
924 | if (mac_equals($mac, '09-00-2B-00-00-05')) $app = 'ISO 9542 All Intermediate System Network Entities Address'; |
901 | // Group MAC Addresses Used in ISO 9542 ES-IS Protocol |
925 | // Group MAC Addresses Used in ISO 9542 ES-IS Protocol |
902 | if (mac_equals($mac, '09-00-2B-00-00-04')) $app = 'ISO 9542 All End System Network Entities Address'; |
926 | if (mac_equals($mac, '09-00-2B-00-00-04')) $app = 'ISO 9542 All End System Network Entities Address'; |
903 | if (mac_equals($mac, '09-00-2B-00-00-05')) $app = 'ISO 9542 All Intermediate System Network Entities Address'; |
927 | if (mac_equals($mac, '09-00-2B-00-00-05')) $app = 'ISO 9542 All Intermediate System Network Entities Address'; |
904 | // Locally Administered Group MAC Addresses Used by IEEE Std 802.5 (IEEE Std 802.5 Functional Addresses) |
928 | // Locally Administered Group MAC Addresses Used by IEEE Std 802.5 (IEEE Std 802.5 Functional Addresses) |
905 | if (mac_equals($mac, '03-00-00-00-00-08')) $app = 'Configuration Report Server (CRS) MAC Group Address'; |
929 | if (mac_equals($mac, '03-00-00-00-00-08')) $app = 'Configuration Report Server (CRS) MAC Group Address'; |
906 | if (mac_equals($mac, '03-00-00-00-00-10')) $app = 'Ring Error Monitor (REM) MAC Group Address'; |
930 | if (mac_equals($mac, '03-00-00-00-00-10')) $app = 'Ring Error Monitor (REM) MAC Group Address'; |
907 | if (mac_equals($mac, '03-00-00-00-00-40')) $app = 'Ring Parameter Server (RPS) MAC Group Address'; |
931 | if (mac_equals($mac, '03-00-00-00-00-40')) $app = 'Ring Parameter Server (RPS) MAC Group Address'; |
908 | if (mac_equals($mac, '03-00-00-00-01-00')) $app = 'All Intermediate System Network Entities Address'; |
932 | if (mac_equals($mac, '03-00-00-00-01-00')) $app = 'All Intermediate System Network Entities Address'; |
909 | 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'; |
933 | 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'; |
910 | if (mac_equals($mac, '03-00-00-00-04-00')) $app = 'Generic Address for all Manager Stations'; |
934 | if (mac_equals($mac, '03-00-00-00-04-00')) $app = 'Generic Address for all Manager Stations'; |
911 | if (mac_equals($mac, '03-00-00-00-08-00')) $app = 'All CONs SNARES Address'; |
935 | if (mac_equals($mac, '03-00-00-00-08-00')) $app = 'All CONs SNARES Address'; |
912 | if (mac_equals($mac, '03-00-00-00-10-00')) $app = 'All CONs End System Address'; |
936 | if (mac_equals($mac, '03-00-00-00-10-00')) $app = 'All CONs End System Address'; |
913 | if (mac_equals($mac, '03-00-00-00-20-00')) $app = 'Loadable Device Generic Address'; |
937 | if (mac_equals($mac, '03-00-00-00-20-00')) $app = 'Loadable Device Generic Address'; |
914 | if (mac_equals($mac, '03-00-00-00-40-00')) $app = 'Load Server Generic Address'; |
938 | if (mac_equals($mac, '03-00-00-00-40-00')) $app = 'Load Server Generic Address'; |
915 | if (mac_equals($mac, '03-00-00-40-00-00')) $app = 'Generic Address for all Agent Stations'; |
939 | if (mac_equals($mac, '03-00-00-40-00-00')) $app = 'Generic Address for all Agent Stations'; |
916 | 940 | ||
917 | if ($app) { |
941 | if ($app) { |
918 | echo sprintf("%-32s %s\n", "Special use:", $app); |
942 | echo sprintf("%-32s %s\n", "Special use:", $app); |
919 | } |
943 | } |
920 | 944 | ||
921 | } |
945 | } |
922 | 946 | ||
923 | /** |
947 | /** |
924 | * @param string $mac1 |
948 | * @param string $mac1 |
925 | * @param string $mac2 |
949 | * @param string $mac2 |
926 | * @return bool |
950 | * @return bool |
927 | */ |
951 | */ |
928 | function mac_equals(string $mac1, string $mac2): bool { |
952 | function mac_equals(string $mac1, string $mac2): bool { |
929 | $mac1test = eui64_to_eui48($mac1); |
953 | $mac1test = eui64_to_eui48($mac1); |
930 | if ($mac1test === false) return false; |
954 | if ($mac1test === false) return false; |
931 | $mac2test = eui64_to_eui48($mac2); |
955 | $mac2test = eui64_to_eui48($mac2); |
932 | if ($mac2test === false) return false; |
956 | if ($mac2test === false) return false; |
933 | 957 | ||
934 | if (eui_bits($mac1test) != eui_bits($mac2test)) { |
958 | if (eui_bits($mac1test) != eui_bits($mac2test)) { |
935 | $mac1test = eui48_to_eui64($mac1); |
959 | $mac1test = eui48_to_eui64($mac1); |
936 | $mac2test = eui48_to_eui64($mac2); |
960 | $mac2test = eui48_to_eui64($mac2); |
937 | } |
961 | } |
938 | 962 | ||
939 | return mac_canonize($mac1test) == mac_canonize($mac2test); |
963 | return mac_canonize($mac1test) == mac_canonize($mac2test); |
940 | } |
964 | } |
941 | 965 | ||
942 | /** |
966 | /** |
943 | * @param string $mac |
967 | * @param string $mac |
944 | * @param string $low |
968 | * @param string $low |
945 | * @param string $high |
969 | * @param string $high |
946 | * @return bool |
970 | * @return bool |
947 | */ |
971 | */ |
948 | function mac_between(string $mac, string $low, string $high): bool { |
972 | function mac_between(string $mac, string $low, string $high): bool { |
949 | $mactest = eui64_to_eui48($mac); |
973 | $mactest = eui64_to_eui48($mac); |
950 | if ($mactest === false) return false; |
974 | if ($mactest === false) return false; |
951 | $lowtest = eui64_to_eui48($low); |
975 | $lowtest = eui64_to_eui48($low); |
952 | if ($lowtest === false) return false; |
976 | if ($lowtest === false) return false; |
953 | $hightest = eui64_to_eui48($high); |
977 | $hightest = eui64_to_eui48($high); |
954 | if ($hightest === false) return false; |
978 | if ($hightest === false) return false; |
955 | 979 | ||
956 | if ((eui_bits($mactest) != eui_bits($lowtest)) || (eui_bits($lowtest) != eui_bits($hightest))) { |
980 | if ((eui_bits($mactest) != eui_bits($lowtest)) || (eui_bits($lowtest) != eui_bits($hightest))) { |
957 | $mactest = eui48_to_eui64($mac); |
981 | $mactest = eui48_to_eui64($mac); |
958 | if ($mactest === false) return false; // e.g. trying ELI-48 to ELI-64 |
982 | if ($mactest === false) return false; // e.g. trying ELI-48 to ELI-64 |
959 | $lowtest = eui48_to_eui64($low); |
983 | $lowtest = eui48_to_eui64($low); |
960 | if ($lowtest === false) return false; // e.g. trying ELI-48 to ELI-64 |
984 | if ($lowtest === false) return false; // e.g. trying ELI-48 to ELI-64 |
961 | $hightest = eui48_to_eui64($high); |
985 | $hightest = eui48_to_eui64($high); |
962 | if ($hightest === false) return false; // e.g. trying ELI-48 to ELI-64 |
986 | if ($hightest === false) return false; // e.g. trying ELI-48 to ELI-64 |
963 | } |
987 | } |
964 | 988 | ||
965 | $mactest = strtoupper(preg_replace('@[^0-9A-F]@', '', $mactest)); |
989 | $mactest = strtoupper(preg_replace('@[^0-9A-F]@', '', $mactest)); |
966 | $lowtest = strtoupper(preg_replace('@[^0-9A-F]@', '', $lowtest)); |
990 | $lowtest = strtoupper(preg_replace('@[^0-9A-F]@', '', $lowtest)); |
967 | $hightest = strtoupper(preg_replace('@[^0-9A-F]@', '', $hightest)); |
991 | $hightest = strtoupper(preg_replace('@[^0-9A-F]@', '', $hightest)); |
968 | 992 | ||
969 | $mactest = gmp_init($mactest, 16); |
993 | $mactest = gmp_init($mactest, 16); |
970 | $lowtest = gmp_init($lowtest, 16); |
994 | $lowtest = gmp_init($lowtest, 16); |
971 | $hightest = gmp_init($hightest, 16); |
995 | $hightest = gmp_init($hightest, 16); |
972 | 996 | ||
973 | return (gmp_cmp($mactest, $lowtest) >= 0) && (gmp_cmp($mactest, $hightest) <= 0); |
997 | return (gmp_cmp($mactest, $lowtest) >= 0) && (gmp_cmp($mactest, $hightest) <= 0); |
974 | } |
998 | } |
975 | 999 |