diff options
author | phildd <ict.advisor@nepal.inf.org> | 2013-02-26 17:52:26 +0545 |
---|---|---|
committer | phildd <ict.advisor@nepal.inf.org> | 2013-02-26 17:52:26 +0545 |
commit | 873e4b285eb2c094b521c9737600b8a31e3c84c7 (patch) | |
tree | 149a192e72798f0fc68563d0cb526e76e0377a4e /etc/inc | |
parent | ed5f7e9ebd5b00018dc99dc00ea36ce752a90b5b (diff) | |
download | pfsense-873e4b285eb2c094b521c9737600b8a31e3c84c7.zip pfsense-873e4b285eb2c094b521c9737600b8a31e3c84c7.tar.gz |
Avoid DynDNS timeout delay when gateway is down
When a dynamic DNS entry is set on an interface that has a private IP, the code has to find the ultimate public IP of that interface by using checkip.dyndns.org. If the interface is currently down (e.g. ISP is down or the cable is unplugged...) then there is a timeout delay while waiting for checkip.dyndns.org to (not) respond.
This causes a big delay when Services->Dynamic DNS is selected.
Ift he new DynDNS dashboard widget is enabled, then the big delay happens while drawing up the dashboard display - not very user-friendly.
This code checks to see if the interface is down - if so it avoids bothering to do the external IP check.
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/services.inc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/etc/inc/services.inc b/etc/inc/services.inc index 43d6381..1cdbf9b 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -1503,8 +1503,14 @@ function services_dyndns_configure($int = "") { } function dyndnsCheckIP($int) { + global $config; $ip_address = get_interface_ip($int); if (is_private_ip($ip_address)) { + $gateways_status = return_gateways_status(true); + // If the gateway for this interface is down, then the external check cannot work. + // Avoid the long wait for the external check to timeout. + if (stristr($gateways_status[$config['interfaces'][$int]['gateway']]['status'],"down")) + return "down"; $hosttocheck = "checkip.dyndns.org"; $checkip = gethostbyname($hosttocheck); $ip_ch = curl_init("http://{$checkip}"); |