summaryrefslogtreecommitdiffstats
path: root/usr/local/www/services_ntpd.php
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2012-08-21 16:22:31 -0400
committerjim-p <jimp@pfsense.org>2012-08-21 16:23:33 -0400
commit5c8843d5fb080c196c0d9dfcfeb526afa3cba23d (patch)
tree8edd85eebfcb94574f0151eb6df45ffb5997df75 /usr/local/www/services_ntpd.php
parent73815007a4bfa41d0e7225d59c450ec853024e29 (diff)
downloadpfsense-5c8843d5fb080c196c0d9dfcfeb526afa3cba23d.zip
pfsense-5c8843d5fb080c196c0d9dfcfeb526afa3cba23d.tar.gz
Teach ntpd how to get its time from a local GPS on serial.
Diffstat (limited to 'usr/local/www/services_ntpd.php')
-rw-r--r--usr/local/www/services_ntpd.php35
1 files changed, 32 insertions, 3 deletions
diff --git a/usr/local/www/services_ntpd.php b/usr/local/www/services_ntpd.php
index 0cbaf2a..1aa53fb 100644
--- a/usr/local/www/services_ntpd.php
+++ b/usr/local/www/services_ntpd.php
@@ -59,6 +59,11 @@ if ($_POST) {
elseif (isset($config['ntpd']['interface']))
unset($config['ntpd']['interface']);
+ if (!empty($_POST['gpsport']) && file_exists('/dev/'.$_POST['gpsport']))
+ $config['ntpd']['gpsport'] = $_POST['gpsport'];
+ else
+ unset($config['ntpd']['gpsport']);
+
write_config("Updated NTP Server Settings");
$retval = 0;
@@ -110,12 +115,36 @@ include("head.inc");
echo ">{$ifacename}</option>\n";
} ?>
</select>
- <br/>Interfaces without an IP address will not be shown.
<br/>
- <br/>Selecting no interfaces will listen on all interfaces with a wildcard.
- <br/>Selecting all interfaces will explicitly listen on only the interfaces/IPs specified.
+ <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>
+<?php /* Probing would be nice, but much more complex. Would need to listen to each port for 1s+ and watch for strings. */ ?>
+<?php $serialports = glob("/dev/cua?[0-9]{,.[0-9]}", GLOB_BRACE); ?>
+<?php if (!empty($serialports)): ?>
+<tr>
+ <td width="22%" valign="top" class="vncellreq">Serial GPS</td>
+ <td width="78%" class="vtable">
+ <select name="gpsport">
+ <option value="">none</option>
+ <?php foreach ($serialports as $port):
+ $shortport = substr($port,5);
+ $selected = ($shortport == $config['ntpd']['gpsport']) ? " selected" : "";?>
+ <option value="<?php echo $shortport;?>"<?php echo $selected;?>><?php echo $shortport;?></option>
+ <?php endforeach; ?>
+ </select>
+ <br/>
+ <br/><?php echo gettext("The GPS must provide NEMA format output!"); ?>
+ <br/>
+ <br/><?php echo gettext("All serial ports are listed, be sure to pick only the port with the GPS attached."); ?>
+ <br/>
+ <br/><?php echo gettext("It is best to configure at least 2 servers under"); ?> <a href="system.php"><?php echo gettext("System > General"); ?></a> <?php echo gettext("to avoid loss of sync if the GPS data is not valid over time. Otherwise ntpd may only use values from the unsynchronized local clock when proving time to clients."); ?>
</td>
</tr>
+<?php endif; ?>
<tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
OpenPOWER on IntegriCloud