summaryrefslogtreecommitdiffstats
path: root/usr/local/www
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2015-05-25 08:28:27 -0300
committerRenato Botelho <garga@FreeBSD.org>2015-05-25 08:28:27 -0300
commit6fac4c260dbdedc853522f5d424613a451c12bf2 (patch)
treeea4a1a91bb65a4be4c098d828c725b0944ae087b /usr/local/www
parentf46172c50ceaea6590c2146a36b98fd9dcfe1f65 (diff)
parent7a6f0ebcbed31ef668f422d9fc6cdcabf788df71 (diff)
downloadpfsense-6fac4c260dbdedc853522f5d424613a451c12bf2.zip
pfsense-6fac4c260dbdedc853522f5d424613a451c12bf2.tar.gz
Merge pull request #1685 from phil-davis/services-ntp
Diffstat (limited to 'usr/local/www')
-rw-r--r--usr/local/www/services_ntpd.php455
-rw-r--r--usr/local/www/services_ntpd_gps.php500
-rw-r--r--usr/local/www/services_ntpd_pps.php271
3 files changed, 658 insertions, 568 deletions
diff --git a/usr/local/www/services_ntpd.php b/usr/local/www/services_ntpd.php
index 88d3f20..cea8ea6 100644
--- a/usr/local/www/services_ntpd.php
+++ b/usr/local/www/services_ntpd.php
@@ -43,8 +43,9 @@ require("guiconfig.inc");
require_once('rrd.inc');
require_once("shaper.inc");
-if (!is_array($config['ntpd']))
+if (!is_array($config['ntpd'])) {
$config['ntpd'] = array();
+}
if (empty($config['ntpd']['interface'])) {
if (is_array($config['installedpackages']['openntpd']) && is_array($config['installedpackages']['openntpd']['config']) &&
@@ -52,10 +53,12 @@ if (empty($config['ntpd']['interface'])) {
$pconfig['interface'] = explode(",", $config['installedpackages']['openntpd']['config'][0]['interface']);
unset($config['installedpackages']['openntpd']);
write_config("Upgraded settings from openttpd");
- } else
+ } else {
$pconfig['interface'] = array();
-} else
+ }
+} else {
$pconfig['interface'] = explode(",", $config['ntpd']['interface']);
+}
if ($_POST) {
@@ -63,15 +66,17 @@ if ($_POST) {
$pconfig = $_POST;
if (!$input_errors) {
- if (is_array($_POST['interface']))
+ if (is_array($_POST['interface'])) {
$config['ntpd']['interface'] = implode(",", $_POST['interface']);
- elseif (isset($config['ntpd']['interface']))
+ } elseif (isset($config['ntpd']['interface'])) {
unset($config['ntpd']['interface']);
+ }
- if (!empty($_POST['gpsport']) && file_exists('/dev/'.$_POST['gpsport']))
+ if (!empty($_POST['gpsport']) && file_exists('/dev/'.$_POST['gpsport'])) {
$config['ntpd']['gpsport'] = $_POST['gpsport'];
- elseif (isset($config['ntpd']['gpsport']))
+ } elseif (isset($config['ntpd']['gpsport'])) {
unset($config['ntpd']['gpsport']);
+ }
unset($config['ntpd']['prefer']);
unset($config['ntpd']['noselect']);
@@ -80,106 +85,128 @@ if ($_POST) {
$tserver = trim($_POST["server{$i}"]);
if (!empty($tserver)) {
$timeservers .= "{$tserver} ";
- if (!empty($_POST["servprefer{$i}"])) $config['ntpd']['prefer'] .= "{$tserver} ";
- if (!empty($_POST["servselect{$i}"])) $config['ntpd']['noselect'].= "{$tserver} ";
+ if (!empty($_POST["servprefer{$i}"])) {
+ $config['ntpd']['prefer'] .= "{$tserver} ";
+ }
+ if (!empty($_POST["servselect{$i}"])) {
+ $config['ntpd']['noselect'] .= "{$tserver} ";
+ }
}
}
- if (trim($timeservers) == "")
+ if (trim($timeservers) == "") {
$timeservers = "pool.ntp.org";
+ }
$config['system']['timeservers'] = trim($timeservers);
- if (!empty($_POST['ntporphan']) && ($_POST['ntporphan'] < 17) && ($_POST['ntporphan'] != '12'))
+ if (!empty($_POST['ntporphan']) && ($_POST['ntporphan'] < 17) && ($_POST['ntporphan'] != '12')) {
$config['ntpd']['orphan'] = $_POST['ntporphan'];
- elseif (isset($config['ntpd']['orphan']))
+ } elseif (isset($config['ntpd']['orphan'])) {
unset($config['ntpd']['orphan']);
+ }
- if (!empty($_POST['logpeer']))
+ if (!empty($_POST['logpeer'])) {
$config['ntpd']['logpeer'] = $_POST['logpeer'];
- elseif (isset($config['ntpd']['logpeer']))
+ } elseif (isset($config['ntpd']['logpeer'])) {
unset($config['ntpd']['logpeer']);
+ }
- if (!empty($_POST['logsys']))
+ if (!empty($_POST['logsys'])) {
$config['ntpd']['logsys'] = $_POST['logsys'];
- elseif (isset($config['ntpd']['logsys']))
+ } elseif (isset($config['ntpd']['logsys'])) {
unset($config['ntpd']['logsys']);
+ }
- if (!empty($_POST['clockstats']))
+ if (!empty($_POST['clockstats'])) {
$config['ntpd']['clockstats'] = $_POST['clockstats'];
- elseif (isset($config['ntpd']['clockstats']))
+ } elseif (isset($config['ntpd']['clockstats'])) {
unset($config['ntpd']['clockstats']);
+ }
- if (!empty($_POST['loopstats']))
+ if (!empty($_POST['loopstats'])) {
$config['ntpd']['loopstats'] = $_POST['loopstats'];
- elseif (isset($config['ntpd']['loopstats']))
+ } elseif (isset($config['ntpd']['loopstats'])) {
unset($config['ntpd']['loopstats']);
+ }
- if (!empty($_POST['peerstats']))
+ if (!empty($_POST['peerstats'])) {
$config['ntpd']['peerstats'] = $_POST['peerstats'];
- elseif (isset($config['ntpd']['peerstats']))
+ } elseif (isset($config['ntpd']['peerstats'])) {
unset($config['ntpd']['peerstats']);
+ }
- if (empty($_POST['kod']))
+ if (empty($_POST['kod'])) {
$config['ntpd']['kod'] = 'on';
- elseif (isset($config['ntpd']['kod']))
+ } elseif (isset($config['ntpd']['kod'])) {
unset($config['ntpd']['kod']);
+ }
- if (empty($_POST['nomodify']))
+ if (empty($_POST['nomodify'])) {
$config['ntpd']['nomodify'] = 'on';
- elseif (isset($config['ntpd']['nomodify']))
+ } elseif (isset($config['ntpd']['nomodify'])) {
unset($config['ntpd']['nomodify']);
+ }
- if (!empty($_POST['noquery']))
+ if (!empty($_POST['noquery'])) {
$config['ntpd']['noquery'] = $_POST['noquery'];
- elseif (isset($config['ntpd']['noquery']))
+ } elseif (isset($config['ntpd']['noquery'])) {
unset($config['ntpd']['noquery']);
+ }
- if (!empty($_POST['noserve']))
+ if (!empty($_POST['noserve'])) {
$config['ntpd']['noserve'] = $_POST['noserve'];
- elseif (isset($config['ntpd']['noserve']))
+ } elseif (isset($config['ntpd']['noserve'])) {
unset($config['ntpd']['noserve']);
+ }
- if (empty($_POST['nopeer']))
+ if (empty($_POST['nopeer'])) {
$config['ntpd']['nopeer'] = 'on';
- elseif (isset($config['ntpd']['nopeer']))
+ } elseif (isset($config['ntpd']['nopeer'])) {
unset($config['ntpd']['nopeer']);
+ }
- if (empty($_POST['notrap']))
+ if (empty($_POST['notrap'])) {
$config['ntpd']['notrap'] = 'on';
- elseif (isset($config['ntpd']['notrap']))
+ } elseif (isset($config['ntpd']['notrap'])) {
unset($config['ntpd']['notrap']);
+ }
- if ((empty($_POST['statsgraph'])) == (isset($config['ntpd']['statsgraph'])))
+ if ((empty($_POST['statsgraph'])) == (isset($config['ntpd']['statsgraph']))) {
$enable_rrd_graphing = true;
- if (!empty($_POST['statsgraph']))
+ }
+ if (!empty($_POST['statsgraph'])) {
$config['ntpd']['statsgraph'] = $_POST['statsgraph'];
- elseif (isset($config['ntpd']['statsgraph']))
+ } elseif (isset($config['ntpd']['statsgraph'])) {
unset($config['ntpd']['statsgraph']);
- if (isset($enable_rrd_graphing))
+ }
+ if (isset($enable_rrd_graphing)) {
enable_rrd_graphing();
+ }
- if (!empty($_POST['leaptxt']))
+ if (!empty($_POST['leaptxt'])) {
$config['ntpd']['leapsec'] = base64_encode($_POST['leaptxt']);
- elseif (isset($config['ntpd']['leapsec']))
+ } elseif (isset($config['ntpd']['leapsec'])) {
unset($config['ntpd']['leapsec']);
+ }
- if (is_uploaded_file($_FILES['leapfile']['tmp_name']))
+ if (is_uploaded_file($_FILES['leapfile']['tmp_name'])) {
$config['ntpd']['leapsec'] = base64_encode(file_get_contents($_FILES['leapfile']['tmp_name']));
+ }
write_config("Updated NTP Server Settings");
$retval = 0;
$retval = system_ntp_configure();
$savemsg = get_std_save_message($retval);
-
}
}
$closehead = false;
$pconfig = &$config['ntpd'];
-if (empty($pconfig['interface']))
+if (empty($pconfig['interface'])) {
$pconfig['interface'] = array();
-else
+} else {
$pconfig['interface'] = explode(",", $pconfig['interface']);
-$pgtitle = array(gettext("Services"),gettext("NTP"));
+}
+$pgtitle = array(gettext("Services"), gettext("NTP"));
$shortcut_section = "ntp";
include("head.inc");
@@ -215,7 +242,7 @@ include("head.inc");
var next = add + 1;
var newdiv = '<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?php echo gettext("Add another Time server");?>" onclick="NewTimeServer(' + next + ')" alt="add" />\n';
document.getElementById('addserver').innerHTML=newdiv;
- }else{
+ } else {
document.getElementById('addserver').style.display = 'none';
}
}
@@ -232,8 +259,8 @@ include("head.inc");
<?php if ($savemsg) print_info_box($savemsg); ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="ntpd">
- <tr>
- <td>
+ <tr>
+ <td>
<?php
$tab_array = array();
$tab_array[] = array(gettext("NTP"), true, "services_ntpd.php");
@@ -241,180 +268,194 @@ include("head.inc");
$tab_array[] = array(gettext("PPS"), false, "services_ntpd_pps.php");
display_top_tabs($tab_array);
?>
- </td>
- </tr>
- <tr>
- <td>
- <div id="mainarea">
- <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
- <tr>
- <td colspan="2" valign="top" class="listtopic"><?=gettext("NTP Server Configuration"); ?></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Interface(s)</td>
- <td width="78%" class="vtable">
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
+ <tr>
+ <td colspan="2" valign="top" class="listtopic"><?=gettext("NTP Server Configuration"); ?></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Interface(s)</td>
+ <td width="78%" class="vtable">
<?php
$interfaces = get_configured_interface_with_descr();
$carplist = get_configured_carp_interface_list();
- foreach ($carplist as $cif => $carpip)
+ foreach ($carplist as $cif => $carpip) {
$interfaces[$cif] = $carpip." (".get_vip_descr($carpip).")";
+ }
$aliaslist = get_configured_ip_aliases_list();
- foreach ($aliaslist as $aliasip => $aliasif)
+ foreach ($aliaslist as $aliasip => $aliasif) {
$interfaces[$aliasip] = $aliasip." (".get_vip_descr($aliasip).")";
+ }
$size = (count($interfaces) < 10) ? count($interfaces) : 10;
?>
- <select id="interface" name="interface[]" multiple="multiple" class="formselect" size="<?php echo $size; ?>">
-<?php
+ <select id="interface" name="interface[]" multiple="multiple" class="formselect" size="<?php echo $size; ?>">
+<?php
foreach ($interfaces as $iface => $ifacename) {
- if (!is_ipaddr(get_interface_ip($iface)) && !is_ipaddr($iface))
+ if (!is_ipaddr(get_interface_ip($iface)) && !is_ipaddr($iface)) {
continue;
+ }
echo "<option value='{$iface}'";
- if (is_array($pconfig['interface']))
- if (in_array($iface, $pconfig['interface'])) echo " selected=\"selected\"";
+ if (is_array($pconfig['interface'])) {
+ if (in_array($iface, $pconfig['interface'])) {
+ echo " selected=\"selected\"";
+ }
+ }
echo ">" . htmlspecialchars($ifacename) . "</option>\n";
- } ?>
- </select>
- <br />
- <br /><?php echo gettext("Interfaces without an IP address will not be shown."); ?>
- <br />
- <br /><?php echo gettext("Selecting no interfaces will listen on all interfaces with a wildcard."); ?>
- <br /><?php echo gettext("Selecting all interfaces will explicitly listen on only the interfaces/IPs specified."); ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Time servers</td>
- <td width="78%" class="vtable">
+ }
+?>
+ </select>
+ <br />
+ <br /><?php echo gettext("Interfaces without an IP address will not be shown."); ?>
+ <br />
+ <br /><?php echo gettext("Selecting no interfaces will listen on all interfaces with a wildcard."); ?>
+ <br /><?php echo gettext("Selecting all interfaces will explicitly listen on only the interfaces/IPs specified."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Time servers</td>
+ <td width="78%" class="vtable">
<?php
- $timeservers = explode( ' ', $config['system']['timeservers']);
- for ($i = $j = 0; $i < 10; $i++){
- echo "<div id=\"timeserver{$i}\"";
- if ((isset($timeservers[$i])) || ($i < 3)) {
- $j++;
- }else{
- echo " style=\"display:none\"";
+ $timeservers = explode(' ', $config['system']['timeservers']);
+ for ($i = $j = 0; $i < 10; $i++) {
+ echo "<div id=\"timeserver{$i}\"";
+ if ((isset($timeservers[$i])) || ($i < 3)) {
+ $j++;
+ } else {
+ echo " style=\"display:none\"";
+ }
+ echo ">\n";
+
+ echo "<input name=\"server{$i}\" class=\"formfld unknown\" id=\"server{$i}\" size=\"30\" value=\"{$timeservers[$i]}\" type=\"text\" />&emsp;";
+ echo "\n<input name=\"servprefer{$i}\" class=\"formcheckbox\" id=\"servprefer{$i}\" onclick=\"CheckOffOther('servprefer{$i}', 'servselect{$i}')\" type=\"checkbox\"";
+ if (isset($config['ntpd']['prefer']) && isset($timeservers[$i]) && substr_count($config['ntpd']['prefer'], $timeservers[$i])) {
+ echo " checked=\"checked\"";
+ }
+ echo " />&nbsp;prefer&emsp;";
+ echo "\n<input name=\"servselect{$i}\" class=\"formcheckbox\" id=\"servselect{$i}\" onclick=\"CheckOffOther('servselect{$i}', 'servprefer{$i}')\" type=\"checkbox\"";
+ if (isset($config['ntpd']['noselect']) && isset($timeservers[$i]) && substr_count($config['ntpd']['noselect'], $timeservers[$i])) {
+ echo " checked=\"checked\"";
+ }
+ echo " />&nbsp;noselect\n<br />\n</div>\n";
}
- echo ">\n";
-
- echo "<input name=\"server{$i}\" class=\"formfld unknown\" id=\"server{$i}\" size=\"30\" value=\"{$timeservers[$i]}\" type=\"text\" />&emsp;";
- echo "\n<input name=\"servprefer{$i}\" class=\"formcheckbox\" id=\"servprefer{$i}\" onclick=\"CheckOffOther('servprefer{$i}', 'servselect{$i}')\" type=\"checkbox\"";
- if (isset($config['ntpd']['prefer']) && isset($timeservers[$i]) && substr_count($config['ntpd']['prefer'], $timeservers[$i])) echo " checked=\"checked\"";
- echo " />&nbsp;prefer&emsp;";
- echo "\n<input name=\"servselect{$i}\" class=\"formcheckbox\" id=\"servselect{$i}\" onclick=\"CheckOffOther('servselect{$i}', 'servprefer{$i}')\" type=\"checkbox\"";
- if (isset($config['ntpd']['noselect']) && isset($timeservers[$i]) && substr_count($config['ntpd']['noselect'], $timeservers[$i])) echo " checked=\"checked\"";
- echo " />&nbsp;noselect\n<br />\n</div>\n";
- }
?>
- <div id="addserver">
- <img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?php echo gettext("Add another Time server");?>" onclick="NewTimeServer(<?php echo $j;?>)" alt="add" />
- </div>
- <br />
- <?php echo gettext('For best results three to five servers should be configured here.'); ?>
- <br />
- <?php echo gettext('The <i>prefer</i> option indicates that NTP should favor the use of this server more than all others.'); ?>
- <br />
- <?php echo gettext('The <i>noselect</i> option indicates that NTP should not use this server for time, but stats for this server will be collected and displayed.'); ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Orphan mode</td>
- <td width="78%" class="vtable">
- <input name="ntporphan" type="text" class="formfld unknown" id="ntporphan" min="1" max="16" size="20" value="<?=htmlspecialchars($pconfig['orphan']);?>" /><?php echo gettext("(0-15)");?><br />
- <?php echo gettext("Orphan mode allows the system clock to be used when no other clocks are available. The number here specifies the stratum reported during orphan mode and should normally be set to a number high enough to insure that any other servers available to clients are preferred over this server. (default: 12)."); ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">NTP graphs</td>
- <td width="78%" class="vtable">
- <input name="statsgraph" type="checkbox" class="formcheckbox" id="statsgraph" <?php if($pconfig['statsgraph']) echo " checked=\"checked\""; ?> />
- <?php echo gettext("Enable RRD graphs of NTP statistics (default: disabled)."); ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Syslog logging</td>
- <td width="78%" class="vtable">
- <?php echo gettext("These options enable additional messages from NTP to be written to the System Log");?> (<a href="diag_logs_ntpd.php"><?php echo gettext("Status > System Logs > NTP"); ?></a>).
- <br /><br />
- <input name="logpeer" type="checkbox" class="formcheckbox" id="logpeer"<?php if($pconfig['logpeer']) echo " checked=\"checked\""; ?> />
- <?php echo gettext("Enable logging of peer messages (default: disabled)."); ?>
- <br />
- <input name="logsys" type="checkbox" class="formcheckbox" id="logsys"<?php if($pconfig['logsys']) echo " checked=\"checked\""; ?> />
- <?php echo gettext("Enable logging of system messages (default: disabled)."); ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Statistics logging</td>
- <td width="78%" class="vtable">
- <div id="showstatisticsbox">
- <input type="button" onclick="show_advanced('showstatisticsbox', 'showstatistics')" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show statistics logging options");?>
- </div>
- <div id="showstatistics" style="display:none">
- <strong><?php echo gettext("Warning: ")?></strong><?php echo gettext("these options will create persistent daily log files in /var/log/ntp."); ?>
- <br /><br />
- <input name="clockstats" type="checkbox" class="formcheckbox" id="clockstats"<?php if($pconfig['clockstats']) echo " checked=\"checked\""; ?> />
- <?php echo gettext("Enable logging of reference clock statistics (default: disabled)."); ?>
- <br />
- <input name="loopstats" type="checkbox" class="formcheckbox" id="loopstats"<?php if($pconfig['loopstats']) echo " checked=\"checked\""; ?> />
- <?php echo gettext("Enable logging of clock discipline statistics (default: disabled)."); ?>
- <br />
- <input name="peerstats" type="checkbox" class="formcheckbox" id="peerstats"<?php if($pconfig['peerstats']) echo " checked=\"checked\""; ?> />
- <?php echo gettext("Enable logging of NTP peer statistics (default: disabled)."); ?>
- </div>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Access restrictions</td>
- <td width="78%" class="vtable">
- <div id="showrestrictbox">
- <input type="button" onclick="show_advanced('showrestrictbox', 'showrestrict')" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show access restriction options");?>
- </div>
- <div id="showrestrict" style="display:none">
- <?php echo gettext("these options control access to NTP from the WAN."); ?>
- <br /><br />
- <input name="kod" type="checkbox" class="formcheckbox" id="kod"<?php if(!$pconfig['kod']) echo " checked=\"checked\""; ?> />
- <?php echo gettext("Enable Kiss-o'-death packets (default: enabled)."); ?>
- <br />
- <input name="nomodify" type="checkbox" class="formcheckbox" id="nomodify"<?php if(!$pconfig['nomodify']) echo " checked=\"checked\""; ?> />
- <?php echo gettext("Deny state modifications (i.e. run time configuration) by ntpq and ntpdc (default: enabled)."); ?>
- <br />
- <input name="noquery" type="checkbox" class="formcheckbox" id="noquery"<?php if($pconfig['noquery']) echo " checked=\"checked\""; ?> />
- <?php echo gettext("Disable ntpq and ntpdc queries (default: disabled)."); ?>
- <br />
- <input name="noserve" type="checkbox" class="formcheckbox" id="noserve"<?php if($pconfig['noserve']) echo " checked=\"checked\""; ?> />
- <?php echo gettext("Disable all except ntpq and ntpdc queries (default: disabled)."); ?>
- <br />
- <input name="nopeer" type="checkbox" class="formcheckbox" id="nopeer"<?php if(!$pconfig['nopeer']) echo " checked=\"checked\""; ?> />
- <?php echo gettext("Deny packets that attempt a peer association (default: enabled)."); ?>
- <br />
- <input name="notrap" type="checkbox" class="formcheckbox" id="notrap"<?php if(!$pconfig['notrap']) echo " checked=\"checked\""; ?> />
- <?php echo gettext("Deny mode 6 control message trap service (default: enabled)."); ?>
- </div>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Leap seconds</td>
- <td width="78%" class="vtable">
- <div id="showleapsecbox">
- <input type="button" onclick="show_advanced('showleapsecbox', 'showleapsec')" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show Leap second configuration");?>
- </div>
- <div id="showleapsec" style="display:none">
- <?php echo gettext("A leap second file allows NTP to advertise an upcoming leap second addition or subtraction.");?>
- <?php echo gettext("Normally this is only useful if this server is a stratum 1 time server.");?>
- <br /><br />
- <?php echo gettext("Enter Leap second configuration as text:");?><br />
- <textarea name="leaptxt" class="formpre" id="leaptxt" cols="65" rows="7"><?php $text = base64_decode(chunk_split($pconfig['leapsec'])); echo $text;?></textarea><br />
- <strong><?php echo gettext("Or");?></strong>, <?php echo gettext("select a file to upload:");?>
- <input type="file" name="leapfile" class="formfld file" id="leapfile" />
- </div>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
- </td>
- </tr>
- </table>
-</div></td></tr></table>
+ <div id="addserver">
+ <img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?php echo gettext("Add another Time server");?>" onclick="NewTimeServer(<?php echo $j;?>)" alt="add" />
+ </div>
+ <br />
+ <?php echo gettext('For best results three to five servers should be configured here.'); ?>
+ <br />
+ <?php echo gettext('The <i>prefer</i> option indicates that NTP should favor the use of this server more than all others.'); ?>
+ <br />
+ <?php echo gettext('The <i>noselect</i> option indicates that NTP should not use this server for time, but stats for this server will be collected and displayed.'); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Orphan mode</td>
+ <td width="78%" class="vtable">
+ <input name="ntporphan" type="text" class="formfld unknown" id="ntporphan" min="1" max="16" size="20" value="<?=htmlspecialchars($pconfig['orphan']);?>" /><?php echo gettext("(0-15)");?><br />
+ <?php echo gettext("Orphan mode allows the system clock to be used when no other clocks are available. The number here specifies the stratum reported during orphan mode and should normally be set to a number high enough to insure that any other servers available to clients are preferred over this server. (default: 12)."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">NTP graphs</td>
+ <td width="78%" class="vtable">
+ <input name="statsgraph" type="checkbox" class="formcheckbox" id="statsgraph" <?php if ($pconfig['statsgraph']) echo " checked=\"checked\""; ?> />
+ <?php echo gettext("Enable RRD graphs of NTP statistics (default: disabled)."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Syslog logging</td>
+ <td width="78%" class="vtable">
+ <?php echo gettext("These options enable additional messages from NTP to be written to the System Log");?> (<a href="diag_logs_ntpd.php"><?php echo gettext("Status > System Logs > NTP"); ?></a>).
+ <br /><br />
+ <input name="logpeer" type="checkbox" class="formcheckbox" id="logpeer"<?php if ($pconfig['logpeer']) echo " checked=\"checked\""; ?> />
+ <?php echo gettext("Enable logging of peer messages (default: disabled)."); ?>
+ <br />
+ <input name="logsys" type="checkbox" class="formcheckbox" id="logsys"<?php if ($pconfig['logsys']) echo " checked=\"checked\""; ?> />
+ <?php echo gettext("Enable logging of system messages (default: disabled)."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Statistics logging</td>
+ <td width="78%" class="vtable">
+ <div id="showstatisticsbox">
+ <input type="button" onclick="show_advanced('showstatisticsbox', 'showstatistics')" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show statistics logging options");?>
+ </div>
+ <div id="showstatistics" style="display:none">
+ <strong><?php echo gettext("Warning: ")?></strong><?php echo gettext("these options will create persistent daily log files in /var/log/ntp."); ?>
+ <br /><br />
+ <input name="clockstats" type="checkbox" class="formcheckbox" id="clockstats"<?php if ($pconfig['clockstats']) echo " checked=\"checked\""; ?> />
+ <?php echo gettext("Enable logging of reference clock statistics (default: disabled)."); ?>
+ <br />
+ <input name="loopstats" type="checkbox" class="formcheckbox" id="loopstats"<?php if ($pconfig['loopstats']) echo " checked=\"checked\""; ?> />
+ <?php echo gettext("Enable logging of clock discipline statistics (default: disabled)."); ?>
+ <br />
+ <input name="peerstats" type="checkbox" class="formcheckbox" id="peerstats"<?php if ($pconfig['peerstats']) echo " checked=\"checked\""; ?> />
+ <?php echo gettext("Enable logging of NTP peer statistics (default: disabled)."); ?>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Access restrictions</td>
+ <td width="78%" class="vtable">
+ <div id="showrestrictbox">
+ <input type="button" onclick="show_advanced('showrestrictbox', 'showrestrict')" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show access restriction options");?>
+ </div>
+ <div id="showrestrict" style="display:none">
+ <?php echo gettext("these options control access to NTP from the WAN."); ?>
+ <br /><br />
+ <input name="kod" type="checkbox" class="formcheckbox" id="kod"<?php if (!$pconfig['kod']) echo " checked=\"checked\""; ?> />
+ <?php echo gettext("Enable Kiss-o'-death packets (default: enabled)."); ?>
+ <br />
+ <input name="nomodify" type="checkbox" class="formcheckbox" id="nomodify"<?php if (!$pconfig['nomodify']) echo " checked=\"checked\""; ?> />
+ <?php echo gettext("Deny state modifications (i.e. run time configuration) by ntpq and ntpdc (default: enabled)."); ?>
+ <br />
+ <input name="noquery" type="checkbox" class="formcheckbox" id="noquery"<?php if ($pconfig['noquery']) echo " checked=\"checked\""; ?> />
+ <?php echo gettext("Disable ntpq and ntpdc queries (default: disabled)."); ?>
+ <br />
+ <input name="noserve" type="checkbox" class="formcheckbox" id="noserve"<?php if ($pconfig['noserve']) echo " checked=\"checked\""; ?> />
+ <?php echo gettext("Disable all except ntpq and ntpdc queries (default: disabled)."); ?>
+ <br />
+ <input name="nopeer" type="checkbox" class="formcheckbox" id="nopeer"<?php if (!$pconfig['nopeer']) echo " checked=\"checked\""; ?> />
+ <?php echo gettext("Deny packets that attempt a peer association (default: enabled)."); ?>
+ <br />
+ <input name="notrap" type="checkbox" class="formcheckbox" id="notrap"<?php if (!$pconfig['notrap']) echo " checked=\"checked\""; ?> />
+ <?php echo gettext("Deny mode 6 control message trap service (default: enabled)."); ?>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Leap seconds</td>
+ <td width="78%" class="vtable">
+ <div id="showleapsecbox">
+ <input type="button" onclick="show_advanced('showleapsecbox', 'showleapsec')" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show Leap second configuration");?>
+ </div>
+ <div id="showleapsec" style="display:none">
+ <?php echo gettext("A leap second file allows NTP to advertise an upcoming leap second addition or subtraction.");?>
+ <?php echo gettext("Normally this is only useful if this server is a stratum 1 time server.");?>
+ <br /><br />
+ <?php echo gettext("Enter Leap second configuration as text:");?><br />
+ <textarea name="leaptxt" class="formpre" id="leaptxt" cols="65" rows="7"><?php $text = base64_decode(chunk_split($pconfig['leapsec'])); echo $text;?></textarea><br />
+ <strong><?php echo gettext("Or");?></strong>, <?php echo gettext("select a file to upload:");?>
+ <input type="file" name="leapfile" class="formfld file" id="leapfile" />
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+</table>
</form>
<?php include("fend.inc"); ?>
</body>
diff --git a/usr/local/www/services_ntpd_gps.php b/usr/local/www/services_ntpd_gps.php
index 7afe24c..c8098c1 100644
--- a/usr/local/www/services_ntpd_gps.php
+++ b/usr/local/www/services_ntpd_gps.php
@@ -45,10 +45,12 @@ require_once("guiconfig.inc");
function set_default_gps() {
global $config;
- if (!is_array($config['ntpd']))
+ if (!is_array($config['ntpd'])) {
$config['ntpd'] = array();
- if (is_array($config['ntpd']['gps']))
+ }
+ if (is_array($config['ntpd']['gps'])) {
unset($config['ntpd']['gps']);
+ }
$config['ntpd']['gps'] = array();
$config['ntpd']['gps']['type'] = 'Default';
@@ -67,85 +69,102 @@ if ($_POST) {
unset($input_errors);
- if (!empty($_POST['gpsport']) && file_exists('/dev/'.$_POST['gpsport']))
+ if (!empty($_POST['gpsport']) && file_exists('/dev/'.$_POST['gpsport'])) {
$config['ntpd']['gps']['port'] = $_POST['gpsport'];
- /* if port is not set, remove all the gps config */
- else unset($config['ntpd']['gps']);
+ } else {
+ /* if port is not set, remove all the gps config */
+ unset($config['ntpd']['gps']);
+ }
- if (!empty($_POST['gpstype']))
+ if (!empty($_POST['gpstype'])) {
$config['ntpd']['gps']['type'] = $_POST['gpstype'];
- elseif (isset($config['ntpd']['gps']['type']))
+ } elseif (isset($config['ntpd']['gps']['type'])) {
unset($config['ntpd']['gps']['type']);
+ }
- if (!empty($_POST['gpsspeed']))
+ if (!empty($_POST['gpsspeed'])) {
$config['ntpd']['gps']['speed'] = $_POST['gpsspeed'];
- elseif (isset($config['ntpd']['gps']['speed']))
+ } elseif (isset($config['ntpd']['gps']['speed'])) {
unset($config['ntpd']['gps']['speed']);
+ }
- if (!empty($_POST['gpsnmea']) && ($_POST['gpsnmea'][0] === "0"))
+ if (!empty($_POST['gpsnmea']) && ($_POST['gpsnmea'][0] === "0")) {
$config['ntpd']['gps']['nmea'] = "0";
- else
+ } else {
$config['ntpd']['gps']['nmea'] = strval(array_sum($_POST['gpsnmea']));
+ }
- if (!empty($_POST['gpsfudge1']))
+ if (!empty($_POST['gpsfudge1'])) {
$config['ntpd']['gps']['fudge1'] = $_POST['gpsfudge1'];
- elseif (isset($config['ntpd']['gps']['fudge1']))
+ } elseif (isset($config['ntpd']['gps']['fudge1'])) {
unset($config['ntpd']['gps']['fudge1']);
+ }
- if (!empty($_POST['gpsfudge2']))
+ if (!empty($_POST['gpsfudge2'])) {
$config['ntpd']['gps']['fudge2'] = $_POST['gpsfudge2'];
- elseif (isset($config['ntpd']['gps']['fudge2']))
+ } elseif (isset($config['ntpd']['gps']['fudge2'])) {
unset($config['ntpd']['gps']['fudge2']);
+ }
- if (!empty($_POST['gpsstratum']) && ($_POST['gpsstratum']) < 17 )
+ if (!empty($_POST['gpsstratum']) && ($_POST['gpsstratum']) < 17) {
$config['ntpd']['gps']['stratum'] = $_POST['gpsstratum'];
- elseif (isset($config['ntpd']['gps']['stratum']))
+ } elseif (isset($config['ntpd']['gps']['stratum'])) {
unset($config['ntpd']['gps']['stratum']);
+ }
- if (empty($_POST['gpsprefer']))
+ if (empty($_POST['gpsprefer'])) {
$config['ntpd']['gps']['prefer'] = 'on';
- elseif (isset($config['ntpd']['gps']['prefer']))
+ } elseif (isset($config['ntpd']['gps']['prefer'])) {
unset($config['ntpd']['gps']['prefer']);
+ }
- if (!empty($_POST['gpsselect']))
+ if (!empty($_POST['gpsselect'])) {
$config['ntpd']['gps']['noselect'] = $_POST['gpsselect'];
- elseif (isset($config['ntpd']['gps']['noselect']))
+ } elseif (isset($config['ntpd']['gps']['noselect'])) {
unset($config['ntpd']['gps']['noselect']);
+ }
- if (!empty($_POST['gpsflag1']))
+ if (!empty($_POST['gpsflag1'])) {
$config['ntpd']['gps']['flag1'] = $_POST['gpsflag1'];
- elseif (isset($config['ntpd']['gps']['flag1']))
+ } elseif (isset($config['ntpd']['gps']['flag1'])) {
unset($config['ntpd']['gps']['flag1']);
+ }
- if (!empty($_POST['gpsflag2']))
+ if (!empty($_POST['gpsflag2'])) {
$config['ntpd']['gps']['flag2'] = $_POST['gpsflag2'];
- elseif (isset($config['ntpd']['gps']['flag2']))
+ } elseif (isset($config['ntpd']['gps']['flag2'])) {
unset($config['ntpd']['gps']['flag2']);
+ }
- if (!empty($_POST['gpsflag3']))
+ if (!empty($_POST['gpsflag3'])) {
$config['ntpd']['gps']['flag3'] = $_POST['gpsflag3'];
- elseif (isset($config['ntpd']['gps']['flag3']))
+ } elseif (isset($config['ntpd']['gps']['flag3'])) {
unset($config['ntpd']['gps']['flag3']);
+ }
- if (!empty($_POST['gpsflag4']))
+ if (!empty($_POST['gpsflag4'])) {
$config['ntpd']['gps']['flag4'] = $_POST['gpsflag4'];
- elseif (isset($config['ntpd']['gps']['flag4']))
+ } elseif (isset($config['ntpd']['gps']['flag4'])) {
unset($config['ntpd']['gps']['flag4']);
+ }
- if (!empty($_POST['gpssubsec']))
+ if (!empty($_POST['gpssubsec'])) {
$config['ntpd']['gps']['subsec'] = $_POST['gpssubsec'];
- elseif (isset($config['ntpd']['gps']['subsec']))
+ } elseif (isset($config['ntpd']['gps']['subsec'])) {
unset($config['ntpd']['gps']['subsec']);
+ }
- if (!empty($_POST['gpsrefid']))
+ if (!empty($_POST['gpsrefid'])) {
$config['ntpd']['gps']['refid'] = $_POST['gpsrefid'];
- elseif (isset($config['ntpd']['gps']['refid']))
+ } elseif (isset($config['ntpd']['gps']['refid'])) {
unset($config['ntpd']['gps']['refid']);
+ }
- if (!empty($_POST['gpsinitcmd']))
+ if (!empty($_POST['gpsinitcmd'])) {
$config['ntpd']['gps']['initcmd'] = base64_encode($_POST['gpsinitcmd']);
- elseif (isset($config['ntpd']['gps']['initcmd']))
+ } elseif (isset($config['ntpd']['gps']['initcmd'])) {
unset($config['ntpd']['gps']['initcmd']);
+ }
write_config("Updated NTP GPS Settings");
@@ -159,7 +178,7 @@ if ($_POST) {
}
$closehead = false;
$pconfig = &$config['ntpd']['gps'];
-$pgtitle = array(gettext("Services"),gettext("NTP GPS"));
+$pgtitle = array(gettext("Services"), gettext("NTP GPS"));
$shortcut_section = "ntp";
include("head.inc");
?>
@@ -261,7 +280,7 @@ SureGPS = #Sure Electronics SKG16B
var type = e.options[e.selectedIndex].text;
//stuff the JS object as needed for each type
- switch(type) {
+ switch (type) {
case "Default":
gpsdef['nmea'] = 0;
gpsdef['speed'] = 0;
@@ -341,7 +360,7 @@ SureGPS = #Sure Electronics SKG16B
function NMEAChecksum(cmd) {
// Compute the checksum by XORing all the character values in the string.
var checksum = 0;
- for(var i = 0; i < cmd.length; i++) {
+ for (var i = 0; i < cmd.length; i++) {
checksum = checksum ^ cmd.charCodeAt(i);
}
// Convert it to hexadecimal (base-16, upper case, most significant byte first).
@@ -362,7 +381,8 @@ SureGPS = #Sure Electronics SKG16B
<?php if ($savemsg) print_info_box($savemsg); ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="ntpd gps">
- <tr><td>
+ <tr>
+ <td>
<?php
$tab_array = array();
$tab_array[] = array(gettext("NTP"), false, "services_ntpd.php");
@@ -370,215 +390,223 @@ SureGPS = #Sure Electronics SKG16B
$tab_array[] = array(gettext("PPS"), false, "services_ntpd_pps.php");
display_top_tabs($tab_array);
?>
- </td></tr>
- <tr><td>
- <div id="mainarea">
- <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
- <tr>
- <td colspan="2" valign="top" class="listtopic"><?=gettext("NTP Serial GPS Configuration"); ?></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">
- </td>
- <td width="78%" class="vtable">A GPS connected via a serial port may be used as a reference clock for NTP. If the GPS also supports PPS and is properly configured, and connected, that GPS may also be used as a Pulse Per Second clock reference. NOTE: a USB GPS may work, but is not recommended due to USB bus timing issues.
- <br />
- <br /><?php echo gettext("For the best results, NTP should have at least three sources of time. So it is best to configure at least 2 servers under"); ?> <a href="services_ntpd.php"><?php echo gettext("Services > NTP"); ?></a> <?php echo gettext("to minimize clock drift if the GPS data is not valid over time. Otherwise ntpd may only use values from the unsynchronized local clock when providing time to clients."); ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq"><?=gettext("GPS"); ?></td>
- <td width="78%" valign="top" class="vtable">
- <!-- Start with the original "Default", list a "Generic" and then specific configs alphabetically -->
- <select id="gpstype" name="gpstype" class="formselect" onchange="set_gps_default(this.form)">
- <option value="Custom"<?php if($pconfig['type'] == 'Custom') echo " selected=\"selected\""; ?>>Custom</option>
- <option value="Default"<?php if($pconfig['type'] == 'Default') echo " selected=\"selected\""; ?>>Default</option>
- <option value="Generic" title="Generic"<?php if($pconfig['type'] == 'Generic') echo " selected=\"selected\"";?>>Generic</option>
- <option value="Garmin" title="$PGRM... Most Garmin"<?php if($pconfig['type'] == 'Garmin') echo " selected=\"selected\"";?>>Garmin</option>
- <option value="MediaTek" title="$PMTK... Adafruit, Fastrax, some Garmin and others"<?php if($pconfig['type'] == 'MediaTek') echo " selected=\"selected\"";?>>MediaTek</option>
- <option value="SiRF" title="$PSRF... Used by many devices"<?php if($pconfig['type'] == 'sirf') echo " selected=\"selected\"";?>>SiRF</option>
- <option value="U-Blox" title="$PUBX... U-Blox 5, 6 and probably 7"<?php if($pconfig['type'] == 'U-Blox') echo " selected=\"selected\"";?>>U-Blox</option>
- <option value="SureGPS" title="$PMTK... Sure Electronics SKG16B"<?php if($pconfig['type'] == 'SureGPS') echo " selected=\"selected\"";?>>SureGPS</option>
- </select> <?php echo gettext("This option allows you to select a predefined configuration.");?>
- <br />
- <br />
- <strong><?php echo gettext("Note: ");?></strong><?php echo gettext("Default is the configuration of pfSense 2.1 and earlier"); ?>
- <?php echo gettext(" (not recommended). Select Generic if your GPS is not listed.)"); ?><br />
- <strong><?php echo gettext("Note: ");?></strong><?php echo gettext("The perdefined configurations assume your GPS has already been set to NMEA mode."); ?>
- </td>
- </tr>
-
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
+ <tr>
+ <td colspan="2" valign="top" class="listtopic"><?=gettext("NTP Serial GPS Configuration"); ?></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">
+ </td>
+ <td width="78%" class="vtable">A GPS connected via a serial port may be used as a reference clock for NTP. If the GPS also supports PPS and is properly configured, and connected, that GPS may also be used as a Pulse Per Second clock reference. NOTE: a USB GPS may work, but is not recommended due to USB bus timing issues.
+ <br />
+ <br /><?php echo gettext("For the best results, NTP should have at least three sources of time. So it is best to configure at least 2 servers under"); ?> <a href="services_ntpd.php"><?php echo gettext("Services > NTP"); ?></a> <?php echo gettext("to minimize clock drift if the GPS data is not valid over time. Otherwise ntpd may only use values from the unsynchronized local clock when providing time to clients."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("GPS"); ?></td>
+ <td width="78%" valign="top" class="vtable">
+ <!-- Start with the original "Default", list a "Generic" and then specific configs alphabetically -->
+ <select id="gpstype" name="gpstype" class="formselect" onchange="set_gps_default(this.form)">
+ <option value="Custom"<?php if ($pconfig['type'] == 'Custom') echo " selected=\"selected\""; ?>>Custom</option>
+ <option value="Default"<?php if ($pconfig['type'] == 'Default') echo " selected=\"selected\""; ?>>Default</option>
+ <option value="Generic" title="Generic"<?php if ($pconfig['type'] == 'Generic') echo " selected=\"selected\"";?>>Generic</option>
+ <option value="Garmin" title="$PGRM... Most Garmin"<?php if ($pconfig['type'] == 'Garmin') echo " selected=\"selected\"";?>>Garmin</option>
+ <option value="MediaTek" title="$PMTK... Adafruit, Fastrax, some Garmin and others"<?php if ($pconfig['type'] == 'MediaTek') echo " selected=\"selected\"";?>>MediaTek</option>
+ <option value="SiRF" title="$PSRF... Used by many devices"<?php if ($pconfig['type'] == 'sirf') echo " selected=\"selected\"";?>>SiRF</option>
+ <option value="U-Blox" title="$PUBX... U-Blox 5, 6 and probably 7"<?php if ($pconfig['type'] == 'U-Blox') echo " selected=\"selected\"";?>>U-Blox</option>
+ <option value="SureGPS" title="$PMTK... Sure Electronics SKG16B"<?php if ($pconfig['type'] == 'SureGPS') echo " selected=\"selected\"";?>>SureGPS</option>
+ </select>
+ <?php echo gettext("This option allows you to select a predefined configuration.");?>
+ <br />
+ <br />
+ <strong><?php echo gettext("Note: ");?></strong><?php echo gettext("Default is the configuration of pfSense 2.1 and earlier"); ?>
+ <?php echo gettext(" (not recommended). Select Generic if your GPS is not listed.)"); ?><br />
+ <strong><?php echo gettext("Note: ");?></strong><?php echo gettext("The perdefined configurations assume your GPS has already been set to NMEA mode."); ?>
+ </td>
+ </tr>
<?php
/* Probing would be nice, but much more complex. Would need to listen to each port for 1s+ and watch for strings. */
$serialports = glob("/dev/cua?[0-9]{,.[0-9]}", GLOB_BRACE);
if (!empty($serialports)):
?>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Serial port</td>
- <td width="78%" class="vtable">
- <select name="gpsport" class="formselect">
- <option value="">none</option>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Serial port</td>
+ <td width="78%" class="vtable">
+ <select name="gpsport" class="formselect">
+ <option value="">none</option>
<?php
- foreach ($serialports as $port):
- $shortport = substr($port,5);
- $selected = ($shortport == $pconfig['port']) ? " selected=\"selected\"" : "";
+ foreach ($serialports as $port):
+ $shortport = substr($port, 5);
+ $selected = ($shortport == $pconfig['port']) ? " selected=\"selected\"" : "";
?>
- <option value="<?php echo $shortport;?>"<?php echo $selected;?>><?php echo $shortport;?></option>
+ <option value="<?php echo $shortport;?>"<?php echo $selected;?>><?php echo $shortport;?></option>
<?php
- endforeach;
+ endforeach;
?>
- </select>&nbsp;
- <?php echo gettext("All serial ports are listed, be sure to pick the port with the GPS attached."); ?>
- <br /><br />
- <select id="gpsspeed" name="gpsspeed" class="formselect">
- <option value="0"<?php if(!$pconfig['speed']) echo " selected=\"selected\""; ?>>4800</option>
- <option value="16"<?php if($pconfig['speed'] === '16') echo " selected=\"selected\"";?>>9600</option>
- <option value="32"<?php if($pconfig['speed'] === '32') echo " selected=\"selected\"";?>>19200</option>
- <option value="48"<?php if($pconfig['speed'] === '48') echo " selected=\"selected\"";?>>38400</option>
- <option value="64"<?php if($pconfig['speed'] === '64') echo " selected=\"selected\"";?>>57600</option>
- <option value="80"<?php if($pconfig['speed'] === '80') echo " selected=\"selected\"";?>>115200</option>
- </select>&nbsp;<?php echo gettext("Serial port baud rate."); ?>
- <br />
- <br />
- <?php echo gettext("Note: A higher baud rate is generally only helpful if the GPS is sending too many sentences. It is recommended to configure the GPS to send only one sentence at a baud rate of 4800 or 9600."); ?>
- </td>
- </tr>
+ </select>&nbsp;
+ <?php echo gettext("All serial ports are listed, be sure to pick the port with the GPS attached."); ?>
+ <br /><br />
+ <select id="gpsspeed" name="gpsspeed" class="formselect">
+ <option value="0"<?php if (!$pconfig['speed']) echo " selected=\"selected\""; ?>>4800</option>
+ <option value="16"<?php if ($pconfig['speed'] === '16') echo " selected=\"selected\"";?>>9600</option>
+ <option value="32"<?php if ($pconfig['speed'] === '32') echo " selected=\"selected\"";?>>19200</option>
+ <option value="48"<?php if ($pconfig['speed'] === '48') echo " selected=\"selected\"";?>>38400</option>
+ <option value="64"<?php if ($pconfig['speed'] === '64') echo " selected=\"selected\"";?>>57600</option>
+ <option value="80"<?php if ($pconfig['speed'] === '80') echo " selected=\"selected\"";?>>115200</option>
+ </select>&nbsp;<?php echo gettext("Serial port baud rate."); ?>
+ <br />
+ <br />
+ <?php echo gettext("Note: A higher baud rate is generally only helpful if the GPS is sending too many sentences. It is recommended to configure the GPS to send only one sentence at a baud rate of 4800 or 9600."); ?>
+ </td>
+ </tr>
<?php
endif;
?>
- <tr>
- <!-- 1 = RMC, 2 = GGA, 4 = GLL, 8 = ZDA or ZDG -->
- <td width="22%" valign="top" class="vncellreq">NMEA sentences</td>
- <td width="78%" class="vtable">
- <select id="gpsnmea" name="gpsnmea[]" multiple="multiple" class="formselect" size="5">
- <option value="0"<?php if(!$pconfig['nmea']) echo " selected=\"selected\""; ?>>All</option>
- <option value="1"<?php if($pconfig['nmea'] & 1) echo " selected=\"selected\"";?>>RMC</option>
- <option value="2"<?php if($pconfig['nmea'] & 2) echo " selected=\"selected\"";?>>GGA</option>
- <option value="4"<?php if($pconfig['nmea'] & 4) echo " selected=\"selected\"";?>>GLL</option>
- <option value="8"<?php if($pconfig['nmea'] & 8) echo " selected=\"selected\"";?>>ZDA or ZDG</option>
- </select><br />
- <?php echo gettext("By default NTP will listen for all supported NMEA sentences. Here one or more sentences to listen for may be specified."); ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Fudge time 1</td>
- <td width="78%" class="vtable">
- <input name="gpsfudge1" type="text" class="formfld unknown" id="gpsfudge1" min="-1" max="1" size="20" value="<?=htmlspecialchars($pconfig['fudge1']);?>" />(<?php echo gettext("seconds");?>)<br />
- <?php echo gettext("Fudge time 1 is used to specify the GPS PPS signal offset");?> (<?php echo gettext("default");?>: 0.0).</td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Fudge time 2</td>
- <td width="78%" class="vtable">
- <input name="gpsfudge2" type="text" class="formfld unknown" id="gpsfudge2" min="-1" max="1" size="20" value="<?=htmlspecialchars($pconfig['fudge2']);?>" />(<?php echo gettext("seconds");?>)<br />
- <?php echo gettext("Fudge time 2 is used to specify the GPS time offset");?> (<?php echo gettext("default");?>: 0.0).</td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Stratum</td>
- <td width="78%" class="vtable">
- <input name="gpsstratum" type="text" class="formfld unknown" id="gpsstratum" max="16" size="20" value="<?=htmlspecialchars($pconfig['stratum']);?>" /><?php echo gettext("(0-16)");?><br />
- <?php echo gettext("This may be used to change the GPS Clock stratum");?> (<?php echo gettext("default");?>: 0). <?php echo gettext("This may be useful if, for some reason, you want ntpd to prefer a different clock"); ?></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Flags</td>
- <td width="78%" class="vtable">
- <table>
- <tr>
- <td>
- <?php echo gettext("Normally there should be no need to change these options from the defaults."); ?><br />
- </td>
- </tr>
- </table>
- <table>
- <tr>
- <td>
- <input name="gpsprefer" type="checkbox" class="formcheckbox" id="gpsprefer" onclick="ToggleOther('gpsprefer', 'gpsselect')"<?php if(!$pconfig['prefer']) echo " checked=\"checked\""; ?> />
- </td>
- <td>
- <span class="vexpl"><?php echo gettext("NTP should prefer this clock (default: enabled)."); ?></span>
- </td>
- </tr>
- <tr>
- <td>
- <input name="gpsselect" type="checkbox" class="formcheckbox" id="gpsselect" onclick="ToggleOther('gpsselect', 'gpsprefer')"<?php if($pconfig['noselect']) echo " checked=\"checked\""; ?> />
- </td>
- <td>
- <span class="vexpl"><?php echo gettext("NTP should not use this clock, it will be displayed for reference only(default: disabled)."); ?></span>
- </td>
- </tr>
- <tr>
- <td>
- <input name="gpsflag1" type="checkbox" class="formcheckbox" id="gpsflag1"<?php if($pconfig['flag1']) echo " checked=\"checked\""; ?> />
- </td>
- <td>
- <span class="vexpl"><?php echo gettext("Enable PPS signal processing (default: enabled)."); ?></span>
- </td>
- </tr>
- <tr>
- <td>
- <input name="gpsflag2" type="checkbox" class="formcheckbox" id="gpsflag2"<?php if($pconfig['flag2']) echo " checked=\"checked\""; ?> />
- </td>
- <td>
- <span class="vexpl"><?php echo gettext("Enable falling edge PPS signal processing (default: rising edge)."); ?></span>
- </td>
- </tr>
- <tr>
- <td>
- <input name="gpsflag3" type="checkbox" class="formcheckbox" id="gpsflag3"<?php if($pconfig['flag3']) echo " checked=\"checked\""; ?> />
- </td>
- <td>
- <span class="vexpl"><?php echo gettext("Enable kernel PPS clock discipline (default: enabled)."); ?></span>
- </td>
- </tr>
- <tr>
- <td>
- <input name="gpsflag4" type="checkbox" class="formcheckbox" id="gpsflag4"<?php if($pconfig['flag4']) echo " checked=\"checked\""; ?> />
- </td>
- <td>
- <span class="vexpl"><?php echo gettext("Obscure location in timestamp (default: unobscured)."); ?></span>
- </td>
- </tr>
- <tr>
- <td>
- <input name="gpssubsec" type="checkbox" class="formcheckbox" id="gpssubsec"<?php if($pconfig['subsec']) echo " checked=\"checked\""; ?> />
- </td>
- <td>
- <span class="vexpl"><?php echo gettext("Log the sub-second fraction of the received time stamp (default: Not logged).<br />Note: enabling this will rapidly fill the log, but is useful for tuning Fudge time 2."); ?></span>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Clock ID</td>
- <td width="78%" class="vtable">
- <input name="gpsrefid" type="text" class="formfld unknown" id="gpsrefid" maxlength= "4" size="20" value="<?=htmlspecialchars($pconfig['refid']);?>" /><?php echo gettext("(1 to 4 charactors)");?><br />
- <?php echo gettext("This may be used to change the GPS Clock ID");?> (<?php echo gettext("default");?>: GPS).</td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">GPS Initialization</td>
- <td width="78%" class="vtable">
- <div id="showgpsinitbox">
- <input type="button" onclick="show_advanced('showgpsinitbox', 'showgpsinit')" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show GPS Initialization commands");?>
- </div>
- <div id="showgpsinit" style="display:none">
- <p>
- <textarea name="gpsinitcmd" class="formpre" id="gpsinitcmd" cols="65" rows="7"><?=htmlspecialchars(base64_decode($pconfig['initcmd'])); /*resultmatch*/?></textarea><br />
- <?php echo gettext("Note: Commands entered here will be sent to the GPS during initialization. Please read and understand your GPS documentation before making any changes here.");?><br /><br />
- <strong><?php echo gettext("NMEA checksum calculator");?>:</strong>
- <br />
- <?php echo gettext("Enter the text between &quot;$&quot; and &quot;*&quot; of a NMEA command string:");?><br /> $<input name="nmeastring" type="text" class="formfld unknown" id="nmeastring" size="30" value="" />*<span id="nmeachecksum"><?php echo gettext("checksum");?></span>&nbsp;&nbsp;
- <input type="button" onclick="NMEAChecksum(nmeastring.value)" value="<?=gettext("Calculate NMEA checksum");?>" /><br /></p>
- </div>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
- </td>
- </tr>
- </table>
- </div>
- </td></tr>
+ <tr>
+ <!-- 1 = RMC, 2 = GGA, 4 = GLL, 8 = ZDA or ZDG -->
+ <td width="22%" valign="top" class="vncellreq">NMEA sentences</td>
+ <td width="78%" class="vtable">
+ <select id="gpsnmea" name="gpsnmea[]" multiple="multiple" class="formselect" size="5">
+ <option value="0"<?php if (!$pconfig['nmea']) echo " selected=\"selected\""; ?>>All</option>
+ <option value="1"<?php if ($pconfig['nmea'] & 1) echo " selected=\"selected\"";?>>RMC</option>
+ <option value="2"<?php if ($pconfig['nmea'] & 2) echo " selected=\"selected\"";?>>GGA</option>
+ <option value="4"<?php if ($pconfig['nmea'] & 4) echo " selected=\"selected\"";?>>GLL</option>
+ <option value="8"<?php if ($pconfig['nmea'] & 8) echo " selected=\"selected\"";?>>ZDA or ZDG</option>
+ </select><br />
+ <?php echo gettext("By default NTP will listen for all supported NMEA sentences. Here one or more sentences to listen for may be specified."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Fudge time 1</td>
+ <td width="78%" class="vtable">
+ <input name="gpsfudge1" type="text" class="formfld unknown" id="gpsfudge1" min="-1" max="1" size="20" value="<?=htmlspecialchars($pconfig['fudge1']);?>" />(<?php echo gettext("seconds");?>)<br />
+ <?php echo gettext("Fudge time 1 is used to specify the GPS PPS signal offset");?> (<?php echo gettext("default");?>: 0.0).
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Fudge time 2</td>
+ <td width="78%" class="vtable">
+ <input name="gpsfudge2" type="text" class="formfld unknown" id="gpsfudge2" min="-1" max="1" size="20" value="<?=htmlspecialchars($pconfig['fudge2']);?>" />(<?php echo gettext("seconds");?>)<br />
+ <?php echo gettext("Fudge time 2 is used to specify the GPS time offset");?> (<?php echo gettext("default");?>: 0.0).
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Stratum</td>
+ <td width="78%" class="vtable">
+ <input name="gpsstratum" type="text" class="formfld unknown" id="gpsstratum" max="16" size="20" value="<?=htmlspecialchars($pconfig['stratum']);?>" /><?php echo gettext("(0-16)");?><br />
+ <?php echo gettext("This may be used to change the GPS Clock stratum");?> (<?php echo gettext("default");?>: 0). <?php echo gettext("This may be useful if, for some reason, you want ntpd to prefer a different clock"); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Flags</td>
+ <td width="78%" class="vtable">
+ <table>
+ <tr>
+ <td>
+ <?php echo gettext("Normally there should be no need to change these options from the defaults."); ?><br />
+ </td>
+ </tr>
+ </table>
+ <table>
+ <tr>
+ <td>
+ <input name="gpsprefer" type="checkbox" class="formcheckbox" id="gpsprefer" onclick="ToggleOther('gpsprefer', 'gpsselect')"<?php if (!$pconfig['prefer']) echo " checked=\"checked\""; ?> />
+ </td>
+ <td>
+ <span class="vexpl"><?php echo gettext("NTP should prefer this clock (default: enabled)."); ?></span>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input name="gpsselect" type="checkbox" class="formcheckbox" id="gpsselect" onclick="ToggleOther('gpsselect', 'gpsprefer')"<?php if ($pconfig['noselect']) echo " checked=\"checked\""; ?> />
+ </td>
+ <td>
+ <span class="vexpl"><?php echo gettext("NTP should not use this clock, it will be displayed for reference only(default: disabled)."); ?></span>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input name="gpsflag1" type="checkbox" class="formcheckbox" id="gpsflag1"<?php if ($pconfig['flag1']) echo " checked=\"checked\""; ?> />
+ </td>
+ <td>
+ <span class="vexpl"><?php echo gettext("Enable PPS signal processing (default: enabled)."); ?></span>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input name="gpsflag2" type="checkbox" class="formcheckbox" id="gpsflag2"<?php if ($pconfig['flag2']) echo " checked=\"checked\""; ?> />
+ </td>
+ <td>
+ <span class="vexpl"><?php echo gettext("Enable falling edge PPS signal processing (default: rising edge)."); ?></span>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input name="gpsflag3" type="checkbox" class="formcheckbox" id="gpsflag3"<?php if ($pconfig['flag3']) echo " checked=\"checked\""; ?> />
+ </td>
+ <td>
+ <span class="vexpl"><?php echo gettext("Enable kernel PPS clock discipline (default: enabled)."); ?></span>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input name="gpsflag4" type="checkbox" class="formcheckbox" id="gpsflag4"<?php if ($pconfig['flag4']) echo " checked=\"checked\""; ?> />
+ </td>
+ <td>
+ <span class="vexpl"><?php echo gettext("Obscure location in timestamp (default: unobscured)."); ?></span>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input name="gpssubsec" type="checkbox" class="formcheckbox" id="gpssubsec"<?php if ($pconfig['subsec']) echo " checked=\"checked\""; ?> />
+ </td>
+ <td>
+ <span class="vexpl"><?php echo gettext("Log the sub-second fraction of the received time stamp (default: Not logged).<br />Note: enabling this will rapidly fill the log, but is useful for tuning Fudge time 2."); ?></span>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Clock ID</td>
+ <td width="78%" class="vtable">
+ <input name="gpsrefid" type="text" class="formfld unknown" id="gpsrefid" maxlength= "4" size="20" value="<?=htmlspecialchars($pconfig['refid']);?>" /><?php echo gettext("(1 to 4 charactors)");?><br />
+ <?php echo gettext("This may be used to change the GPS Clock ID");?> (<?php echo gettext("default");?>: GPS).
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">GPS Initialization</td>
+ <td width="78%" class="vtable">
+ <div id="showgpsinitbox">
+ <input type="button" onclick="show_advanced('showgpsinitbox', 'showgpsinit')" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show GPS Initialization commands");?>
+ </div>
+ <div id="showgpsinit" style="display:none">
+ <p>
+ <textarea name="gpsinitcmd" class="formpre" id="gpsinitcmd" cols="65" rows="7"><?=htmlspecialchars(base64_decode($pconfig['initcmd'])); /*resultmatch*/?></textarea><br />
+ <?php echo gettext("Note: Commands entered here will be sent to the GPS during initialization. Please read and understand your GPS documentation before making any changes here.");?><br /><br />
+ <strong><?php echo gettext("NMEA checksum calculator");?>:</strong>
+ <br />
+ <?php echo gettext("Enter the text between &quot;$&quot; and &quot;*&quot; of a NMEA command string:");?><br /> $<input name="nmeastring" type="text" class="formfld unknown" id="nmeastring" size="30" value="" />*<span id="nmeachecksum"><?php echo gettext("checksum");?></span>&nbsp;&nbsp;
+ <input type="button" onclick="NMEAChecksum(nmeastring.value)" value="<?=gettext("Calculate NMEA checksum");?>" /><br />
+ </p>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
</table>
<script type="text/javascript">
//<![CDATA[
diff --git a/usr/local/www/services_ntpd_pps.php b/usr/local/www/services_ntpd_pps.php
index c92983f..e4abce0 100644
--- a/usr/local/www/services_ntpd_pps.php
+++ b/usr/local/www/services_ntpd_pps.php
@@ -41,56 +41,67 @@
require_once("guiconfig.inc");
-if (!is_array($config['ntpd']))
+if (!is_array($config['ntpd'])) {
$config['ntpd'] = array();
-if (!is_array($config['ntpd']['pps']))
+}
+if (!is_array($config['ntpd']['pps'])) {
$config['ntpd']['pps'] = array();
+}
if ($_POST) {
unset($input_errors);
if (!$input_errors) {
- if (!empty($_POST['ppsport']) && file_exists('/dev/'.$_POST['ppsport']))
+ if (!empty($_POST['ppsport']) && file_exists('/dev/'.$_POST['ppsport'])) {
$config['ntpd']['pps']['port'] = $_POST['ppsport'];
- /* if port is not set, remove all the pps config */
- else unset($config['ntpd']['pps']);
+ } else {
+ /* if port is not set, remove all the pps config */
+ unset($config['ntpd']['pps']);
+ }
- if (!empty($_POST['ppsfudge1']))
+ if (!empty($_POST['ppsfudge1'])) {
$config['ntpd']['pps']['fudge1'] = $_POST['ppsfudge1'];
- elseif (isset($config['ntpd']['pps']['fudge1']))
+ } elseif (isset($config['ntpd']['pps']['fudge1'])) {
unset($config['ntpd']['pps']['fudge1']);
+ }
- if (!empty($_POST['ppsstratum']) && ($_POST['ppsstratum']) < 17 )
+ if (!empty($_POST['ppsstratum']) && ($_POST['ppsstratum']) < 17) {
$config['ntpd']['pps']['stratum'] = $_POST['ppsstratum'];
- elseif (isset($config['ntpd']['pps']['stratum']))
+ } elseif (isset($config['ntpd']['pps']['stratum'])) {
unset($config['ntpd']['pps']['stratum']);
+ }
- if (!empty($_POST['ppsselect']))
+ if (!empty($_POST['ppsselect'])) {
$config['ntpd']['pps']['noselect'] = $_POST['ppsselect'];
- elseif (isset($config['ntpd']['pps']['noselect']))
+ } elseif (isset($config['ntpd']['pps']['noselect'])) {
unset($config['ntpd']['pps']['noselect']);
+ }
- if (!empty($_POST['ppsflag2']))
+ if (!empty($_POST['ppsflag2'])) {
$config['ntpd']['pps']['flag2'] = $_POST['ppsflag2'];
- elseif (isset($config['ntpd']['pps']['flag2']))
+ } elseif (isset($config['ntpd']['pps']['flag2'])) {
unset($config['ntpd']['pps']['flag2']);
+ }
- if (!empty($_POST['ppsflag3']))
+ if (!empty($_POST['ppsflag3'])) {
$config['ntpd']['pps']['flag3'] = $_POST['ppsflag3'];
- elseif (isset($config['ntpd']['pps']['flag3']))
+ } elseif (isset($config['ntpd']['pps']['flag3'])) {
unset($config['ntpd']['pps']['flag3']);
+ }
- if (!empty($_POST['ppsflag4']))
+ if (!empty($_POST['ppsflag4'])) {
$config['ntpd']['pps']['flag4'] = $_POST['ppsflag4'];
- elseif (isset($config['ntpd']['pps']['flag4']))
+ } elseif (isset($config['ntpd']['pps']['flag4'])) {
unset($config['ntpd']['pps']['flag4']);
+ }
- if (!empty($_POST['ppsrefid']))
+ if (!empty($_POST['ppsrefid'])) {
$config['ntpd']['pps']['refid'] = $_POST['ppsrefid'];
- elseif (isset($config['ntpd']['pps']['refid']))
+ } elseif (isset($config['ntpd']['pps']['refid'])) {
unset($config['ntpd']['pps']['refid']);
-
+ }
+
write_config("Updated NTP PPS Settings");
$retval = 0;
@@ -100,7 +111,7 @@ if ($_POST) {
}
$pconfig = &$config['ntpd']['pps'];
-$pgtitle = array(gettext("Services"),gettext("NTP PPS"));
+$pgtitle = array(gettext("Services"), gettext("NTP PPS"));
$shortcut_section = "ntp";
include("head.inc");
?>
@@ -112,8 +123,8 @@ include("head.inc");
<?php if ($savemsg) print_info_box($savemsg); ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="ntpd pps">
- <tr>
- <td>
+ <tr>
+ <td>
<?php
$tab_array = array();
$tab_array[] = array(gettext("NTP"), false, "services_ntpd.php");
@@ -121,108 +132,118 @@ include("head.inc");
$tab_array[] = array(gettext("PPS"), true, "services_ntpd_pps.php");
display_top_tabs($tab_array);
?>
- </td>
- </tr>
- <tr>
- <td>
- <div id="mainarea">
- <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
- <tr>
- <td colspan="2" valign="top" class="listtopic"><?=gettext("NTP PPS Configuration"); ?></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">
- </td>
- <td width="78%" class="vtable"><?php echo gettext("Devices with a Pulse Per Second output such as radios that receive a time signal from DCF77 (DE), JJY (JP), MSF (GB) or WWVB (US) may be used as a PPS reference for NTP.");?>
- <?php echo gettext("A serial GPS may also be used, but the serial GPS driver would usually be the better option.");?>
- <?php echo gettext("A PPS signal only provides a reference to the change of a second, so at least one other source to number the seconds is required.");?>
- <br />
- <br /><strong><?php echo gettext("Note");?>:</strong> <?php echo gettext("At least 3 additional time sources should be configured under"); ?> <a href="services_ntpd.php"><?php echo gettext("Services > NTP"); ?></a> <?php echo gettext("to reliably supply the time of each PPS pulse."); ?>
- </td>
- </tr>
-<?php $serialports = glob("/dev/cua?[0-9]{,.[0-9]}", GLOB_BRACE); ?>
-<?php if (!empty($serialports)): ?>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Serial port</td>
- <td width="78%" class="vtable">
- <select name="ppsport" class="formselect">
- <option value="">none</option>
- <?php foreach ($serialports as $port):
- $shortport = substr($port,5);
- $selected = ($shortport == $pconfig['port']) ? " selected=\"selected\"" : "";?>
- <option value="<?php echo $shortport;?>"<?php echo $selected;?>><?php echo $shortport;?></option>
- <?php endforeach; ?>
- </select>&nbsp;
- <?php echo gettext("All serial ports are listed, be sure to pick the port with the PPS source attached."); ?>
- </td>
- </tr>
-<?php endif; ?>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Fudge time</td>
- <td width="78%" class="vtable">
- <input name="ppsfudge1" type="text" class="formfld unknown" id="ppsfudge1" min="-1" max="1" size="20" value="<?=htmlspecialchars($pconfig['fudge1']);?>" />(<?php echo gettext("seconds");?>)<br />
- <?php echo gettext("Fudge time is used to specify the PPS signal offset from the actual second such as the transmission delay between the transmitter and the receiver.");?> (<?php echo gettext("default");?>: 0.0).</td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Stratum</td>
- <td width="78%" class="vtable">
- <input name="ppsstratum" type="text" class="formfld unknown" id="ppsstratum" max="16" size="20" value="<?=htmlspecialchars($pconfig['stratum']);?>" /><?php echo gettext("(0-16)");?><br />
- <?php echo gettext("This may be used to change the PPS Clock stratum");?> (<?php echo gettext("default");?>: 0). <?php echo gettext("This may be useful if, for some reason, you want ntpd to prefer a different clock and just monitor this source."); ?></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Flags</td>
- <td width="78%" class="vtable">
- <table summary="flags">
- <tr>
- <td>
- <?php echo gettext("Normally there should be no need to change these options from the defaults."); ?><br />
- </td>
- </tr>
- </table>
- <table>
- <tr>
- <td>
- <input name="ppsflag2" type="checkbox" class="formcheckbox" id="ppsflag2"<?php if($pconfig['flag2']) echo " checked=\"checked\""; ?> />
- </td>
- <td>
- <span class="vexpl"><?php echo gettext("Enable falling edge PPS signal processing (default: rising edge)."); ?></span>
- </td>
- </tr>
- <tr>
- <td>
- <input name="ppsflag3" type="checkbox" class="formcheckbox" id="ppsflag3"<?php if($pconfig['flag3']) echo " checked=\"checked\""; ?> />
- </td>
- <td>
- <span class="vexpl"><?php echo gettext("Enable kernel PPS clock discipline (default: disabled)."); ?></span>
- </td>
- </tr>
- <tr>
- <td>
- <input name="ppsflag4" type="checkbox" class="formcheckbox" id="ppsflag4"<?php if($pconfig['flag4']) echo " checked=\"checked\""; ?> />
- </td>
- <td>
- <span class="vexpl"><?php echo gettext("Record a timestamp once for each second, useful for constructing Allan deviation plots (default: disabled)."); ?></span>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Clock ID</td>
- <td width="78%" class="vtable">
- <input name="ppsrefid" type="text" class="formfld unknown" id="ppsrefid" maxlength= "4" size="20" value="<?php htmlspecialchars($pconfig['refid']);?>" /><?php echo gettext("(1 to 4 charactors)");?><br />
- <?php echo gettext("This may be used to change the PPS Clock ID");?> (<?php echo gettext("default");?>: PPS).</td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
- </td>
- </tr>
- </table>
-</div>
-</td>
-</tr>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
+ <tr>
+ <td colspan="2" valign="top" class="listtopic"><?=gettext("NTP PPS Configuration"); ?></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">
+ </td>
+ <td width="78%" class="vtable"><?php echo gettext("Devices with a Pulse Per Second output such as radios that receive a time signal from DCF77 (DE), JJY (JP), MSF (GB) or WWVB (US) may be used as a PPS reference for NTP.");?>
+ <?php echo gettext("A serial GPS may also be used, but the serial GPS driver would usually be the better option.");?>
+ <?php echo gettext("A PPS signal only provides a reference to the change of a second, so at least one other source to number the seconds is required.");?>
+ <br />
+ <br /><strong><?php echo gettext("Note");?>:</strong> <?php echo gettext("At least 3 additional time sources should be configured under"); ?> <a href="services_ntpd.php"><?php echo gettext("Services > NTP"); ?></a> <?php echo gettext("to reliably supply the time of each PPS pulse."); ?>
+ </td>
+ </tr>
+<?php
+ $serialports = glob("/dev/cua?[0-9]{,.[0-9]}", GLOB_BRACE);
+ if (!empty($serialports)):
+?>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Serial port</td>
+ <td width="78%" class="vtable">
+ <select name="ppsport" class="formselect">
+ <option value="">none</option>
+ <?php
+ foreach ($serialports as $port):
+ $shortport = substr($port, 5);
+ $selected = ($shortport == $pconfig['port']) ? " selected=\"selected\"" : "";?>
+ <option value="<?php echo $shortport;?>"<?php echo $selected;?>><?php echo $shortport;?></option>
+ <?php
+ endforeach;
+ ?>
+ </select>&nbsp;
+ <?php echo gettext("All serial ports are listed, be sure to pick the port with the PPS source attached."); ?>
+ </td>
+ </tr>
+<?php
+ endif;
+?>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Fudge time</td>
+ <td width="78%" class="vtable">
+ <input name="ppsfudge1" type="text" class="formfld unknown" id="ppsfudge1" min="-1" max="1" size="20" value="<?=htmlspecialchars($pconfig['fudge1']);?>" />(<?php echo gettext("seconds");?>)<br />
+ <?php echo gettext("Fudge time is used to specify the PPS signal offset from the actual second such as the transmission delay between the transmitter and the receiver.");?> (<?php echo gettext("default");?>: 0.0).
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Stratum</td>
+ <td width="78%" class="vtable">
+ <input name="ppsstratum" type="text" class="formfld unknown" id="ppsstratum" max="16" size="20" value="<?=htmlspecialchars($pconfig['stratum']);?>" /><?php echo gettext("(0-16)");?><br />
+ <?php echo gettext("This may be used to change the PPS Clock stratum");?> (<?php echo gettext("default");?>: 0). <?php echo gettext("This may be useful if, for some reason, you want ntpd to prefer a different clock and just monitor this source."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Flags</td>
+ <td width="78%" class="vtable">
+ <table summary="flags">
+ <tr>
+ <td>
+ <?php echo gettext("Normally there should be no need to change these options from the defaults."); ?><br />
+ </td>
+ </tr>
+ </table>
+ <table>
+ <tr>
+ <td>
+ <input name="ppsflag2" type="checkbox" class="formcheckbox" id="ppsflag2"<?php if ($pconfig['flag2']) echo " checked=\"checked\""; ?> />
+ </td>
+ <td>
+ <span class="vexpl"><?php echo gettext("Enable falling edge PPS signal processing (default: rising edge)."); ?></span>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input name="ppsflag3" type="checkbox" class="formcheckbox" id="ppsflag3"<?php if ($pconfig['flag3']) echo " checked=\"checked\""; ?> />
+ </td>
+ <td>
+ <span class="vexpl"><?php echo gettext("Enable kernel PPS clock discipline (default: disabled)."); ?></span>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input name="ppsflag4" type="checkbox" class="formcheckbox" id="ppsflag4"<?php if ($pconfig['flag4']) echo " checked=\"checked\""; ?> />
+ </td>
+ <td>
+ <span class="vexpl"><?php echo gettext("Record a timestamp once for each second, useful for constructing Allan deviation plots (default: disabled)."); ?></span>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Clock ID</td>
+ <td width="78%" class="vtable">
+ <input name="ppsrefid" type="text" class="formfld unknown" id="ppsrefid" maxlength= "4" size="20" value="<?php htmlspecialchars($pconfig['refid']);?>" /><?php echo gettext("(1 to 4 charactors)");?><br />
+ <?php echo gettext("This may be used to change the PPS Clock ID");?> (<?php echo gettext("default");?>: PPS).
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
</table>
</form>
<?php include("fend.inc"); ?>
OpenPOWER on IntegriCloud