Commit 60090c1b authored by Franco Fichtner's avatar Franco Fichtner

openvpn: provide all local routes to export

PR: https://github.com/opnsense/core/issues/1275
(cherry picked from commit 621d703a)
parent 83b13264
...@@ -621,7 +621,7 @@ function openvpn_client_export_sharedkey_config($srvid, $useaddr, $proxy, $zipco ...@@ -621,7 +621,7 @@ function openvpn_client_export_sharedkey_config($srvid, $useaddr, $proxy, $zipco
// add basic settings // add basic settings
$conf = "dev tun\n"; $conf = "dev tun\n";
if (! empty($settings['tunnel_networkv6'])) { if (!empty($settings['tunnel_networkv6'])) {
$conf .= "tun-ipv6\n"; $conf .= "tun-ipv6\n";
} }
$conf .= "persist-tun\n"; $conf .= "persist-tun\n";
...@@ -632,10 +632,11 @@ function openvpn_client_export_sharedkey_config($srvid, $useaddr, $proxy, $zipco ...@@ -632,10 +632,11 @@ function openvpn_client_export_sharedkey_config($srvid, $useaddr, $proxy, $zipco
$conf .= "pull\n"; $conf .= "pull\n";
$conf .= "resolv-retry infinite\n"; $conf .= "resolv-retry infinite\n";
$conf .= "remote {$server_host} {$server_port}\n"; $conf .= "remote {$server_host} {$server_port}\n";
if ($settings['local_network']) { if (!empty($settings['local_network'])) {
list($ip, $mask) = explode('/', $settings['local_network']); $conf .= openvpn_gen_routes($settings['local_network'], 'ipv4');
$mask = gen_subnet_mask($mask); }
$conf .= "route $ip $mask\n"; if (!empty($settings['local_networkv6'])) {
$conf .= openvpn_gen_routes($settings['local_networkv6'], 'ipv6');
} }
if (!empty($settings['tunnel_network'])) { if (!empty($settings['tunnel_network'])) {
list($ip, $mask) = explode('/', $settings['tunnel_network']); list($ip, $mask) = explode('/', $settings['tunnel_network']);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment