diff options
author | jim-p <jim@pingle.org> | 2010-02-07 13:35:37 -0500 |
---|---|---|
committer | jim-p <jim@pingle.org> | 2010-02-07 13:37:22 -0500 |
commit | 013161627742bd3083e8f088fbb5de676d5477a9 (patch) | |
tree | b662220ab6dd394a0c3741131944fd58a4ad6ef0 /config/openvpn-status | |
parent | 7cefc36a284b396d3d606f7c282d743dbd29e297 (diff) | |
download | pfsense-packages-013161627742bd3083e8f088fbb5de676d5477a9.tar.gz pfsense-packages-013161627742bd3083e8f088fbb5de676d5477a9.tar.bz2 pfsense-packages-013161627742bd3083e8f088fbb5de676d5477a9.zip |
Update OpenVPN-status package for 1.2.x. Gracefully handle missing management daemon.
Diffstat (limited to 'config/openvpn-status')
-rw-r--r-- | config/openvpn-status/openvpn-status.xml | 2 | ||||
-rw-r--r-- | config/openvpn-status/status_openvpn.php | 23 |
2 files changed, 17 insertions, 8 deletions
diff --git a/config/openvpn-status/openvpn-status.xml b/config/openvpn-status/openvpn-status.xml index 4f7a876b..8ef27ded 100644 --- a/config/openvpn-status/openvpn-status.xml +++ b/config/openvpn-status/openvpn-status.xml @@ -46,7 +46,7 @@ <requirements>Management Port Defined in OpenVPN Config</requirements> <faq>Currently there are no FAQ items provided.</faq> <name>OpenVPN Status</name> - <version>1.0</version> + <version>1.3</version> <title>Status: OpenVPN</title> <menu> <name>OpenVPN</name> diff --git a/config/openvpn-status/status_openvpn.php b/config/openvpn-status/status_openvpn.php index 7238c0ca..a021e951 100644 --- a/config/openvpn-status/status_openvpn.php +++ b/config/openvpn-status/status_openvpn.php @@ -1,20 +1,20 @@ -<?php +<?php /* status_ovpenvpn.php Copyright (C) 2008 Shrew Soft Inc. All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE @@ -52,7 +52,7 @@ if (is_array($ovpnservers)) { $errstr; /* open a tcp connection to the management port of each server */ - $fp = fsockopen("127.0.0.1", $port, $errval, $errstr, 1); + $fp = @fsockopen("127.0.0.1", $port, $errval, $errstr, 1); if ($fp) { /* send our status request */ @@ -89,6 +89,15 @@ if (is_array($ovpnservers)) { /* cleanup */ fclose($fp); + } else { + $conn = array(); + $conn['common_name'] = "[error]"; + $conn['remote_host'] = "No Management Daemon"; + $conn['virtual_addr'] = "See Note Below"; + $conn['bytes_recv'] = 0; + $conn['bytes_sent'] = 0; + $conn['connect_time'] = 0; + $server['conns'][] = $conn; } $servers[] = $server; @@ -106,7 +115,7 @@ echo $buff; <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"> + <td colspan="6" class="listtopic"> Client connections for <?=$server['name'];?> </td> </tr> |