summaryrefslogtreecommitdiffstats
path: root/etc/inc/openvpn.inc
diff options
context:
space:
mode:
authorpierrepomes <pierre.pomes@interface-tech.com>2009-12-10 17:34:17 -0500
committerpierrepomes <pierre.pomes@interface-tech.com>2009-12-10 17:34:30 -0500
commit67b0902fe1979b904b2f56a61d59309d971138da (patch)
tree5ac4d19f309ed3846b502a3361364d7a95c3cdf8 /etc/inc/openvpn.inc
parent942fdd555964d4854e38f8508ffe6acc190b94f4 (diff)
downloadpfsense-67b0902fe1979b904b2f56a61d59309d971138da.zip
pfsense-67b0902fe1979b904b2f56a61d59309d971138da.tar.gz
Add IP alias and 'any' support to OpenVPN. Feedback #69
Diffstat (limited to 'etc/inc/openvpn.inc')
-rw-r--r--etc/inc/openvpn.inc28
1 files changed, 17 insertions, 11 deletions
diff --git a/etc/inc/openvpn.inc b/etc/inc/openvpn.inc
index 9de908c..ad5fa87 100644
--- a/etc/inc/openvpn.inc
+++ b/etc/inc/openvpn.inc
@@ -299,18 +299,22 @@ function openvpn_reconfigure($mode,& $settings) {
$cipher = $settings['crypto'];
$interface = $settings['interface'];
- if (!$interface)
- $interface = 'WAN';
+ $ipaddr = $settings['ipaddr'];
- /* For a carp interface, the name is well known:vip1, vip2, ...*/
- if (!strncmp($interface, "vip", 3)) {
- $iface=$interface;
+ // If a specific ip address (VIP) is requested, use it.
+ // Otherwise, if a specific interface is requested, use it
+ // If "any" interface was selected, local directive will be ommited.
+ if (!empty($ipaddr)) {
+ $iface_ip=$ipaddr;
} else {
- $iface=convert_friendly_interface_to_real_interface_name($interface);
+ if ((!empty($interface)) && (strcmp($interface, "any"))) {
+ $iface=convert_friendly_interface_to_real_interface_name($interface);
+
+ // Get ip address for the requested interface
+ $lines = explode(' ', trim(shell_exec("ifconfig {$iface} | grep inet | grep -v inet6")));
+ $iface_ip = $lines[1];
+ }
}
-
- $lines = explode(' ', trim(shell_exec("ifconfig {$iface} | grep inet | grep -v inet6")));
- $iface_ip = $lines[1];
$conf = "dev {$devname}\n";
$conf .= "dev-type tun\n";
@@ -327,10 +331,12 @@ function openvpn_reconfigure($mode,& $settings) {
$conf .= "cipher {$cipher}\n";
$conf .= "up /etc/rc.filter_configure\n";
$conf .= "down /etc/rc.filter_configure\n";
- $conf .= "local {$iface_ip}\n";
- // server specific settings
+ if (!empty($iface_ip)) {
+ $conf .= "local {$iface_ip}\n";
+ }
+ // server specific settings
if ($mode == 'server') {
list($ip, $mask) = explode('/', $settings['tunnel_network']);
OpenPOWER on IntegriCloud