Fix logic to prevent rule errors when dyndns hostnames do not resolve.

Previous Logic did not work
This commit is contained in:
Seth Mos 2009-01-15 08:37:35 +00:00
parent c806f1bbc8
commit e07ff7c0a5

View File

@ -2779,11 +2779,13 @@ EOD;
/* if tunnel is disabled, lets skip to next item */
$ipsec_ips = array(get_current_wan_address($tunnel['interface']));
/* is this a dynamic dns hostname? */
$remote_gateway = gethostbyname($tunnel['remote-gateway']);
if($remote_gateway == "")
if(!is_ipaddr($tunnel['remote-gateway'])) {
$remote_gateway = resolve_retry($tunnel['remote-gateway']);
} else {
$remote_gateway = $tunnel['remote-gateway'];
}
/* do not add items with blank remote_gateway */
if(!$remote_gateway) {
if(!is_ipaddr($remote_gateway)) {
$ipfrules .= "# ERROR! Remote gateway not found on {$tunnel['remote-gateway']}\n";
continue;
}
@ -3293,4 +3295,4 @@ function return_vpn_subnet($adr) {
}
?>
?>