From 321f3076deee50801b09a6d3112892638edab928 Mon Sep 17 00:00:00 2001 From: jim-p Date: Mon, 14 May 2012 15:44:37 -0400 Subject: Use FreeBSD's ntpd instead in the backend --- etc/inc/system.inc | 39 +++++++++------------------------------ 1 file changed, 9 insertions(+), 30 deletions(-) (limited to 'etc') diff --git a/etc/inc/system.inc b/etc/inc/system.inc index d918e17..22efd22 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -33,7 +33,7 @@ pfSense_BUILDER_BINARIES: /usr/sbin/powerd /usr/bin/killall /sbin/sysctl /sbin/route pfSense_BUILDER_BINARIES: /bin/hostname /bin/ls /usr/sbin/syslogd pfSense_BUILDER_BINARIES: /usr/sbin/pccardd /usr/local/sbin/lighttpd /bin/chmod /bin/mkdir - pfSense_BUILDER_BINARIES: /usr/bin/tar /usr/local/sbin/ntpd /usr/sbin/ntpdate + pfSense_BUILDER_BINARIES: /usr/bin/tar /usr/sbin/ntpd /usr/sbin/ntpdate pfSense_BUILDER_BINARIES: /usr/bin/nohup /sbin/dmesg /usr/local/sbin/atareinit /sbin/kldload pfSense_MODULE: utils */ @@ -1108,38 +1108,17 @@ function system_timezone_configure() { function system_ntp_configure() { global $config, $g; + $driftfile = "/var/db/ntpd.drift"; $ntpcfg = "# \n"; - $ntpcfg .= "# pfSense OpenNTPD configuration file \n"; + $ntpcfg .= "# pfSense ntp configuration file \n"; $ntpcfg .= "# \n\n"; /* foreach through servers and write out to ntpd.conf */ foreach (explode(' ', $config['system']['timeservers']) as $ts) - $ntpcfg .= "servers {$ts}\n"; - - /* Setup listener(s) if the user has configured one */ - if ($config['installedpackages']['openntpd']) { - /* server config is in coregui1 */ - $xmlsettings = $config['installedpackages']['openntpd']['config'][0]; - if ($xmlsettings['enable'] == 'on') { - $ifaces = explode(',', $xmlsettings['interface']); - $ips = array(); - foreach ($ifaces as $if) { - if (is_ipaddr($if)) { - $ips[] = $if; - } else { - $if = get_real_interface($if); - if (does_interface_exist($if)) - $ips[] = find_interface_ip($if); - } - } - foreach ($ips as $ip) { - if (is_ipaddr($ip)) - $ntpcfg .= "listen on $ip\n"; - } - } - } - $ntpcfg .= "\n"; + $ntpcfg .= "server {$ts} iburst maxpoll 9\n"; + + $ntpcfg .= "driftfile {$driftfile}\n"; /* open configuration for wrting or bail */ $fd = fopen("{$g['varetc_path']}/ntpd.conf","w"); @@ -1152,7 +1131,7 @@ function system_ntp_configure() { /* slurp! */ fclose($fd); - /* if openntpd is running, kill it */ + /* if ntpd is running, kill it */ while(is_process_running("ntpd")) { killbyname("ntpd"); } @@ -1162,10 +1141,10 @@ function system_ntp_configure() { exec("/bin/mkdir -p /var/empty && chmod ug+rw /var/empty/."); /* start opentpd, set time now and use /var/etc/ntpd.conf */ - exec("/usr/local/sbin/ntpd -v -s -f {$g['varetc_path']}/ntpd.conf"); + exec("/usr/sbin/ntpd -g -c {$g['varetc_path']}/ntpd.conf"); // Note that we are starting up - log_error("OpenNTPD is starting up."); + log_error("NTPD is starting up."); } -- cgit v1.1