From 459e93330b130531f2a59b58b24a9effb8bfa48f Mon Sep 17 00:00:00 2001 From: jim-p Date: Wed, 16 Nov 2011 15:46:38 -0500 Subject: If there is a tunnel network in tap mode, the second parameter is a subnet mask, not the other IP. --- etc/inc/openvpn.inc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'etc') diff --git a/etc/inc/openvpn.inc b/etc/inc/openvpn.inc index b4de58a..d478c53 100644 --- a/etc/inc/openvpn.inc +++ b/etc/inc/openvpn.inc @@ -418,7 +418,10 @@ function openvpn_reconfigure($mode, $settings) { $baselong = ip2long32($ip) & ip2long($mask); $ip1 = long2ip32($baselong + 1); $ip2 = long2ip32($baselong + 2); - $conf .= "ifconfig $ip1 $ip2\n"; + if ($settings['dev_mode'] == 'tun') + $conf .= "ifconfig {$ip1} {$ip2}\n"; + else + $conf .= "ifconfig {$ip1} {$mask}\n"; } break; case 'server_tls': @@ -562,7 +565,10 @@ function openvpn_reconfigure($mode, $settings) { $baselong = ip2long32($ip) & ip2long($mask); $ip1 = long2ip32($baselong + 1); $ip2 = long2ip32($baselong + 2); - $conf .= "ifconfig $ip2 $ip1\n"; + if ($settings['dev_mode'] == 'tun') + $conf .= "ifconfig {$ip2} {$ip1}\n"; + else + $conf .= "ifconfig {$ip2} {$mask}\n"; } if ($settings['proxy_addr']) { -- cgit v1.1