<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/5f5159fed7317af06adea0c93982360a5547dd7e">5f5159fe</a></strong>
<div>
<span>by Eric S. Raymond</span>
<i>at 2015-11-29T14:04:12Z</i>
</div>
<pre class='commit-message'>TESTFRAME progress - intercept calls to read the leapsecond file.
Required moving it from libntp/ to ntpd/, otherwice ntp_leapsec.h won't
be visible. This is better factoring, anyway.</pre>
</li>
</ul>
<h4>5 changed files:</h4>
<ul>
<li class='file-stats'>
<a href='#diff-0'>
include/ntp_intercept.h
</a>
</li>
<li class='file-stats'>
<a href='#diff-1'>
libntp/wscript
</a>
</li>
<li class='file-stats'>
<a href='#diff-2'>
libntp/intercept.c
→
ntpd/ntp_intercept.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-3'>
ntpd/ntp_util.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-4'>
ntpd/wscript
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id='diff-0'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/5f5159fed7317af06adea0c93982360a5547dd7e#diff-0'>
<strong>
include/ntp_intercept.h
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/include/ntp_intercept.h
</span><span style="color: #000000;background-color: #ddffdd">+++ b/include/ntp_intercept.h
</span><span style="color: #aaaaaa">@@ -2,6 +2,10 @@
</span> * ntp_intercept.h - intercept/replay support for environment calls
*/
<span style="color: #000000;background-color: #ddffdd">+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
</span> #ifdef HAVE_SYS_TIMEX_H
# include <sys/time.h> /* prerequisite on NetBSD */
# include <sys/timex.h>
<span style="color: #aaaaaa">@@ -33,5 +37,7 @@ void intercept_drift_write(char *, double);
</span> #ifdef HAVE_KERNEL_PLL
int intercept_kernel_pll_adjtime(struct timex *);
#endif
<span style="color: #000000;background-color: #ddffdd">+extern bool intercept_leapsec_load_file(const char * fname, struct stat * sb,
+ bool force, bool logall);
</span>
/* end */
</code></pre>
<br>
</li>
<li id='diff-1'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/5f5159fed7317af06adea0c93982360a5547dd7e#diff-1'>
<strong>
libntp/wscript
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/libntp/wscript
</span><span style="color: #000000;background-color: #ddffdd">+++ b/libntp/wscript
</span><span style="color: #aaaaaa">@@ -20,7 +20,6 @@ def build(ctx):
</span> "hextolfp.c",
"humandate.c",
"icom.c",
<span style="color: #000000;background-color: #ffdddd">- "intercept.c",
</span> "iosignal.c",
"lib_strbuf.c",
"machines.c",
</code></pre>
<br>
</li>
<li id='diff-2'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/5f5159fed7317af06adea0c93982360a5547dd7e#diff-2'>
<strong>
libntp/intercept.c
</strong>
→
<strong>
ntpd/ntp_intercept.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/libntp/intercept.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/ntpd/ntp_intercept.c
</span><span style="color: #aaaaaa">@@ -1,6 +1,6 @@
</span> /*****************************************************************************
<span style="color: #000000;background-color: #ffdddd">-intercept.c - capture and replay logic for NTP environment calls
</span><span style="color: #000000;background-color: #ddffdd">+ntp_intercept.c - capture and replay logic for NTP environment calls
</span>
Think of ntpd as a complex finite-state machine for transforming a
stream of input events to output events. Events are of the
<span style="color: #aaaaaa">@@ -22,7 +22,7 @@ following kinds:
</span>
8. Calls to adjtime to set the system clock.
<span style="color: #000000;background-color: #ffdddd">-9. Read of the system leapsecond file. (TODO)
</span><span style="color: #000000;background-color: #ddffdd">+9. Read of the system leapsecond file.
</span>
10. Packets incoming from NTP daemons. (TODO)
<span style="color: #aaaaaa">@@ -98,6 +98,7 @@ no mismatches.
</span> #include "ntp_intercept.h"
#include "ntp_fp.h"
#include "ntp_syscall.h"
<span style="color: #000000;background-color: #ddffdd">+#include "ntp_leapsec.h"
</span>
static intercept_mode mode = none;
<span style="color: #aaaaaa">@@ -286,6 +287,36 @@ int intercept_kernel_pll_adjtime(struct timex *tx)
</span> }
#endif
<span style="color: #000000;background-color: #ddffdd">+bool
+intercept_leapsec_load_file(
+ const char * fname,
+ struct stat * sb_old,
+ bool force,
+ bool logall)
+{
+ bool loaded;
+
+ if (mode != replay)
+ loaded = leapsec_load_file(fname, sb_old, force, logall);
+
+ if (mode == capture) {
+ FILE *fp = fopen(fname, "r");
+ if (fp != NULL) {
+ int c;
+
+ fputs("startleapsec\n", stdout);
+ while ((c = fgetc(fp)) != EOF)
+ putchar(c);
+ fclose(fp);
+ fputs("endleapsec\n", stdout);
+ }
+ }
+
+ /* FIXME: replay logic goes here */
+
+ return loaded;
+}
+
</span> void intercept_sendpkt(const char *legend,
sockaddr_u *dest, struct interface *ep, int ttl,
struct pkt *pkt, int len)
</code></pre>
<br>
</li>
<li id='diff-3'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/5f5159fed7317af06adea0c93982360a5547dd7e#diff-3'>
<strong>
ntpd/ntp_util.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/ntpd/ntp_util.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/ntpd/ntp_util.c
</span><span style="color: #aaaaaa">@@ -349,7 +349,7 @@ stats_config(
</span> leapfile_name = erealloc(leapfile_name, len + 1);
memcpy(leapfile_name, value, len + 1);
<span style="color: #000000;background-color: #ffdddd">- if (leapsec_load_file(
</span><span style="color: #000000;background-color: #ddffdd">+ if (intercept_leapsec_load_file(
</span> leapfile_name, &leapfile_stat, true, true))
{
leap_signature_t lsig;
<span style="color: #aaaaaa">@@ -745,7 +745,7 @@ check_leap_file(
</span> return;
/* try to load leapfile, force it if no leapfile loaded yet */
<span style="color: #000000;background-color: #ffdddd">- if (leapsec_load_file(
</span><span style="color: #000000;background-color: #ddffdd">+ if (intercept_leapsec_load_file(
</span> leapfile_name, &leapfile_stat,
!have_leapfile, is_daily_check))
have_leapfile = true;
</code></pre>
<br>
</li>
<li id='diff-4'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/5f5159fed7317af06adea0c93982360a5547dd7e#diff-4'>
<strong>
ntpd/wscript
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/ntpd/wscript
</span><span style="color: #000000;background-color: #ddffdd">+++ b/ntpd/wscript
</span><span style="color: #aaaaaa">@@ -55,6 +55,7 @@ def build(ctx):
</span> "ntp_control.c",
"ntp_crypto.c",
"ntp_filegen.c",
<span style="color: #000000;background-color: #ddffdd">+ "ntp_intercept.c",
</span> "ntp_leapsec.c",
"ntp_loopfilter.c",
"ntp_monitor.c",
</code></pre>
<br>
</li>
</div>
<div class='footer' style='margin-top: 10px;'>
<p>
—
<br>
<a href="https://gitlab.com/NTPsec/ntpsec/commit/5f5159fed7317af06adea0c93982360a5547dd7e">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/5f5159fed7317af06adea0c93982360a5547dd7e"}}</script>
</p>
</div>
</body>
</html>