Revision 57f2840e
Added by Evgeny Yurchenko about 14 years ago
etc/inc/pfsense-utils.inc | ||
---|---|---|
2181 | 2181 |
return compare_interface_friendly_names($a['interface'], $b['interface']); |
2182 | 2182 |
} |
2183 | 2183 |
|
2184 |
/****f* pfsense-utils/load_mac_manufacturer_table |
|
2185 |
* NAME |
|
2186 |
* load_mac_manufacturer_table |
|
2187 |
* INPUTS |
|
2188 |
* none |
|
2189 |
* RESULT |
|
2190 |
* returns associative array with MAC-Manufacturer pairs |
|
2191 |
******/ |
|
2192 |
function load_mac_manufacturer_table() { |
|
2193 |
/* load MAC-Manufacture data from the file */ |
|
2194 |
$macs=file("/usr/local/share/nmap/nmap-mac-prefixes"); |
|
2195 |
if ($macs){ |
|
2196 |
foreach ($macs as $line){ |
|
2197 |
if (preg_match('/([0-9A-Fa-f]{6}) (.*)$/', $line, $matches)){ |
|
2198 |
/* store values like this $mac_man['000C29']='VMW=ware' */ |
|
2199 |
$mac_man["$matches[1]"]=$matches[2]; |
|
2200 |
} |
|
2201 |
} |
|
2202 |
return $mac_man; |
|
2203 |
} else |
|
2204 |
return -1; |
|
2205 |
|
|
2206 |
} |
|
2207 |
|
|
2184 | 2208 |
?> |
usr/local/www/diag_arp.php | ||
---|---|---|
288 | 288 |
// Sort the data alpha first |
289 | 289 |
$data = msort($data, "dnsresolve"); |
290 | 290 |
|
291 |
// Load MAC-Manufacturer table |
|
292 |
$mac_man = load_mac_manufacturer_table(); |
|
291 | 293 |
?> |
292 | 294 |
<table width="100%" border="0" cellpadding="0" cellspacing="0"> |
293 | 295 |
<tr> |
... | ... | |
303 | 305 |
<?php foreach ($data as $entry): ?> |
304 | 306 |
<tr> |
305 | 307 |
<td class="listlr"><?=$entry['ip'];?></td> |
306 |
<td class="listr"><?=$entry['mac'];?></td> |
|
308 |
<td class="listr"> |
|
309 |
<?php |
|
310 |
$mac=$entry['mac']; |
|
311 |
$mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]); |
|
312 |
if(isset($mac_man[$mac_hi])){ print "<span title=\"$mac\">{$mac_man[$mac_hi]}</span>"; } |
|
313 |
else{ print $mac; } |
|
314 |
?> |
|
307 | 315 |
<td class="listr"> |
308 | 316 |
<?php |
309 | 317 |
echo str_replace("Z_ ", "", $entry['dnsresolve']); |
usr/local/www/status_dhcp_leases.php | ||
---|---|---|
324 | 324 |
<td class="listhdrr"><a href="#"><?=gettext("Lease Type"); ?></a></td> |
325 | 325 |
</tr> |
326 | 326 |
<?php |
327 |
// Load MAC-Manufacturer table |
|
328 |
$mac_man = load_mac_manufacturer_table(); |
|
327 | 329 |
foreach ($leases as $data) { |
328 | 330 |
if (($data['act'] == "active") || ($data['act'] == "static") || ($_GET['all'] == 1)) { |
329 | 331 |
if ($data['act'] != "active" && $data['act'] != "static") { |
... | ... | |
357 | 359 |
} |
358 | 360 |
echo "<tr>\n"; |
359 | 361 |
echo "<td class=\"listlr\">{$fspans}{$data['ip']}{$fspane} </td>\n"; |
362 |
$mac=$data['mac']; |
|
363 |
$mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]); |
|
360 | 364 |
if ($data['online'] != "online") { |
361 |
echo "<td class=\"listr\">{$fspans}<a href=\"services_wol.php?if={$data['if']}&mac={$data['mac']}\" title=\"" . gettext("send Wake on LAN packet to this MAC address") ."\" onclick=\"return confirm('" . gettext("Send Wake on LAN packet to this MAC address?") . "')\">{$data['mac']}</a>{$fspane} </td>\n"; |
|
362 |
} else { |
|
363 |
echo "<td class=\"listr\">{$fspans}{$data['mac']}{$fspane} </td>\n"; |
|
365 |
if(isset($mac_man[$mac_hi])){ // Manufacturer for this MAC is defined |
|
366 |
echo "<td class=\"listr\">{$fspans}<a href=\"services_wol.php?if={$data['if']}&mac=$mac\" title=\"" . gettext("$mac - send Wake on LAN packet to this MAC address") ."\">{$mac_man[$mac_hi]}</a>{$fspane} </td>\n"; |
|
367 |
}else{ |
|
368 |
echo "<td class=\"listr\">{$fspans}<a href=\"services_wol.php?if={$data['if']}&mac={$data['mac']}\" title=\"" . gettext("send Wake on LAN packet to this MAC address") ."\">{$data['mac']}</a>{$fspane} </td>\n"; |
|
369 |
} |
|
370 |
}else{ |
|
371 |
if(isset($mac_man[$mac_hi])){ // Manufacturer for this MAC is defined |
|
372 |
echo "<td class=\"listr\">{$fspans}<span title=\"$mac\">{$mac_man[$mac_hi]}</span>{$fspane} </td>\n"; |
|
373 |
}else{ |
|
374 |
echo "<td class=\"listr\">{$fspans}{$data['mac']}{$fspane} </td>\n"; |
|
375 |
} |
|
364 | 376 |
} |
365 | 377 |
echo "<td class=\"listr\">{$fspans}" . htmlentities($data['hostname']) . "{$fspane} </td>\n"; |
366 | 378 |
if ($data['type'] != "static") { |
usr/local/www/status_interfaces.php | ||
---|---|---|
68 | 68 |
$ifdescrs = get_configured_interface_with_descr(false, true); |
69 | 69 |
foreach ($ifdescrs as $ifdescr => $ifname): |
70 | 70 |
$ifinfo = get_interface_info($ifdescr); |
71 |
// Load MAC-Manufacturer table |
|
72 |
$mac_man = load_mac_manufacturer_table(); |
|
71 | 73 |
?> |
72 | 74 |
<?php if ($i): ?> |
73 | 75 |
<tr> |
... | ... | |
175 | 177 |
<tr> |
176 | 178 |
<td width="22%" class="vncellt"><?=gettext("MAC address");?></td> |
177 | 179 |
<td width="78%" class="listr"> |
178 |
<?=htmlspecialchars($ifinfo['macaddr']);?> |
|
180 |
<?php |
|
181 |
$mac=$ifinfo['macaddr']; |
|
182 |
$mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]); |
|
183 |
if(isset($mac_man[$mac_hi])){ print "<span title=\"$mac\">" . htmlspecialchars($mac_man[$mac_hi]); print "</span>"; } |
|
184 |
else {print htmlspecialchars($mac);} |
|
185 |
?> |
|
179 | 186 |
</td> |
180 | 187 |
</tr> |
181 | 188 |
<?php endif; if ($ifinfo['status'] != "down"): ?> |
Also available in: Unified diff
MAC prefix to vendor resolution at Status->Interfaces, Status->DHCP leases, Diagnostics->ARP table