diff --git a/dns/rfc2136/Makefile b/dns/rfc2136/Makefile index fa96105eb..f4ac272b2 100644 --- a/dns/rfc2136/Makefile +++ b/dns/rfc2136/Makefile @@ -1,6 +1,6 @@ PLUGIN_NAME= rfc2136 PLUGIN_VERSION= 1.8 -PLUGIN_REVISION= 1 +PLUGIN_REVISION= 2 PLUGIN_COMMENT= RFC-2136 Support PLUGIN_MAINTAINER= franco@opnsense.org PLUGIN_DEPENDS= bind-tools diff --git a/dns/rfc2136/src/etc/inc/plugins.inc.d/rfc2136.inc b/dns/rfc2136/src/etc/inc/plugins.inc.d/rfc2136.inc index 2de4d43c1..25c3fc914 100644 --- a/dns/rfc2136/src/etc/inc/plugins.inc.d/rfc2136.inc +++ b/dns/rfc2136/src/etc/inc/plugins.inc.d/rfc2136.inc @@ -151,7 +151,7 @@ function rfc2136_configure_do($verbose = false, $int = '', $updatehost = '', $fo if (isset($dnsupdate['usepublicip'])) { $wanip = get_rfc2136_ip_address($dnsupdate['interface'], 4); } else { - $wanip = get_interface_ip($dnsupdate['interface']); + list ($wanip) = interfaces_primary_address($dnsupdate['interface']); } if (is_ipaddrv4($wanip)) { if (($wanip != $cachedipv4) || (($currentTime - $cacheTimev4) > $maxCacheAgeSecs) || $forced) { @@ -178,7 +178,7 @@ function rfc2136_configure_do($verbose = false, $int = '', $updatehost = '', $fo if (isset($dnsupdate['usepublicip'])) { $wanipv6 = get_rfc2136_ip_address($dnsupdate['interface'], 6); } else { - $wanipv6 = get_interface_ipv6($dnsupdate['interface']); + list ($wanipv6) = interfaces_primary_address6($dnsupdate['interface']); } if (is_ipaddrv6($wanipv6)) { if (($wanipv6 != $cachedipv6) || (($currentTime - $cacheTimev6) > $maxCacheAgeSecs) || $forced) { @@ -216,19 +216,16 @@ function rfc2136_configure_do($verbose = false, $int = '', $updatehost = '', $fo function get_rfc2136_ip_address($int, $ipver = 4) { - $ip_address = $ipver == 6 ? get_interface_ipv6($int) : get_interface_ip($int); + list ($ip_address) = $ipver == 6 ? interfaces_primary_address6($int) : interfaces_primary_address($int); if (empty($ip_address)) { log_error("Aborted IPv{$ipver} detection: no address for {$int}"); return 'down'; } if ($ipver != 6 && is_private_ip($ip_address)) { - /* Chinese alternative is http://ip.3322.net/ */ - $hosttocheck = 'http://checkip.dyndns.org'; - $ip_ch = curl_init($hosttocheck); + $ip_ch = curl_init('http://checkip.dyndns.org'); curl_setopt($ip_ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ip_ch, CURLOPT_INTERFACE, $ip_address); - curl_setopt($ip_ch, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($ip_ch, CURLOPT_TIMEOUT, 30); curl_setopt($ip_ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); $ip_result = curl_exec($ip_ch); diff --git a/dns/rfc2136/src/www/services_rfc2136.php b/dns/rfc2136/src/www/services_rfc2136.php index a7a5029bb..4c7c385c0 100644 --- a/dns/rfc2136/src/www/services_rfc2136.php +++ b/dns/rfc2136/src/www/services_rfc2136.php @@ -148,7 +148,7 @@ legacy_html_escape_form_data($a_rfc2136); if (isset($rfc2136['usepublicip'])) { $ipaddr = get_rfc2136_ip_address($rfc2136['interface'], 4); } else { - $ipaddr = get_interface_ip($rfc2136['interface']); + list ($ipaddr) = interfaces_primary_address($rfc2136['interface']); } $cached_ip_s = explode("|", file_get_contents($filename)); $cached_ip = $cached_ip_s[0]; @@ -169,7 +169,7 @@ legacy_html_escape_form_data($a_rfc2136); if (isset($rfc2136['usepublicip'])) { $ipaddr = get_rfc2136_ip_address($rfc2136['interface'], 6); } else { - $ipaddr = get_interface_ipv6($rfc2136['interface']); + list ($ipaddr) = interfaces_primary_address6($rfc2136['interface']); } $cached_ip_s = explode("|", file_get_contents($filename6)); $cached_ip = $cached_ip_s[0];