mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 00:54:41 +00:00
ditch resolve_retry(), closes https://github.com/opnsense/core/issues/2369
This commit is contained in:
parent
80758e642e
commit
d482a93ecd
@ -578,19 +578,6 @@ function ipsec_find_id(&$ph1ent, $side = 'local')
|
||||
case "myaddress":
|
||||
$thisid_data = ipsec_get_phase1_src($ph1ent);
|
||||
break;
|
||||
case "dyn_dns":
|
||||
$thisid_data = resolve_retry($id_data);
|
||||
break;
|
||||
case "peeraddress":
|
||||
if (!is_ipaddr($ph1ent['remote-gateway'])) {
|
||||
$thisid_data = resolve_retry($ph1ent['remote-gateway']);
|
||||
} else {
|
||||
$thisid_data = $ph1ent['remote-gateway'];
|
||||
}
|
||||
break;
|
||||
case "address":
|
||||
$thisid_data = $id_data;
|
||||
break;
|
||||
default:
|
||||
$thisid_data = !empty($id_data) ? "{$id_data}" : null;
|
||||
break;
|
||||
|
||||
@ -1089,26 +1089,6 @@ function is_private_ip($iptocheck)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function resolve_retry($hostname, $retries = 5)
|
||||
{
|
||||
if (is_ipaddr($hostname)) {
|
||||
return $hostname;
|
||||
}
|
||||
|
||||
for ($i = 0; $i < $retries; $i++) {
|
||||
// FIXME: gethostbyname does not work for AAAA hostnames, boo, hiss
|
||||
$ip = gethostbyname($hostname);
|
||||
if ($ip && $ip != $hostname) {
|
||||
/* success */
|
||||
return $ip;
|
||||
}
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function format_bytes($bytes)
|
||||
{
|
||||
if ($bytes >= (1024 * 1024 * 1024)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user