Do not add hostname to watch in the refresh ipsec policy section, there may be other tunnels using the same

endpoint which need refreshing as well.
This is also done in the part where the racoon configuration is written so it's safe to skip it here.

Silence the logging in the dnscache code and the ipsec route add code into a debug check

FIXME: there is a possible situation where hostname changes can be missed. In a lot of tunnels situation there
might be updates of other hostnames that changed while we were reconfiguring. Not sure how to handle that.
This commit is contained in:
Seth 2009-07-11 23:05:04 +02:00
parent eb6beec78f
commit d1073bf677
2 changed files with 7 additions and 4 deletions

View File

@ -3830,7 +3830,9 @@ function compare_hostname_to_dnscache($hostname) {
}
if(trim($oldcontents) != trim($contents)) {
log_error("DNSCACHE: Found old IP {$oldcontents} and new IP {$contents}");
if($g['debug']) {
log_error("DNSCACHE: Found old IP {$oldcontents} and new IP {$contents}");
}
return ($oldcontents);
} else {
return false;
@ -3855,4 +3857,4 @@ function is_fqdn($fqdn) {
}
?>
?>

View File

@ -277,7 +277,9 @@ function vpn_ipsec_configure($ipchg = false) {
/* if the remote gateway is in the local subnet, then don't add a route */
if(! ip_in_subnet($tunnel['remote-gateway'], "{$subnet_ip}/{$subnet_bits}")) {
if(is_ipaddr($gatewayip)) {
log_error("IPSEC interface is not WAN but {$parentinterface}, adding static route for VPN endpoint {$tunnel['remote-gateway']} via {$gatewayip}");
if($g['debug']) {
log_error("IPSEC interface is not WAN but {$parentinterface}, adding static route for VPN endpoint {$tunnel['remote-gateway']} via {$gatewayip}");
}
mwexec("/sbin/route delete -host {$tunnel['remote-gateway']}");
mwexec("/sbin/route add -host {$tunnel['remote-gateway']} {$gatewayip}");
}
@ -1242,7 +1244,6 @@ function reload_tunnel_spd_policy($tunnel, $oldtunnel) {
* try to resolve it now and add it to the list for dnswatch */
if (!is_ipaddr($tunnel['remote-gateway'])) {
$rgip = resolve_retry($tunnel['remote-gateway']);
add_hostname_to_watch($tunnel['remote-gateway']);
if (!$rgip) {
log_error("Could not determine VPN endpoint for {$tunnel['descr']}");
return false;