mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 16:44:39 +00:00
ipsec: rewrite former resolve_retry() as ipsec_resolve()
PR: https://github.com/opnsense/core/issues/2369
This commit is contained in:
parent
a65b09f051
commit
2a7a4b2bf0
@ -559,6 +559,19 @@ function ipsec_get_number_of_phase2($ikeid)
|
||||
return $nbph2;
|
||||
}
|
||||
|
||||
function ipsec_resolve($hostname)
|
||||
{
|
||||
if (!is_ipaddr($hostname)) {
|
||||
/* XXX IPv4-only */
|
||||
$ip = gethostbyname($hostname);
|
||||
if ($ip && $ip != $hostname) {
|
||||
$hostname = $ip;
|
||||
}
|
||||
}
|
||||
|
||||
return $hostname;
|
||||
}
|
||||
|
||||
function ipsec_find_id(&$ph1ent, $side = 'local')
|
||||
{
|
||||
$id_data = null;
|
||||
@ -578,8 +591,11 @@ function ipsec_find_id(&$ph1ent, $side = 'local')
|
||||
case "myaddress":
|
||||
$thisid_data = ipsec_get_phase1_src($ph1ent);
|
||||
break;
|
||||
case "dyn_dns":
|
||||
$thisid_data = ipsec_resolve($id_data);
|
||||
break;
|
||||
case "peeraddress":
|
||||
$thisid_data = $ph1ent['remote-gateway'];
|
||||
$thisid_data = ipsec_resolve($ph1ent['remote-gateway']);
|
||||
break;
|
||||
default:
|
||||
$thisid_data = !empty($id_data) ? "{$id_data}" : null;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user