From d482a93ecdb82b9199d8f9c2f4b50e60c3fa688c Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Sun, 22 Apr 2018 18:45:37 +0200 Subject: [PATCH] ditch resolve_retry(), closes https://github.com/opnsense/core/issues/2369 --- src/etc/inc/plugins.inc.d/ipsec.inc | 13 ------------- src/etc/inc/util.inc | 20 -------------------- 2 files changed, 33 deletions(-) diff --git a/src/etc/inc/plugins.inc.d/ipsec.inc b/src/etc/inc/plugins.inc.d/ipsec.inc index 25bdda07b..03096d1c6 100644 --- a/src/etc/inc/plugins.inc.d/ipsec.inc +++ b/src/etc/inc/plugins.inc.d/ipsec.inc @@ -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; diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc index 05ffd15a4..fe71123c6 100644 --- a/src/etc/inc/util.inc +++ b/src/etc/inc/util.inc @@ -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)) {