<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/3921a9eb7f8abe2d323bfc1a651e5214d69a9d70">3921a9eb</a></strong>
<div>
<span>by Eric S. Raymond</span>
<i>at 2015-12-07T16:25:49Z</i>
</div>
<pre class='commit-message'>More steps towards TESTFRAME capture mode - dump most of incoming packets.</pre>
</li>
</ul>
<h4>2 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>
</ul>
<h4>Changes:</h4>
<li id='diff-0'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/3921a9eb7f8abe2d323bfc1a651e5214d69a9d70#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">@@ -24,7 +24,7 @@ following kinds:
</span> 
 9. Read of the system leapsecond file.
 
<span style="color: #000000;background-color: #ffdddd">-10. Packets incoming from NTP peers and others.  (TODO)
</span><span style="color: #000000;background-color: #ddffdd">+10. Packets incoming from NTP peers and others.
</span> 
 11. Packets outgoing to NTP peers and others.
 
<span style="color: #aaaaaa">@@ -319,15 +319,14 @@ intercept_leapsec_load_file(
</span> static void packet_dump(sockaddr_u *dest, struct pkt *pkt, int len)
 {
     size_t i;
<span style="color: #000000;background-color: #ffdddd">-    printf("%s %d:%d:%d:%d:%u:%u:%u:%d:%d:%d:%d",
</span><span style="color: #000000;background-color: #ddffdd">+    printf("%s %d:%d:%d:%d:%u:%u:%u:%s:%s:%s:%s",
</span>      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,
<span style="color: #000000;background-color: #ffdddd">-           /* 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);
</span><span style="color: #000000;background-color: #ddffdd">+      lfptoa(&pkt->reftime, 10), lfptoa(&pkt->org, 10),
+          lfptoa(&pkt->rec, 10), lfptoa(&pkt->xmt, 10));
</span>     /* 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 style="color: #aaaaaa">@@ -350,6 +349,27 @@ void intercept_sendpkt(const char *legend,
</span>     /* FIXME: replay logic goes here */
 }
 
<span style="color: #000000;background-color: #ddffdd">+void intercept_receive(struct recvbuf *rbufp)
+{
+    if (mode != replay)
+       receive(rbufp);
+
+    if (mode != none) {
+       /*
+        * Order is: cast flags, receipt time, source address, packet, length.
+        * Cast flags are only kept because they change the ntpq display,
+        * they have no implications for the protocol machine.
+        * We don't dump srcadr because only the parse clock uses that.
+        */
+       printf("event receive %0x %s ",
+              rbufp->cast_flags, lfptoa(&rbufp->recv_time, 10));
+       packet_dump(&rbufp->recv_srcadr, &rbufp->recv_pkt, rbufp->recv_length);
+       fputs("\n", stdout);
+    }
+
+    /* FIXME: replay logic goes here */
+}
+
</span> void
 intercept_getauthkeys(
        const char  * fname)
</code></pre>

<br>
</li>
<li id='diff-1'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/3921a9eb7f8abe2d323bfc1a651e5214d69a9d70#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">@@ -32,6 +32,7 @@ long intercept_ntp_random(const char *);
</span> void intercept_timer(void);
 void intercept_sendpkt(const char *,
                       sockaddr_u *, struct interface *, int, struct pkt *, int);
<span style="color: #000000;background-color: #ddffdd">+void intercept_receive(struct recvbuf *);
</span> bool intercept_drift_read(const char *, double *);
 void intercept_drift_write(char *, double);
 #ifdef HAVE_KERNEL_PLL
</code></pre>

<br>
</li>

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

<br>
<a href="https://gitlab.com/NTPsec/ntpsec/commit/3921a9eb7f8abe2d323bfc1a651e5214d69a9d70">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/3921a9eb7f8abe2d323bfc1a651e5214d69a9d70"}}</script>
</p>
</div>
</body>
</html>