summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2011-08-30 09:44:20 -0400
committerjim-p <jimp@pfsense.org>2011-08-30 09:44:20 -0400
commit1f2f60240c8829c64ad786eb33ecc6ba0cd1d5a2 (patch)
treee17f9ed425cd3b82d99b6d0142f360c2d016de22
parentac429b4257465274d89d3e7f222e81b4c18b7800 (diff)
downloadpfsense-1f2f60240c8829c64ad786eb33ecc6ba0cd1d5a2.zip
pfsense-1f2f60240c8829c64ad786eb33ecc6ba0cd1d5a2.tar.gz
Fixup OpenVPN status a bit to properly handle SSL servers using a /30 (no server directive) and also be a little more verbose about what is happening, if we can tell.
-rw-r--r--etc/inc/openvpn.inc26
-rw-r--r--usr/local/www/status_openvpn.php4
-rw-r--r--usr/local/www/widgets/widgets/openvpn.widget.php4
3 files changed, 27 insertions, 7 deletions
diff --git a/etc/inc/openvpn.inc b/etc/inc/openvpn.inc
index 285a65f..ce97469 100644
--- a/etc/inc/openvpn.inc
+++ b/etc/inc/openvpn.inc
@@ -753,7 +753,7 @@ function openvpn_resync_all($interface = "") {
}
-function openvpn_get_active_servers($type="ssl") {
+function openvpn_get_active_servers($type="multipoint") {
global $config, $g;
$servers = array();
@@ -778,10 +778,13 @@ function openvpn_get_active_servers($type="ssl") {
$mode_id = "server{$vpnid}";
$server['mgmt'] = $mode_id;
$socket = "unix://{$g['varetc_path']}/openvpn/{$mode_id}.sock";
- if (($server['mode'] == "p2p_shared_key") && ($type == "sharedkey"))
+ list($tn, $sm) = explode('/', $settings['tunnel_network']);
+
+ if ((($server['mode'] == "p2p_shared_key") || ($sm >= 30) ) && ($type == "p2p"))
$servers[] = openvpn_get_client_status($server, $socket);
- elseif (($server['mode'] != "p2p_shared_key") && ($type == "ssl"))
+ elseif (($server['mode'] != "p2p_shared_key") && ($type == "multipoint") && ($sm < 30))
$servers[] = openvpn_get_server_status($server, $socket);
+
}
}
return $servers;
@@ -903,6 +906,23 @@ function openvpn_get_client_status($client, $socket) {
$client['virtual_addr'] = $list[3];
$client['remote_host'] = $list[4];
}
+ if (strstr($line,"CONNECTING")) {
+ $client['status']="connecting";
+ }
+ if (strstr($line,"ASSIGN_IP")) {
+ $client['status']="waiting";
+ $list = explode(",", $line);
+
+ $client['connect_time'] = date("D M j G:i:s Y", $list[0]);
+ $client['virtual_addr'] = $list[3];
+ }
+ if (strstr($line,"RECONNECTING")) {
+ $client['status']="reconnecting";
+ $list = explode(",", $line);
+
+ $client['connect_time'] = date("D M j G:i:s Y", $list[0]);
+ $client['status'] .= "; " . $list[2];
+ }
/* parse end of output line */
if (strstr($line, "END") || strstr($line, "ERROR"))
break;
diff --git a/usr/local/www/status_openvpn.php b/usr/local/www/status_openvpn.php
index 4ad65d5..fd45b3b 100644
--- a/usr/local/www/status_openvpn.php
+++ b/usr/local/www/status_openvpn.php
@@ -98,7 +98,7 @@ function kill_client($port, $remipp) {
}
$servers = openvpn_get_active_servers();
-$sk_servers = openvpn_get_active_servers("sharedkey");
+$sk_servers = openvpn_get_active_servers("p2p");
$clients = openvpn_get_active_clients();
include("head.inc"); ?>
@@ -202,7 +202,7 @@ include("head.inc"); ?>
<table style="padding-top:0px; padding-bottom:0px; padding-left:0px; padding-right:0px" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="6" class="listtopic">
- <?=gettext("Shared Key Server Instance Statistics"); ?>
+ <?=gettext("Peer to Peer Server Instance Statistics"); ?>
</td>
</tr>
<tr>
diff --git a/usr/local/www/widgets/widgets/openvpn.widget.php b/usr/local/www/widgets/widgets/openvpn.widget.php
index 4d186f0..9b5df89 100644
--- a/usr/local/www/widgets/widgets/openvpn.widget.php
+++ b/usr/local/www/widgets/widgets/openvpn.widget.php
@@ -55,7 +55,7 @@ function kill_client($port, $remipp) {
}
$servers = openvpn_get_active_servers();
-$sk_servers = openvpn_get_active_servers("sharedkey");
+$sk_servers = openvpn_get_active_servers("p2p");
$clients = openvpn_get_active_clients();
?>
@@ -145,7 +145,7 @@ $clients = openvpn_get_active_clients();
<table style="padding-top:0px; padding-bottom:0px; padding-left:0px; padding-right:0px" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="6" class="listtopic">
- Shared Key Server Instance Statistics
+ Peer to Peer Server Instance Statistics
</td>
</tr>
<tr>
OpenPOWER on IntegriCloud