<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/c39eb9f41cdf26d6a93ea6faed3bc3b0c4f366ec">c39eb9f4</a></strong>
<div>
<span>by Eric S. Raymond</span>
<i>at 2015-12-04T06:11:39Z</i>
</div>
<pre class='commit-message'>Refactor, we're going to need packet dumping for packet receives.</pre>
</li>
<li>
<strong><a href="https://gitlab.com/NTPsec/ntpsec/commit/6b1754ade2d34ffbb28e6fc1ad955dc1d75fb89b">6b1754ad</a></strong>
<div>
<span>by Eric S. Raymond</span>
<i>at 2015-12-04T07:47:54Z</i>
</div>
<pre class='commit-message'>Properly intercept and replay timer events.</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_intercept.h
</a>
</li>
<li class='file-stats'>
<a href='#diff-2'>
ntpd/ntpd.c
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id='diff-0'>
<a href='https://gitlab.com/NTPsec/ntpsec/compare/804a57f98785806e6393056d249b47b6a0836f60...6b1754ade2d34ffbb28e6fc1ad955dc1d75fb89b#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">@@ -30,9 +30,7 @@ following kinds:
</span> 
 12. Read of authkey file
 
<span style="color: #000000;background-color: #ffdddd">-13. getaddrinfo() calls (TODO)
-
-14. Termination.
</span><span style="color: #000000;background-color: #ddffdd">+13. 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">@@ -187,12 +185,11 @@ long intercept_ntp_random(const char *legend)
</span>     return rand;
 }
 
<span style="color: #000000;background-color: #ffdddd">-void intercept_alarm(void)
</span><span style="color: #000000;background-color: #ddffdd">+void intercept_timer(void)
</span> {
<span style="color: #000000;background-color: #ffdddd">-    /* FIXME: replay mode, calling timer(), goes here */
-
</span>     if (mode != none)
<span style="color: #000000;background-color: #ffdddd">-        printf("event tick\n");
</span><span style="color: #000000;background-color: #ddffdd">+   printf("event timer\n");
+    timer();
</span> }
 
 bool intercept_drift_read(const char *drift_file, double *drift)
<span style="color: #aaaaaa">@@ -319,6 +316,24 @@ intercept_leapsec_load_file(
</span>     return loaded;
 }
 
<span style="color: #000000;background-color: #ddffdd">+static void packet_dump(sockaddr_u *dest, struct pkt *pkt, int len)
+{
+    size_t i;
+    printf("%s %d:%d:%d:%d:%u:%u:%u:%d:%d:%d:%d",
+          socktoa(dest),
+          pkt->li_vn_mode, pkt->stratum, pkt->ppoll, pkt->precision,
+          /* FIXME: might be better to dump these in fixed-point */
+          pkt->rootdelay, pkt->rootdisp,
+          pkt->refid,
+          /* FIXME: might be better to dump last 4 in fixed-point */
+          pkt->reftime.l_uf, pkt->org.l_uf,
+          pkt->rec.l_uf, pkt->xmt.l_uf);
+    /* dump MAC as len - LEN_PKT_NOMAC chars in hex */
+    for (i = 0; i < len - LEN_PKT_NOMAC; i++)
+       printf("%02x", pkt->exten[i]);
+    fputs("\n", stdout);
+}
+
</span> void intercept_sendpkt(const char *legend,
                  sockaddr_u *dest, struct interface *ep, int ttl,
                  struct pkt *pkt, int len)
<span style="color: #aaaaaa">@@ -327,19 +342,8 @@ void intercept_sendpkt(const char *legend,
</span>   sendpkt(dest, ep, ttl, pkt, len);
 
     if (mode != none) {
<span style="color: #000000;background-color: #ffdddd">-        size_t i;
-       printf("event sendpkt \"%s\" %s %d:%d:%d:%d:%u:%u:%u:%d:%d:%d:%d",
-              legend, socktoa(dest),
-              pkt->li_vn_mode, pkt->stratum, pkt->ppoll, pkt->precision,
-              /* FIXME: might be better to dump these in fixed-point */
-              pkt->rootdelay, pkt->rootdisp,
-              pkt->refid,
-              /* FIXME: might be better to dump last 4 in fixed-point */
-              pkt->reftime.l_uf, pkt->org.l_uf,
-              pkt->rec.l_uf, pkt->xmt.l_uf);
-       /* dump MAC as len - LEN_PKT_NOMAC chars in hex */
-       for (i = 0; i < len - LEN_PKT_NOMAC; i++)
-           printf("%02x", pkt->exten[i]);
</span><span style="color: #000000;background-color: #ddffdd">+   printf("event sendpkt \"%s\"", legend);
+       packet_dump(dest, pkt, len);
</span>   fputs("\n", stdout);
     }
 
</code></pre>

<br>
</li>
<li id='diff-1'>
<a href='https://gitlab.com/NTPsec/ntpsec/compare/804a57f98785806e6393056d249b47b6a0836f60...6b1754ade2d34ffbb28e6fc1ad955dc1d75fb89b#diff-1'>
<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">@@ -29,7 +29,7 @@ void intercept_argparse(int *, char ***);
</span> void intercept_getconfig(const char *);
 void intercept_get_systime(const char *, l_fp *);
 long intercept_ntp_random(const char *);
<span style="color: #000000;background-color: #ffdddd">-void intercept_alarm(void);
</span><span style="color: #000000;background-color: #ddffdd">+void intercept_timer(void);
</span> void intercept_sendpkt(const char *,
                       sockaddr_u *, struct interface *, int, struct pkt *, int);
 bool intercept_drift_read(const char *, double *);
</code></pre>

<br>
</li>
<li id='diff-2'>
<a href='https://gitlab.com/NTPsec/ntpsec/compare/804a57f98785806e6393056d249b47b6a0836f60...6b1754ade2d34ffbb28e6fc1ad955dc1d75fb89b#diff-2'>
<strong>
ntpd/ntpd.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/ntpd/ntpd.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/ntpd/ntpd.c
</span><span style="color: #aaaaaa">@@ -961,13 +961,12 @@ static void mainloop(void)
</span>           }
 
                if (was_alarmed) {
<span style="color: #000000;background-color: #ffdddd">-                        intercept_alarm();
</span>                   UNBLOCK_IO_AND_ALARM();
                        /*
                         * Out here, signals are unblocked.  Call timer routine
                         * to process expiry.
                         */
<span style="color: #000000;background-color: #ffdddd">-                        timer();
</span><span style="color: #000000;background-color: #ddffdd">+                   intercept_timer();
</span>                   was_alarmed = false;
                        BLOCK_IO_AND_ALARM();
                }
</code></pre>

<br>
</li>

</div>
<div class='footer' style='margin-top: 10px;'>
<p>

<br>
<a href="https://gitlab.com/NTPsec/ntpsec/compare/804a57f98785806e6393056d249b47b6a0836f60...6b1754ade2d34ffbb28e6fc1ad955dc1d75fb89b">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>