From 0d5f2f3ed159de68fe2eb5e81a752c51ccc2b845 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Mon, 3 Oct 2005 19:47:23 +0000 Subject: If ['system']['use_old_dyndns'] is set, use the old style ez-ipupdate. --- etc/inc/services.inc | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 86 insertions(+), 2 deletions(-) (limited to 'etc/inc') diff --git a/etc/inc/services.inc b/etc/inc/services.inc index 734967f..638d881 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -377,10 +377,15 @@ function services_dyndns_configure() { if (isset($dyndnscfg['enable'])) { - if ($g['booting']) + if ($g['booting']) { echo "Starting DynDNS client... "; - else + if($config['system']['use_old_dyndns'] <> "") { + services_dyndns_configure_old(); + exit; + } + } else { sleep(1); + } $dns = new updatedns($dnsService = $config['dyndns']['type'], $dnsHost = $config['dyndns']['host'], @@ -396,6 +401,85 @@ function services_dyndns_configure() { return 0; } +function services_dyndns_configure_old() { + global $config, $g; + + /* kill any running ez-ipupdate */ + /* ez-ipupdate needs SIGQUIT instead of SIGTERM */ + sigkillbypid("{$g['varrun_path']}/ez-ipupdate.pid", "QUIT"); + + $dyndnscfg = $config['dyndns']; + $wancfg = $config['interfaces']['wan']; + + if (isset($dyndnscfg['enable'])) { + + if ($g['booting']) + echo "Starting DynDNS client... "; + else + sleep(1); + + /* determine WAN interface name */ + $wanif = get_real_wan_interface(); + + /* write ez-ipupdate.conf */ + $fd = fopen("{$g['varetc_path']}/ez-ipupdate.conf", "w"); + if (!$fd) { + printf("Error: cannot open ez-ipupdate.conf in services_dyndns_configure().\n"); + return 1; + } + + $ezipupdateconf = <<