diff options
-rw-r--r-- | etc/inc/openvpn.inc | 26 | ||||
-rw-r--r-- | usr/local/www/status_openvpn.php | 4 | ||||
-rw-r--r-- | usr/local/www/widgets/widgets/openvpn.widget.php | 4 |
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> |