From 6236682824a1e6d43ea554b822631cfb23eb1a37 Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Fri, 21 Dec 2007 20:09:23 +0000 Subject: =?UTF-8?q?OpenVPN-multi-interface-patches=20by=20Fernando=20Tarl?= =?UTF-8?q?=E1=20Cardoso=20Lemos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- etc/inc/openvpn.inc | 10 +++++++++- usr/local/pkg/openvpn.xml | 14 ++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/etc/inc/openvpn.inc b/etc/inc/openvpn.inc index 81aabc0..ac6318f 100644 --- a/etc/inc/openvpn.inc +++ b/etc/inc/openvpn.inc @@ -341,6 +341,15 @@ EOD; $openvpn_conf .= "push \"route $ip $mask\"\n"; } + if ($settings['bind_to_iface'] == 'on') { + $iface = $settings['interface']; + $iface = convert_friendly_interface_to_real_interface_name($iface); + $line = trim(shell_exec("ifconfig $iface | grep inet | grep -v inet6")); + list($dummy, $ip, $dummy2, $dummy3) = explode(' ', $line); + + $openvpn_conf .= "local {$ip}\n"; + } + // The port we'll listen at $openvpn_conf .= "lport {$settings['local_port']}\n"; @@ -400,7 +409,6 @@ EOD; $openvpn_conf .= "remote {$settings['serveraddr']} {$settings['serverport']}\n"; if ($settings['auth_method'] == 'pki') $openvpn_conf .= "client\n"; - if ($settings['use_dynamicport']) $openvpn_conf .= "nobind\n"; else // The port we'll listen at diff --git a/usr/local/pkg/openvpn.xml b/usr/local/pkg/openvpn.xml index 8b3271d..bc4ac00 100644 --- a/usr/local/pkg/openvpn.xml +++ b/usr/local/pkg/openvpn.xml @@ -64,6 +64,20 @@ UDP + + bind_to_iface + Bind to an interface + Check to bind on a specific network interface. + checkbox + interface + + + interface + Interface + The interface on which the OpenVPN daemon will listen. + interfaces_selection + wan + dynamic_ip Dynamic IP -- cgit v1.1