diff options
author | jim-p <jimp@pfsense.org> | 2011-12-22 12:43:59 -0500 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2011-12-22 12:43:59 -0500 |
commit | c0ee2a015faac1771badec3a4ed3bce1feba8da2 (patch) | |
tree | d1ad4d5ba3d32b6fe42cfa8ac4bd68b34d6112d8 /usr/local/www | |
parent | f86fa91cf94ed2d49df1e41ffbdf2f235fba5163 (diff) | |
download | pfsense-c0ee2a015faac1771badec3a4ed3bce1feba8da2.zip pfsense-c0ee2a015faac1771badec3a4ed3bce1feba8da2.tar.gz |
Add ability to kill all states matching an IP or subnet filter. Also display count of states matching filter.
Diffstat (limited to 'usr/local/www')
-rwxr-xr-x | usr/local/www/diag_dump_states.php | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/usr/local/www/diag_dump_states.php b/usr/local/www/diag_dump_states.php index c832e2a..5ed855d 100755 --- a/usr/local/www/diag_dump_states.php +++ b/usr/local/www/diag_dump_states.php @@ -54,6 +54,16 @@ if($_GET['action']) { } } +if ($_GET['filter'] && ($_GET['killfilter'] == "Kill")) { + if (is_ipaddr($_GET['filter'])) { + $tokill = $_GET['filter'] . "/32"; + } elseif (is_subnet($_GET['filter'])) { + $tokill = $_GET['filter']; + } + $retval = mwexec("/sbin/pfctl -k {$tokill} -k 0/0"); + $retval = mwexec("/sbin/pfctl -k 0.0.0.0/0 -k {$tokill}"); +} + /* get our states */ if($_GET['filter']) { exec("/sbin/pfctl -s state | grep " . escapeshellarg(htmlspecialchars($_GET['filter'])), $states); @@ -131,11 +141,19 @@ include("head.inc"); <form action="<?=$_SERVER['SCRIPT_NAME'];?>" method="get"> <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> - <td><?=gettext("Current state count:");?> <?=$current_statecount?></td> + <td> + <?=gettext("Current state count");?>: <?= $current_statecount ?> + <?php if (!empty($_GET['filter'])): ?> + (<?=gettext("Matching filter")?>: <?= count($states) ?>) + <?php endif; ?> + </td> <td style="font-weight:bold;" align="right"> <?=gettext("Filter expression:");?> <input type="text" name="filter" class="formfld search" value="<?=htmlspecialchars($_GET['filter']);?>" size="30" /> <input type="submit" class="formbtn" value="<?=gettext("Filter");?>" /> + <?php if (is_ipaddr($_GET['filter']) || is_subnet($_GET['filter'])): ?> + <input type="submit" class="formbtn" name="killfilter" value="<?=gettext("Kill");?>" /> + <?php endif; ?> <td> </tr> </table> |