From 6ea0d41e3c094a0977e7f0d022ec74276280b8ff Mon Sep 17 00:00:00 2001 From: stilez Date: Tue, 31 May 2016 06:22:02 +0100 Subject: 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. --- src/usr/local/www/diag_arp.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/usr') diff --git a/src/usr/local/www/diag_arp.php b/src/usr/local/www/diag_arp.php index 69bc740..f7bdff4 100644 --- a/src/usr/local/www/diag_arp.php +++ b/src/usr/local/www/diag_arp.php @@ -68,6 +68,23 @@ require("guiconfig.inc"); +// delete arp entry +if (isset($_GET['deleteentry'])) { + $ip = $_GET['deleteentry']; + if (is_ipaddrv4($ip)) { + $ret = mwexec("arp -d " . $_GET['deleteentry'], true); + } else { + $ret = 1; + } + if ($ret) { + $savemsg = sprintf(gettext("%s is not a valid IPv4 address or could not be deleted."), $ip); + $savemsgtype = 'alert-warning'; + } else { + $savemsg = sprintf(gettext("The ARP cache entry for %s has been deleted."), $ip); + $savemsgtype = 'success'; + } +} + function leasecmp($a, $b) { return strcmp($a[$_GET['order']], $b[$_GET['order']]); } @@ -286,6 +303,10 @@ function _getHostName($mac, $ip) { $pgtitle = array(gettext("Diagnostics"), gettext("ARP Table")); include("head.inc"); +// Handle save msg if defined +if ($savemsg) { + print_info_box(htmlentities($savemsg), $savemsgtype); +} ?> @@ -346,6 +367,7 @@ $mac_man = load_mac_manufacturer_table(); + @@ -367,6 +389,9 @@ $mac_man = load_mac_manufacturer_table(); ?> + + + -- cgit v1.1