summaryrefslogtreecommitdiffstats
path: root/src/usr/local
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2017-04-20 14:16:02 -0300
committerRenato Botelho <renato@netgate.com>2017-04-20 14:16:02 -0300
commitab023407415157ee540dea7dc8770e174f757525 (patch)
treeafc125dac22b8868f1b8d920e8891b518f9ae6aa /src/usr/local
parent33664d335d0fc68d0fa238472ef2a35208fdaf24 (diff)
parent1d92faa34f7c9aaa97b1983f273d2d73285befb5 (diff)
downloadpfsense-ab023407415157ee540dea7dc8770e174f757525.zip
pfsense-ab023407415157ee540dea7dc8770e174f757525.tar.gz
Merge pull request #3696 from sergiocarlosmorales/delete-ndp-entry
Diffstat (limited to 'src/usr/local')
-rw-r--r--src/usr/local/www/diag_ndp.php31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/usr/local/www/diag_ndp.php b/src/usr/local/www/diag_ndp.php
index a27d4ba..bdc4de2 100644
--- a/src/usr/local/www/diag_ndp.php
+++ b/src/usr/local/www/diag_ndp.php
@@ -33,10 +33,28 @@
@ini_set('zlib.output_compression', 0);
@ini_set('implicit_flush', 1);
-
+define('NDP_BINARY_PATH', '/usr/sbin/ndp');
require_once("guiconfig.inc");
-exec("/usr/sbin/ndp -na", $rawdata);
+// Delete ndp entry.
+if (isset($_POST['deleteentry'])) {
+ $ip = $_POST['deleteentry'];
+ if (is_ipaddrv6($ip)) {
+ $commandReturnValue = mwexec(NDP_BINARY_PATH . " -d " . escapeshellarg($ip), true);
+ $deleteSucceededFlag = ($commandReturnValue == 0);
+ } else {
+ $deleteSucceededFlag = false;
+ }
+
+ $deleteResultMessage = ($deleteSucceededFlag)
+ ? sprintf(gettext("The NDP entry for %s has been deleted."), $ip)
+ : sprintf(gettext("%s is not a valid IPv6 address or could not be deleted."), $ip);
+ $deleteResultMessageType = ($deleteSucceededFlag)
+ ? 'success'
+ : 'alert-warning';
+}
+
+exec(NDP_BINARY_PATH . " -na", $rawdata);
$i = 0;
@@ -95,6 +113,11 @@ $mac_man = load_mac_manufacturer_table();
$pgtitle = array(gettext("Diagnostics"), gettext("NDP Table"));
include("head.inc");
+
+// Show message if defined.
+if (isset($deleteResultMessage, $deleteResultMessageType)) {
+ print_info_box(htmlentities($deleteResultMessage), $deleteResultMessageType);
+}
?>
<div class="panel panel-default">
@@ -109,6 +132,7 @@ include("head.inc");
<th><?= gettext("MAC address"); ?></th>
<th><?= gettext("Hostname"); ?></th>
<th><?= gettext("Interface"); ?></th>
+ <th data-sortable="false"><?=gettext("Actions")?></th>
</tr>
</thead>
<tbody>
@@ -139,6 +163,9 @@ include("head.inc");
}
?>
</td>
+ <td>
+ <a class="fa fa-trash" title="<?=gettext('Delete NDP entry')?>" href="diag_ndp.php?deleteentry=<?=$entry['ipv6']?>" usepost></a>
+ </td>
</tr>
<?php endforeach; ?>
</tbody>
OpenPOWER on IntegriCloud