Commit d8202401 authored by Franco Fichtner's avatar Franco Fichtner

openvpn: take client IP for topology subnet in CSC

parent 0079214d
...@@ -1015,14 +1015,13 @@ function openvpn_resync_csc_conf($settings, $server) ...@@ -1015,14 +1015,13 @@ function openvpn_resync_csc_conf($settings, $server)
if (!empty($settings['tunnel_network'])) { if (!empty($settings['tunnel_network'])) {
list($ip, $mask) = explode('/', $settings['tunnel_network']); list($ip, $mask) = explode('/', $settings['tunnel_network']);
$baselong = ip2long32($ip) & gen_subnet_mask_long($mask); if ($server['dev_mode'] == 'tun' && empty($server['topology_subnet'])) {
$serverip = long2ip32($baselong + 1); $baselong = ip2long32($ip) & gen_subnet_mask_long($mask);
$clientip = long2ip32($baselong + 2); $serverip = long2ip32($baselong + 1);
/* Because this is being pushed, the order from the client's point of view. */ $clientip = long2ip32($baselong + 2);
if ($server['dev_mode'] != 'tap' && empty($server['topology_subnet'])) {
$conf .= "ifconfig-push {$clientip} {$serverip}\n"; $conf .= "ifconfig-push {$clientip} {$serverip}\n";
} else { } else {
$conf .= "ifconfig-push {$clientip} " . gen_subnet_mask($mask) . "\n"; $conf .= "ifconfig-push {$ip} " . gen_subnet_mask($mask) . "\n";
} }
} }
if (!empty($settings['tunnel_networkv6'])) { if (!empty($settings['tunnel_networkv6'])) {
......
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