Revision 6ea0d41e
Added by Stilez y about 9 years ago
src/usr/local/www/diag_arp.php | ||
---|---|---|
68 | 68 |
|
69 | 69 |
require("guiconfig.inc"); |
70 | 70 |
|
71 |
// delete arp entry |
|
72 |
if (isset($_GET['deleteentry'])) { |
|
73 |
$ip = $_GET['deleteentry']; |
|
74 |
if (is_ipaddrv4($ip)) { |
|
75 |
$ret = mwexec("arp -d " . $_GET['deleteentry'], true); |
|
76 |
} else { |
|
77 |
$ret = 1; |
|
78 |
} |
|
79 |
if ($ret) { |
|
80 |
$savemsg = sprintf(gettext("%s is not a valid IPv4 address or could not be deleted."), $ip); |
|
81 |
$savemsgtype = 'alert-warning'; |
|
82 |
} else { |
|
83 |
$savemsg = sprintf(gettext("The ARP cache entry for %s has been deleted."), $ip); |
|
84 |
$savemsgtype = 'success'; |
|
85 |
} |
|
86 |
} |
|
87 |
|
|
71 | 88 |
function leasecmp($a, $b) { |
72 | 89 |
return strcmp($a[$_GET['order']], $b[$_GET['order']]); |
73 | 90 |
} |
... | ... | |
286 | 303 |
$pgtitle = array(gettext("Diagnostics"), gettext("ARP Table")); |
287 | 304 |
include("head.inc"); |
288 | 305 |
|
306 |
// Handle save msg if defined |
|
307 |
if ($savemsg) { |
|
308 |
print_info_box(htmlentities($savemsg), $savemsgtype); |
|
309 |
} |
|
289 | 310 |
?> |
290 | 311 |
|
291 | 312 |
<!-- On modern hardware the table will load so fast you may never see this! --> |
... | ... | |
346 | 367 |
<th><?= gettext("IP address")?></th> |
347 | 368 |
<th><?= gettext("MAC address")?></th> |
348 | 369 |
<th><?= gettext("Hostname")?></th> |
370 |
<th data-sortable="false"><?=gettext("Actions")?></th> |
|
349 | 371 |
</tr> |
350 | 372 |
</thead> |
351 | 373 |
<tbody> |
... | ... | |
367 | 389 |
?> |
368 | 390 |
</td> |
369 | 391 |
<td><?=trim(str_replace("Z_ ", "", $entry['dnsresolve']))?></td> |
392 |
<td> |
|
393 |
<a class="fa fa-trash" title="<?=gettext('Delete arp cache entry')?>" href="diag_arp.php?deleteentry=<?=$entry['ip']?>"></a> |
|
394 |
</td> |
|
370 | 395 |
</tr> |
371 | 396 |
<?php endforeach?> |
372 | 397 |
</tbody> |
Also available in: Unified diff
Add "delete entry" for ARP table
Useful function in some circumstances - seems no reason not to have it.
Uses IP rather than hostname since not all ARP entries have hostnames.
Probably should also have "delete all" but not done that.