summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/status_openvpn.php
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2015-12-17 10:14:17 +0545
committerPhil Davis <phil.davis@inf.org>2015-12-17 10:14:17 +0545
commit61fce4a6f6f61f25356708df4175d28892a04b4c (patch)
tree119d4905f375a331ee76a5f87e3c27867df4d8f5 /src/usr/local/www/status_openvpn.php
parent9851ce32c1c40281fd76ac1ff140acaccbcc1d30 (diff)
downloadpfsense-61fce4a6f6f61f25356708df4175d28892a04b4c.zip
pfsense-61fce4a6f6f61f25356708df4175d28892a04b4c.tar.gz
Consolidate OpenVPN kill_client routine
After a gitsync just now I started getting "cannot redeclare kill_client" error messages. Whatever it was that caused this to start happening, the kill_client() function in these 2 places is identical. Might as well put it in openvpn.inc
Diffstat (limited to 'src/usr/local/www/status_openvpn.php')
-rw-r--r--src/usr/local/www/status_openvpn.php39
1 files changed, 1 insertions, 38 deletions
diff --git a/src/usr/local/www/status_openvpn.php b/src/usr/local/www/status_openvpn.php
index 63c4f89..bc7e266 100644
--- a/src/usr/local/www/status_openvpn.php
+++ b/src/usr/local/www/status_openvpn.php
@@ -75,7 +75,7 @@ if ($_GET['action']) {
$port = $_GET['port'];
$remipp = $_GET['remipp'];
if (!empty($port) and !empty($remipp)) {
- $retval = kill_client($port, $remipp);
+ $retval = openvpn_kill_client($port, $remipp);
echo htmlentities("|{$port}|{$remipp}|{$retval}|");
} else {
echo gettext("invalid input");
@@ -84,43 +84,6 @@ if ($_GET['action']) {
}
}
-
-function kill_client($port, $remipp) {
- global $g;
-
- //$tcpsrv = "tcp://127.0.0.1:{$port}";
- $tcpsrv = "unix://{$g['varetc_path']}/openvpn/{$port}.sock";
- $errval = null;
- $errstr = null;
-
- /* open a tcp connection to the management port of each server */
- $fp = @stream_socket_client($tcpsrv, $errval, $errstr, 1);
- $killed = -1;
- if ($fp) {
- stream_set_timeout($fp, 1);
- fputs($fp, "kill {$remipp}\n");
- while (!feof($fp)) {
- $line = fgets($fp, 1024);
-
- $info = stream_get_meta_data($fp);
- if ($info['timed_out']) {
- break;
- }
-
- /* parse header list line */
- if (strpos($line, "INFO:") !== false) {
- continue;
- }
- if (strpos($line, "SUCCESS") !== false) {
- $killed = 0;
- }
- break;
- }
- fclose($fp);
- }
- return $killed;
-}
-
$servers = openvpn_get_active_servers();
$sk_servers = openvpn_get_active_servers("p2p");
$clients = openvpn_get_active_clients();
OpenPOWER on IntegriCloud