summaryrefslogtreecommitdiffstats
path: root/etc/inc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2005-10-03 19:47:23 +0000
committerScott Ullrich <sullrich@pfsense.org>2005-10-03 19:47:23 +0000
commit0d5f2f3ed159de68fe2eb5e81a752c51ccc2b845 (patch)
treee203e9f655d002d19f14ce548748afcc55c07ca9 /etc/inc
parent386e9c5709c6c4b0dd0722157c56e5e66cc94930 (diff)
downloadpfsense-0d5f2f3ed159de68fe2eb5e81a752c51ccc2b845.zip
pfsense-0d5f2f3ed159de68fe2eb5e81a752c51ccc2b845.tar.gz
If ['system']['use_old_dyndns'] is set, use the old style ez-ipupdate.
Diffstat (limited to 'etc/inc')
-rw-r--r--etc/inc/services.inc88
1 files changed, 86 insertions, 2 deletions
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 = <<<EOD
+service-type={$dyndnscfg['type']}
+user={$dyndnscfg['username']}:{$dyndnscfg['password']}
+host={$dyndnscfg['host']}
+interface=$wanif
+max-interval=2073600
+pid-file={$g['varrun_path']}/ez-ipupdate.pid
+cache-file={$g['vardb_path']}/ez-ipupdate.cache
+execute=/etc/rc.dyndns.storecache
+daemon
+
+EOD;
+
+ /* enable server[:port]? */
+ if ($dyndnscfg['server']) {
+ if ($dyndnscfg['port'])
+ $ezipupdateconf .= "server={$dyndnscfg['server']}:{$dyndnscfg['port']}\n";
+ else
+ $ezipupdateconf .= "server={$dyndnscfg['server']}\n";
+ }
+
+ /* enable MX? */
+ if ($dyndnscfg['mx']) {
+ $ezipupdateconf .= "mx={$dyndnscfg['mx']}\n";
+ }
+
+ /* enable wildcards? */
+ if (isset($dyndnscfg['wildcard'])) {
+ $ezipupdateconf .= "wildcard\n";
+ }
+
+ fwrite($fd, $ezipupdateconf);
+ fclose($fd);
+
+ /* if we're booting, copy the cache file from /conf */
+ if ($g['booting']) {
+ if (file_exists("{$g['conf_path']}/ez-ipupdate.cache")) {
+ copy("{$g['conf_path']}/ez-ipupdate.cache", "{$g['vardb_path']}/ez-ipupdate.cache");
+ }
+ }
+
+ /* run ez-ipupdate */
+ mwexec("/usr/local/bin/ez-ipupdate -c {$g['varetc_path']}/ez-ipupdate.conf");
+
+ if ($g['booting'])
+ echo "done\n";
+ }
+
+ return 0;
+}
+
+
function services_dnsmasq_configure() {
global $config, $g;
OpenPOWER on IntegriCloud