From 3d06e8f02f7df1a18350eebc86c35b1dfd1a9499 Mon Sep 17 00:00:00 2001 From: pierrepomes Date: Wed, 2 Dec 2009 22:31:26 -0500 Subject: [PATCH] Add carp support for OpenVPN. Ticket #69 --- etc/inc/openvpn.inc | 8 +++++++- usr/local/www/vpn_openvpn_client.php | 5 ++++- usr/local/www/vpn_openvpn_server.php | 3 +++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/etc/inc/openvpn.inc b/etc/inc/openvpn.inc index 14286fa350..9de908cbc7 100644 --- a/etc/inc/openvpn.inc +++ b/etc/inc/openvpn.inc @@ -302,7 +302,13 @@ function openvpn_reconfigure($mode,& $settings) { if (!$interface) $interface = 'WAN'; - $iface = convert_friendly_interface_to_real_interface_name($interface); + /* For a carp interface, the name is well known:vip1, vip2, ...*/ + if (!strncmp($interface, "vip", 3)) { + $iface=$interface; + } else { + $iface=convert_friendly_interface_to_real_interface_name($interface); + } + $lines = explode(' ', trim(shell_exec("ifconfig {$iface} | grep inet | grep -v inet6"))); $iface_ip = $lines[1]; diff --git a/usr/local/www/vpn_openvpn_client.php b/usr/local/www/vpn_openvpn_client.php index 42f1de7e2a..970efd2fa9 100644 --- a/usr/local/www/vpn_openvpn_client.php +++ b/usr/local/www/vpn_openvpn_client.php @@ -387,7 +387,10 @@ function autotls_change() { $carpip) + $interfaces[$cif] = strtoupper($cif) . " ({$carpip})"; foreach ($interfaces as $iface => $ifacename): $selected = ""; if ($iface == $pconfig['interface'])