<html lang='en'>
<head>
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
<title>
GitLab
</title>
</meta>
</head>
<style>
img {
max-width: 100%;
height: auto;
}
p.details {
font-style:italic;
color:#777
}
.footer p {
font-size:small;
color:#777
}
pre.commit-message {
white-space: pre-wrap;
}
.file-stats a {
text-decoration: none;
}
.file-stats .new-file {
color: #090;
}
.file-stats .deleted-file {
color: #B00;
}
</style>
<body>
<div class='content'>
<h3>Eric S. Raymond pushed to branch master at <a href="https://gitlab.com/NTPsec/ntpsec">NTPsec / ntpsec</a></h3>
<h4>
Commits:
</h4>
<ul>
<li>
<strong><a href="https://gitlab.com/NTPsec/ntpsec/commit/ec010c7d466c66bc51ee8eb3f71e20aff7631548">ec010c7d</a></strong>
<div>
<span>by Eric S. Raymond</span>
<i>at 2015-12-08T22:26:34Z</i>
</div>
<pre class='commit-message'>Improvements to capture code. Capture ntp_set_tod and adjtime.</pre>
</li>
</ul>
<h4>7 changed files:</h4>
<ul>
<li class='file-stats'>
<a href='#diff-0'>
include/ntp_fp.h
</a>
</li>
<li class='file-stats'>
<a href='#diff-1'>
libntp/systime.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-2'>
ntpd/ntp_control.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-3'>
ntpd/ntp_intercept.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-4'>
ntpd/ntp_intercept.h
</a>
</li>
<li class='file-stats'>
<a href='#diff-5'>
ntpd/ntp_loopfilter.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-6'>
ntpdig/main.c
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id='diff-0'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/ec010c7d466c66bc51ee8eb3f71e20aff7631548#diff-0'>
<strong>
include/ntp_fp.h
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/include/ntp_fp.h
</span><span style="color: #000000;background-color: #ddffdd">+++ b/include/ntp_fp.h
</span><span style="color: #aaaaaa">@@ -356,7 +356,7 @@ extern void get_ostime (struct timespec *tsp);
</span> extern void normalize_time (struct timespec, long, l_fp *);
extern void get_systime (l_fp *);
extern bool step_systime (double);
<span style="color: #000000;background-color: #ffdddd">-extern bool adj_systime (double);
</span><span style="color: #000000;background-color: #ddffdd">+extern bool adj_systime (double, int (*adjtime)(const struct timeval *, struct timeval *));
</span>
extern struct tm * ntp2unix_tm (uint32_t ntp, int local);
</code></pre>
<br>
</li>
<li id='diff-1'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/ec010c7d466c66bc51ee8eb3f71e20aff7631548#diff-1'>
<strong>
libntp/systime.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/libntp/systime.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/libntp/systime.c
</span><span style="color: #aaaaaa">@@ -321,7 +321,8 @@ normalize_time(
</span> #if !defined SYS_WINNT
bool /* true on okay, false on error */
adj_systime(
<span style="color: #000000;background-color: #ffdddd">- double now /* adjustment (s) */
</span><span style="color: #000000;background-color: #ddffdd">+ double now, /* adjustment (s) */
+ int (*ladjtime)(const struct timeval *, struct timeval *)
</span> )
{
struct timeval adjtv; /* new adjustment */
<span style="color: #aaaaaa">@@ -376,7 +377,7 @@ adj_systime(
</span> sys_residual = -sys_residual;
}
if (adjtv.tv_sec != 0 || adjtv.tv_usec != 0) {
<span style="color: #000000;background-color: #ffdddd">- if (adjtime(&adjtv, &oadjtv) < 0) {
</span><span style="color: #000000;background-color: #ddffdd">+ if (ladjtime(&adjtv, &oadjtv) < 0) {
</span> msyslog(LOG_ERR, "adj_systime: %m");
return false;
}
</code></pre>
<br>
</li>
<li id='diff-2'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/ec010c7d466c66bc51ee8eb3f71e20aff7631548#diff-2'>
<strong>
ntpd/ntp_control.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/ntpd/ntp_control.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/ntpd/ntp_control.c
</span><span style="color: #aaaaaa">@@ -1697,7 +1697,7 @@ ctl_putsys(
</span> if (CS_KERN_FIRST <= varid && varid <= CS_KERN_LAST &&
current_time != ntp_adjtime_time) {
ZERO(ntx);
<span style="color: #000000;background-color: #ffdddd">- if (intercept_kernel_pll_adjtime(&ntx) < 0)
</span><span style="color: #000000;background-color: #ddffdd">+ if (intercept_ntp_adjtime(&ntx) < 0)
</span> msyslog(LOG_ERR, "ntp_adjtime() for mode 6 query failed: %m");
else
ntp_adjtime_time = current_time;
</code></pre>
<br>
</li>
<li id='diff-3'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/ec010c7d466c66bc51ee8eb3f71e20aff7631548#diff-3'>
<strong>
ntpd/ntp_intercept.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/ntpd/ntp_intercept.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/ntpd/ntp_intercept.c
</span><span style="color: #aaaaaa">@@ -20,17 +20,19 @@ following kinds:
</span>
7. Alarm events.
<span style="color: #000000;background-color: #ffdddd">-8. Calls to adjtime to set the system clock.
</span><span style="color: #000000;background-color: #ddffdd">+8. Calls to adjtime/ntp_adjtime/adjtime to adjust the system clock.
</span>
<span style="color: #000000;background-color: #ffdddd">-9. Read of the system leapsecond file.
</span><span style="color: #000000;background-color: #ddffdd">+9 Calls to ntp_set_tod to ser the system clock.
</span>
<span style="color: #000000;background-color: #ffdddd">-10. Packets incoming from NTP peers and others.
</span><span style="color: #000000;background-color: #ddffdd">+10. Read of the system leapsecond file.
</span>
<span style="color: #000000;background-color: #ffdddd">-11. Packets outgoing to NTP peers and others.
</span><span style="color: #000000;background-color: #ddffdd">+11. Packets incoming from NTP peers and others.
</span>
<span style="color: #000000;background-color: #ffdddd">-12. Read of authkey file
</span><span style="color: #000000;background-color: #ddffdd">+12. Packets outgoing to NTP peers and others.
</span>
<span style="color: #000000;background-color: #ffdddd">-13. Termination.
</span><span style="color: #000000;background-color: #ddffdd">+13. Read of authkey file
+
+14. Termination.
</span>
We must support two modes of operation. In "capture" mode, ntpd
operates normally, logging all events. In "replay" mode, ntpd accepts
<span style="color: #aaaaaa">@@ -234,16 +236,17 @@ bool intercept_drift_read(const char *drift_file, double *drift)
</span> }
if (mode != none)
<span style="color: #000000;background-color: #ffdddd">- printf("event drift %.3f\n", *drift);
</span><span style="color: #000000;background-color: #ddffdd">+ printf("event drift-read %.3f\n", *drift);
</span>
return true;
}
void intercept_drift_write(char *driftfile, double drift)
{
<span style="color: #000000;background-color: #ffdddd">- if (mode == capture || mode == replay)
- printf("event drift %.3f\n", drift);
- else
</span><span style="color: #000000;background-color: #ddffdd">+ if (mode != none)
+ printf("event drift-write %.3f\n", drift);
+
+ if (mode != replay)
</span> {
int fd;
char tmpfile[PATH_MAX], driftcopy[PATH_MAX];
<span style="color: #aaaaaa">@@ -274,8 +277,21 @@ void intercept_drift_write(char *driftfile, double drift)
</span> }
}
<span style="color: #000000;background-color: #ddffdd">+int intercept_adjtime(const struct timeval *ntv, struct timeval *otv)
+/* old-fashioned BSD call for systems with no PLL */
+{
+ printf("event adjtime %ld %ld %ld %ld",
+ ntv->tv_sec, ntv->tv_usec, ntv->tv_sec, ntv->tv_usec);
+
+ if (mode != replay)
+ return adjtime(ntv, otv);
+
+ return 0;
+}
+
</span> #ifdef HAVE_KERNEL_PLL
<span style="color: #000000;background-color: #ffdddd">-int intercept_kernel_pll_adjtime(struct timex *tx)
</span><span style="color: #000000;background-color: #ddffdd">+int intercept_ntp_adjtime(struct timex *tx)
+/* for newer systems with PLLs */
</span> {
int res = 0;
<span style="color: #aaaaaa">@@ -285,7 +301,7 @@ int intercept_kernel_pll_adjtime(struct timex *tx)
</span> res = ntp_adjtime(tx);
if (mode != none)
<span style="color: #000000;background-color: #ffdddd">- printf("event adjtime %u %ld %ld %ld %ld %i %ld %ld %ld %ld %ld %i %ld %ld %ld %ld %d\n",
</span><span style="color: #000000;background-color: #ddffdd">+ printf("event ntp_adjtime %u %ld %ld %ld %ld %i %ld %ld %ld %ld %ld %i %ld %ld %ld %ld %d\n",
</span> tx->modes,
tx->offset,
tx->freq,
<span style="color: #aaaaaa">@@ -309,6 +325,18 @@ int intercept_kernel_pll_adjtime(struct timex *tx)
</span> }
#endif
<span style="color: #000000;background-color: #ddffdd">+int intercept_set_tod(struct timespec *tvs)
+{
+ if (mode != none)
+ printf("event set_tod %ld %ld\n", tvs->tv_sec, tvs->tv_nsec);
+
+ if (mode != replay)
+ return ntp_set_tod(tvs);
+
+ /* dodgy - returning success despite not setting time */
+ return 0;
+}
+
</span> bool
intercept_leapsec_load_file(
const char * fname,
</code></pre>
<br>
</li>
<li id='diff-4'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/ec010c7d466c66bc51ee8eb3f71e20aff7631548#diff-4'>
<strong>
ntpd/ntp_intercept.h
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/ntpd/ntp_intercept.h
</span><span style="color: #000000;background-color: #ddffdd">+++ b/ntpd/ntp_intercept.h
</span><span style="color: #aaaaaa">@@ -35,9 +35,11 @@ void intercept_sendpkt(const char *,
</span> void intercept_receive(struct recvbuf *);
bool intercept_drift_read(const char *, double *);
void intercept_drift_write(char *, double);
<span style="color: #000000;background-color: #ddffdd">+int intercept_adjtime(const struct timeval *, struct timeval *);
</span> #ifdef HAVE_KERNEL_PLL
<span style="color: #000000;background-color: #ffdddd">-int intercept_kernel_pll_adjtime(struct timex *);
</span><span style="color: #000000;background-color: #ddffdd">+int intercept_ntp_adjtime(struct timex *);
</span> #endif
<span style="color: #000000;background-color: #ddffdd">+int intercept_set_tod(struct timespec *tvs);
</span> extern bool intercept_leapsec_load_file(const char * fname, struct stat * sb,
bool force, bool logall);
void intercept_getauthkeys(const char *);
</code></pre>
<br>
</li>
<li id='diff-5'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/ec010c7d466c66bc51ee8eb3f71e20aff7631548#diff-5'>
<strong>
ntpd/ntp_loopfilter.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/ntpd/ntp_loopfilter.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/ntpd/ntp_loopfilter.c
</span><span style="color: #aaaaaa">@@ -501,7 +501,7 @@ local_clock(
</span> fp_offset);
printf("ntpd: time set %+.6fs\n", fp_offset);
} else {
<span style="color: #000000;background-color: #ffdddd">- adj_systime(fp_offset);
</span><span style="color: #000000;background-color: #ddffdd">+ adj_systime(fp_offset, intercept_adjtime);
</span> msyslog(LOG_NOTICE, "ntpd: time slew %+.6f s",
fp_offset);
printf("ntpd: time slew %+.6fs\n", fp_offset);
<span style="color: #aaaaaa">@@ -662,7 +662,7 @@ local_clock(
</span> * the stepout threshold.
*/
case EVNT_NSET:
<span style="color: #000000;background-color: #ffdddd">- adj_systime(fp_offset);
</span><span style="color: #000000;background-color: #ddffdd">+ adj_systime(fp_offset, intercept_adjtime);
</span> rstclock(EVNT_FREQ, fp_offset);
break;
<span style="color: #aaaaaa">@@ -805,7 +805,7 @@ local_clock(
</span> * the pps. In any case, fetch the kernel offset,
* frequency and jitter.
*/
<span style="color: #000000;background-color: #ffdddd">- ntp_adj_ret = intercept_kernel_pll_adjtime(&ntv);
</span><span style="color: #000000;background-color: #ddffdd">+ ntp_adj_ret = intercept_ntp_adjtime(&ntv);
</span> /*
* A squeal is a return status < 0, or a state change.
*/
<span style="color: #aaaaaa">@@ -840,7 +840,7 @@ local_clock(
</span> loop_tai = sys_tai;
ntv.modes = MOD_TAI;
ntv.constant = sys_tai;
<span style="color: #000000;background-color: #ffdddd">- if ((ntp_adj_ret = intercept_kernel_pll_adjtime(&ntv)) != 0) {
</span><span style="color: #000000;background-color: #ddffdd">+ if ((ntp_adj_ret = intercept_ntp_adjtime(&ntv)) != 0) {
</span> ntp_adjtime_error_handler(__func__, &ntv, ntp_adj_ret, errno, false, true, __LINE__ - 1);
}
}
<span style="color: #aaaaaa">@@ -997,7 +997,7 @@ adj_host_clock(
</span> * but does not automatically stop slewing when an offset
* has decayed to zero.
*/
<span style="color: #000000;background-color: #ffdddd">- adj_systime(offset_adj + freq_adj);
</span><span style="color: #000000;background-color: #ddffdd">+ adj_systime(offset_adj + freq_adj, intercept_adjtime);
</span> #endif /* ENABLE_LOCKCLOCK */
}
<span style="color: #aaaaaa">@@ -1077,7 +1077,7 @@ set_freq(
</span> loop_desc = "kernel";
ntv.freq = DTOFREQ(drift_comp);
}
<span style="color: #000000;background-color: #ffdddd">- if ((ntp_adj_ret = intercept_kernel_pll_adjtime(&ntv)) != 0) {
</span><span style="color: #000000;background-color: #ddffdd">+ if ((ntp_adj_ret = intercept_ntp_adjtime(&ntv)) != 0) {
</span> ntp_adjtime_error_handler(__func__, &ntv, ntp_adj_ret, errno, false, false, __LINE__ - 1);
}
}
<span style="color: #aaaaaa">@@ -1114,7 +1114,7 @@ start_kern_loop(void)
</span> pll_control = false;
} else {
if (sigsetjmp(env, 1) == 0) {
<span style="color: #000000;background-color: #ffdddd">- if ((ntp_adj_ret = intercept_kernel_pll_adjtime(&ntv)) != 0) {
</span><span style="color: #000000;background-color: #ddffdd">+ if ((ntp_adj_ret = intercept_ntp_adjtime(&ntv)) != 0) {
</span> ntp_adjtime_error_handler(__func__, &ntv, ntp_adj_ret, errno, false, false, __LINE__ - 1);
}
}
<span style="color: #aaaaaa">@@ -1125,7 +1125,7 @@ start_kern_loop(void)
</span> }
}
#else /* SIGSYS */
<span style="color: #000000;background-color: #ffdddd">- if ((ntp_adj_ret = intercept_kernel_pll_adjtime(&ntv)) != 0) {
</span><span style="color: #000000;background-color: #ddffdd">+ if ((ntp_adj_ret = intercept_ntp_adjtime(&ntv)) != 0) {
</span> ntp_adjtime_error_handler(__func__, &ntv, ntp_adj_ret, errno, false, false, __LINE__ - 1);
}
#endif /* SIGSYS */
<span style="color: #aaaaaa">@@ -1274,7 +1274,7 @@ loop_config(
</span> memset((char *)&ntv, 0, sizeof(ntv));
ntv.modes = MOD_STATUS;
ntv.status = STA_UNSYNC;
<span style="color: #000000;background-color: #ffdddd">- intercept_kernel_pll_adjtime(&ntv);
</span><span style="color: #000000;background-color: #ddffdd">+ intercept_ntp_adjtime(&ntv);
</span> sync_status("kernel time sync disabled",
pll_status,
ntv.status);
</code></pre>
<br>
</li>
<li id='diff-6'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/ec010c7d466c66bc51ee8eb3f71e20aff7631548#diff-6'>
<strong>
ntpdig/main.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/ntpdig/main.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/ntpdig/main.c
</span><span style="color: #aaaaaa">@@ -1572,7 +1572,7 @@ set_time(
</span> }
if (opt_slew) {
<span style="color: #000000;background-color: #ffdddd">- rc = adj_systime(offset);
</span><span style="color: #000000;background-color: #ddffdd">+ rc = adj_systime(offset, adjtime);
</span>
/* If there was a problem, can we rely on errno? */
if (rc)
</code></pre>
<br>
</li>
</div>
<div class='footer' style='margin-top: 10px;'>
<p>
—
<br>
<a href="https://gitlab.com/NTPsec/ntpsec/commit/ec010c7d466c66bc51ee8eb3f71e20aff7631548">View it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.com.
If you'd like to receive fewer emails, you can adjust your notification settings.
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Commit","url":"https://gitlab.com/NTPsec/ntpsec/commit/ec010c7d466c66bc51ee8eb3f71e20aff7631548"}}</script>
</p>
</div>
</body>
</html>