Project

General

Profile

« Previous | Next » 

Revision 0e3aeb6b

Added by Phil Davis over 12 years ago

Add common DynDNS constants and code

to system.inc to remove code duplication

View differences:

etc/inc/services.inc
39 39
	pfSense_MODULE:	utils
40 40
*/
41 41

  
42
define('DYNDNS_PROVIDER_VALUES', 'dnsomatic dyndns dyndns-static dyndns-custom dhs dyns easydns noip ods zoneedit loopia freedns dnsexit opendns namecheap he-net he-net-tunnelbroker selfhost route53 custom');
43
define('DYNDNS_PROVIDER_DESCRIPTIONS', 'DNS-O-Matic, DynDNS (dynamic),DynDNS (static),DynDNS (custom),DHS,DyNS,easyDNS,No-IP,ODS.org,ZoneEdit,Loopia,freeDNS, DNSexit, OpenDNS, Namecheap, HE.net, HE.net Tunnelbroker, SelfHost, Route 53, Custom');
44

  
42 45
/* implement ipv6 route advertising deamon */
43 46
function services_radvd_configure() {
44 47
	global $config, $g;
......
1499 1502
	return 0;
1500 1503
}
1501 1504

  
1505
function dyndnsCheckIP($int) {
1506
	$ip_address = get_interface_ip($int);
1507
	if (is_private_ip($ip_address)) {
1508
		$hosttocheck = "checkip.dyndns.org";
1509
		$checkip = gethostbyname($hosttocheck);
1510
		$ip_ch = curl_init("http://{$checkip}");
1511
		curl_setopt($ip_ch, CURLOPT_RETURNTRANSFER, 1);
1512
		curl_setopt($ip_ch, CURLOPT_SSL_VERIFYPEER, FALSE);
1513
		curl_setopt($ip_ch, CURLOPT_INTERFACE, $ip_address);
1514
		$ip_result_page = curl_exec($ip_ch);
1515
		curl_close($ip_ch);
1516
		$ip_result_decoded = urldecode($ip_result_page);
1517
		preg_match('=Current IP Address: (.*)</body>=siU', $ip_result_decoded, $matches);
1518
		$ip_address = trim($matches[1]);
1519
	}
1520
	return $ip_address;
1521
}
1522

  
1502 1523
function services_dnsmasq_configure() {
1503 1524
	global $config, $g;
1504 1525
	$return = 0;

Also available in: Unified diff