summaryrefslogtreecommitdiffstats
path: root/etc/inc/openvpn.inc
diff options
context:
space:
mode:
Diffstat (limited to 'etc/inc/openvpn.inc')
-rw-r--r--etc/inc/openvpn.inc31
1 files changed, 31 insertions, 0 deletions
diff --git a/etc/inc/openvpn.inc b/etc/inc/openvpn.inc
index 0f3febc..0e6bc28 100644
--- a/etc/inc/openvpn.inc
+++ b/etc/inc/openvpn.inc
@@ -1270,4 +1270,35 @@ function openvpn_gen_route_ipv6($network) {
return "route-ipv6 ${ipv6}/${prefix}";
}
+function openvpn_get_settings($mode, $vpnid) {
+ global $config;
+
+ if (is_array($config['openvpn']['openvpn-server'])) {
+ foreach ($config['openvpn']['openvpn-server'] as $settings) {
+ if (isset($settings['disable']))
+ continue;
+
+ if ($vpnid != 0 && $vpnid == $settings['vpnid'])
+ return $settings;
+ }
+ }
+
+ if (is_array($config['openvpn']['openvpn-client'])) {
+ foreach ($config['openvpn']['openvpn-client'] as $settings) {
+ if (isset($settings['disable']))
+ continue;
+
+ if ($vpnid != 0 && $vpnid == $settings['vpnid'])
+ return $settings;
+ }
+ }
+
+ return array();
+}
+
+function openvpn_restart_by_vpnid($mode, $vpnid) {
+ $settings = openvpn_get_settings($mode, $vpnid);
+ openvpn_restart($mode, $settings);
+}
+
?>
OpenPOWER on IntegriCloud