<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/0bfe03092c6bf6118006d5b9347848bcba6b5bac">0bfe0309</a></strong>
<div>
<span>by Eric S. Raymond</span>
<i>at 2015-12-16T05:58:37Z</i>
</div>
<pre class='commit-message'>Replay refactoring, and an error message improvement.</pre>
</li>
<li>
<strong><a href="https://gitlab.com/NTPsec/ntpsec/commit/646531c54155a0bd272bb798ae8115d3abc99cdd">646531c5</a></strong>
<div>
<span>by Eric S. Raymond</span>
<i>at 2015-12-16T05:59:27Z</i>
</div>
<pre class='commit-message'>Suppress some unneeded captures. Explanation in the diff.</pre>
</li>
<li>
<strong><a href="https://gitlab.com/NTPsec/ntpsec/commit/8b0f5a7a5348a21197dc074f754c151f17f54943">8b0f5a7a</a></strong>
<div>
<span>by Eric S. Raymond</span>
<i>at 2015-12-17T09:48:41Z</i>
</div>
<pre class='commit-message'>Avoid a core dump in the interface layers due to signedness problem.
Fixes a bug reported by Hal Murray: ntpd -p was core-dumping ntpd.</pre>
</li>
</ul>
<h4>3 changed files:</h4>
<ul>
<li class='file-stats'>
<a href='#diff-0'>
ntpd/ntp_intercept.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-1'>
ntpd/ntp_io.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-2'>
ntpd/ntp_proto.c
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id='diff-0'>
<a href='https://gitlab.com/NTPsec/ntpsec/compare/d363c6050c73a86405b17d68e55299710ee9c7d3...8b0f5a7a5348a21197dc074f754c151f17f54943#diff-0'>
<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">@@ -636,12 +636,49 @@ static void packet_dump(char *buf, size_t buflen,
</span> strlcat(buf, "nomac", buflen);
else
/* dump MAC as len - LEN_PKT_NOMAC chars in hex */
<span style="color: #000000;background-color: #ffdddd">- for (i = 0; i < len - LEN_PKT_NOMAC; i++) {
</span><span style="color: #000000;background-color: #ddffdd">+ for (i = 0; i + LEN_PKT_NOMAC < len; i++) {
</span> snprintf(buf + strlen(buf), buflen - strlen(buf),
"%02x", pkt->exten[i]);
}
}
<span style="color: #000000;background-color: #ddffdd">+static void packet_parse(char *pktbuf, char *macbuf, struct pkt *pkt)
+{
+ char refbuf[32], orgbuf[32], recbuf[32], xmtbuf[32];
+ int li_vn_mode = 0, stratum = 0, ppoll = 0, precision = 0;
+
+ if (sscanf(pktbuf, "%d:%d:%d:%d:%u:%u:%u:%s:%s:%s:%s",
+ &li_vn_mode, &stratum,
+ &ppoll, &precision,
+ &pkt->rootdelay, &pkt->rootdisp,
+ &pkt->refid,
+ refbuf, orgbuf, recbuf, xmtbuf) != 7)
+ {
+ fprintf(stderr, "ntpd: malformed packet dump at line %d\n",
+ lineno);
+ exit(1);
+ }
+ /* extra transfers required because the struct members are int8_t */
+ pkt->li_vn_mode = li_vn_mode;
+ pkt->stratum = stratum;
+ pkt->ppoll = ppoll;
+ pkt->precision = precision;
+ atolfp(refbuf, &pkt->reftime);
+ atolfp(orgbuf, &pkt->org);
+ atolfp(recbuf, &pkt->rec);
+ atolfp(xmtbuf, &pkt->xmt);
+
+ memset(pkt->exten, '\0', sizeof(pkt->exten));
+ if (strcmp(macbuf, "nomac") != 0) {
+ size_t i;
+ for (i = 0; i < strlen(macbuf)/2; i++) {
+ int hexval;
+ sscanf(macbuf + 2*i, "%02x", &hexval);
+ pkt->exten[i] = hexval & 0xff;
+ }
+ }
+}
+
</span> static void recvbuf_dump(char *buf, size_t buflen, struct recvbuf *rbufp)
{
char pkt_dump[BUFSIZ];
<span style="color: #aaaaaa">@@ -704,13 +741,30 @@ void intercept_replay(void)
</span> get_operation(NULL);
if (strncmp(linebuf, "finish", 6) == 0)
break;
<span style="color: #000000;background-color: #ddffdd">+#if 0
+ else if (strncmp(linebuf, "sendpkt ", 9) == 0)
+ {
+ struct pkt pkt;
+ char legend[BUFSIZ], recvbuf[BUFSIZ], destbuf[BUFSIZ];
+ char pktbuf[BUFSIZ], macbuf[BUFSIZ];
+
+ if (sscanf(linebuf, "sendpkt %x %s %s %s %s",
+ legend, recvbuf, destbuf, pktbuf, macbuf) != 5)
+ {
+ fprintf(stderr, "ntpd: bad receive format at line %d\n", lineno);
+ exit(1);
+ }
+
+ packet_parse(recvbuf, macbuf, &pkt);
+
+
+ }
+#endif
</span> else if (strncmp(linebuf, "receive ", 8) == 0)
{
struct recvbuf rbuf;
struct pkt *pkt;
<span style="color: #000000;background-color: #ffdddd">- int li_vn_mode = 0, stratum = 0, ppoll = 0, precision = 0;
</span> char recvbuf[BUFSIZ], srcbuf[BUFSIZ], pktbuf[BUFSIZ], macbuf[BUFSIZ];
<span style="color: #000000;background-color: #ffdddd">- char refbuf[32], orgbuf[32], recbuf[32], xmtbuf[32];
</span>
if (sscanf(linebuf, "receive %x %s %s %s %s",
&rbuf.cast_flags, recvbuf, srcbuf, pktbuf, macbuf) != 5)
<span style="color: #aaaaaa">@@ -726,36 +780,7 @@ void intercept_replay(void)
</span> }
pkt = &rbuf.recv_pkt;
<span style="color: #000000;background-color: #ffdddd">- if (sscanf(pktbuf, "%d:%d:%d:%d:%u:%u:%u:%s:%s:%s:%s",
- &li_vn_mode, &stratum,
- &ppoll, &precision,
- &pkt->rootdelay, &pkt->rootdisp,
- &pkt->refid,
- refbuf, orgbuf, recbuf, xmtbuf) != 7)
- {
- fprintf(stderr, "ntpd: malformed packet dump at line %d\n",
- lineno);
- exit(1);
- }
- /* extra transfers required because the struct members are int8_t */
- pkt->li_vn_mode = li_vn_mode;
- pkt->stratum = stratum;
- pkt->ppoll = ppoll;
- pkt->precision = precision;
- atolfp(refbuf, &pkt->reftime);
- atolfp(orgbuf, &pkt->org);
- atolfp(recbuf, &pkt->rec);
- atolfp(xmtbuf, &pkt->xmt);
-
- memset(pkt->exten, '\0', sizeof(pkt->exten));
- if (strcmp(macbuf, "nomac") != 0) {
- size_t i;
- for (i = 0; i < strlen(macbuf)/2; i++) {
- int hexval;
- sscanf(macbuf + 2*i, "%02x", &hexval);
- pkt->exten[i] = hexval & 0xff;
- }
- }
</span><span style="color: #000000;background-color: #ddffdd">+ packet_parse(recvbuf, macbuf, pkt);
</span>
/*
* If the packet doesn't dump identically to how it came in,
<span style="color: #aaaaaa">@@ -775,7 +800,13 @@ void intercept_replay(void)
</span> }
else
{
<span style="color: #000000;background-color: #ffdddd">- fprintf(stderr, "ntpd: unexpected operation at line %d\n", lineno);
</span><span style="color: #000000;background-color: #ddffdd">+ char errbuf[BUFSIZ], *cp;
+ strlcpy(errbuf, linebuf, sizeof(errbuf));
+ cp = strchr(errbuf, ' ');
+ if (cp != NULL)
+ *cp = '\0';
+ fprintf(stderr, "ntpd: unexpected operation '%s' at line %d\n",
+ errbuf, lineno);
</span> exit(1);
}
}
</code></pre>
<br>
</li>
<li id='diff-1'>
<a href='https://gitlab.com/NTPsec/ntpsec/compare/d363c6050c73a86405b17d68e55299710ee9c7d3...8b0f5a7a5348a21197dc074f754c151f17f54943#diff-1'>
<strong>
ntpd/ntp_io.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/ntpd/ntp_io.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/ntpd/ntp_io.c
</span><span style="color: #aaaaaa">@@ -3583,7 +3583,12 @@ io_handler(void)
</span> if (nfound > 0) {
l_fp ts;
<span style="color: #000000;background-color: #ffdddd">- intercept_get_systime(__func__, &ts);
</span><span style="color: #000000;background-color: #ddffdd">+ /*
+ * Doesn't need to be intercepted, because the time
+ * algorithms don't use it. It's strictly internal
+ * to the I/O handling.
+ */
+ get_systime(&ts);
</span>
input_handler(&ts);
} else if (nfound == -1 && errno != EINTR) {
</code></pre>
<br>
</li>
<li id='diff-2'>
<a href='https://gitlab.com/NTPsec/ntpsec/compare/d363c6050c73a86405b17d68e55299710ee9c7d3...8b0f5a7a5348a21197dc074f754c151f17f54943#diff-2'>
<strong>
ntpd/ntp_proto.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/ntpd/ntp_proto.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/ntpd/ntp_proto.c
</span><span style="color: #aaaaaa">@@ -3103,9 +3103,11 @@ peer_xmit(
</span> #endif /* !ENABLE_AUTOKEY */
/*
<span style="color: #000000;background-color: #ffdddd">- * Transmit a-priori timestamps
</span><span style="color: #000000;background-color: #ddffdd">+ * Transmit a-priori timestamps. We don't need to log these
+ * for replay because the timestamp gets stuffed in the packet
+ * which is what's visible in the replay log.
</span> */
<span style="color: #000000;background-color: #ffdddd">- intercept_get_systime(__func__, &xmt_tx);
</span><span style="color: #000000;background-color: #ddffdd">+ get_systime(&xmt_tx);
</span> if (peer->flip == 0) { /* basic mode */
peer->aorg = xmt_tx;
HTONL_FP(&xmt_tx, &xpkt.xmt);
</code></pre>
<br>
</li>
</div>
<div class='footer' style='margin-top: 10px;'>
<p>
—
<br>
<a href="https://gitlab.com/NTPsec/ntpsec/compare/d363c6050c73a86405b17d68e55299710ee9c7d3...8b0f5a7a5348a21197dc074f754c151f17f54943">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.
</p>
</div>
</body>
</html>