IPsec: add virtual IPv6 pool for mobile clients

This commit deals with ipsec.conf file drafting. In terms of mobile clients option 'rightsourceip' now may be:
1) empty if no pools are configured;
2) %pool_address%/%pool_netbits% for an IPv4 only option;
3) %pool_address_v6%/%pool_netbits_v6% for an IPv6 only option;
4) %pool_address%/%pool_netbits%,%pool_address_v6%/%pool_netbits_v6% for a dual stack option.
This commit is contained in:
vnxme 2020-02-21 15:06:14 +03:00 committed by GitHub
parent a96a081f67
commit 234e7e27ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1349,8 +1349,15 @@ function ipsec_configure_do($verbose = false, $interface = '')
}
$rightsourceip = null;
if (!empty($a_client['pool_address']) && isset($ph1ent['mobile'])) {
$rightsourceip = "\trightsourceip = {$a_client['pool_address']}/{$a_client['pool_netbits']}\n";
if (isset($ph1ent['mobile']) && (!empty($a_client['pool_address']) || !empty($a_client['pool_address_v6']))) {
$rightsourceip = "\trightsourceip = ";
if (!empty($a_client['pool_address'])) {
$rightsourceip .= "{$a_client['pool_address']}/{$a_client['pool_netbits']}";
}
if (!empty($a_client['pool_address_v6'])) {
$rightsourceip .= (!empty($a_client['pool_address']) ? "," : "")."{$a_client['pool_address_v6']}/{$a_client['pool_netbits_v6']}";
}
$rightsourceip .= "\n";
}
$authentication = "";