<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/a49546fa2b1c21e954d81d02f076c5114a0bf731">a49546fa</a></strong>
<div>
<span>by Eric S. Raymond</span>
<i>at 2015-11-29T18:48:54Z</i>
</div>
<pre class='commit-message'>TESTFRAME: Packet & address dumping for intercept_sendpkt().</pre>
</li>
<li>
<strong><a href="https://gitlab.com/NTPsec/ntpsec/commit/d96344411cc91969dcc1e742f64f8aba7802804d">d9634441</a></strong>
<div>
<span>by Eric S. Raymond</span>
<i>at 2015-11-30T02:20:55Z</i>
</div>
<pre class='commit-message'>Unbreak the build on Mac OS X.

Broken in "Refactor so intercept_log does not have to be visible."</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/ntpd.c
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id='diff-0'>
<a href='https://gitlab.com/NTPsec/ntpsec/compare/9da2eff0ba84774de3379a26aa8d26c7a8c4c3bd...d96344411cc91969dcc1e742f64f8aba7802804d#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,9 +24,9 @@ following kinds:
</span> 
 9. Read of the system leapsecond file.
 
<span style="color: #000000;background-color: #ffdddd">-10. Packets incoming from NTP daemons.  (TODO)
</span><span style="color: #000000;background-color: #ddffdd">+10. Packets incoming from NTP peers and others.  (TODO)
</span> 
<span style="color: #000000;background-color: #ffdddd">-11. Packets outgoing to NTP daemons.  (TODO)
</span><span style="color: #000000;background-color: #ddffdd">+11. Packets outgoing to NTP peers and others.
</span> 
 12. Read of authkey file
 
<span style="color: #aaaaaa">@@ -86,6 +86,8 @@ no mismatches.
</span> #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <libgen.h>
<span style="color: #000000;background-color: #ddffdd">+#include <sys/socket.h>
+#include <netdb.h>
</span> 
 #include "ntpd.h"
 #include "ntp_io.h"
<span style="color: #aaaaaa">@@ -325,10 +327,33 @@ void intercept_sendpkt(const char *legend,
</span>   sendpkt(dest, ep, ttl, pkt, len);
 
     if (mode != none) {
<span style="color: #000000;background-color: #ffdddd">-        printf("event sendpkt \"%s\" ...", legend);
-       /* FIXME: dump the destination and the guts of the packet */
-       fputs("\n", stdout);
</span><span style="color: #000000;background-color: #ddffdd">+   char host[BUFSIZ], serv[BUFSIZ];
+       /* sanity check: serv should always be "ntp" */
+       int status = getnameinfo(&dest->sa, SOCKLEN(dest),
+                                host, sizeof(host),
+                                serv, sizeof(serv),
+                                NI_NUMERICSERV);
+       if (status != 0)
+           fprintf(stderr, "ntpd: getnameinfo() failed in intercept_sendpkt()\n");
+       else {
+           size_t i;
+           printf("event sendpkt \"%s\" %s %s %d:%d:%d:%d:%u:%u:%u:%d:%d:%d:%d",
+                  legend, host, serv,
+                  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>     }
<span style="color: #000000;background-color: #ddffdd">+
+    /* FIXME: replay logic goes here */
</span> }
 
 void
<span style="color: #aaaaaa">@@ -354,33 +379,15 @@ intercept_getauthkeys(
</span>     /* FIXME: replay logic goes here */
 }
 
<span style="color: #000000;background-color: #ffdddd">-#if !defined(SIM) && defined(SIGDIE1)
-/*
- * finish - exit gracefully
- */
-void intercept_finish(const int sig)
</span><span style="color: #000000;background-color: #ddffdd">+void intercept_finish(int sig)
</span> {
<span style="color: #000000;background-color: #ffdddd">-    if (mode == capture)
-       printf("finish %d\n", 0);
</span><span style="color: #000000;background-color: #ddffdd">+    if (mode != none)
+       printf("finish %d\n", sig);
</span> 
<span style="color: #000000;background-color: #ffdddd">-    if (mode != replay) {
-       const char *sig_desc;
-
-       sig_desc = NULL;
-       sig_desc = strsignal(sig);
-       if (sig_desc == NULL)
-               sig_desc = "";
-       msyslog(LOG_NOTICE, "%s exiting on signal %d (%s)", progname,
-               sig, sig_desc);
-       /* See Bug 2513 and Bug 2522 re the unlink of PIDFILE */
-# if defined(HAVE_DNS_SD_H) && defined(ENABLE_MDNS_REGISTRATION)
-       if (mdns != NULL)
-               DNSServiceRefDeallocate(mdns);
-# endif
-       peer_cleanup();
-       exit(0);
-    }
-}
</span><span style="color: #000000;background-color: #ddffdd">+#if !defined(SIM) && defined(SIGDIE1)
+    extern void finish(int);   /* ugh */
+    finish(sig);
</span> #endif    /* !SIM && SIGDIE1 */
<span style="color: #000000;background-color: #ddffdd">+}
</span> 
 /* end */
</code></pre>

<br>
</li>
<li id='diff-1'>
<a href='https://gitlab.com/NTPsec/ntpsec/compare/9da2eff0ba84774de3379a26aa8d26c7a8c4c3bd...d96344411cc91969dcc1e742f64f8aba7802804d#diff-1'>
<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">@@ -1047,6 +1047,36 @@ ntpdmain(
</span> }
 #endif /* !SIM */
 
<span style="color: #000000;background-color: #ddffdd">+
+#if !defined(SIM) && defined(SIGDIE1)
+/*
+ * finish - exit gracefully
+ */
+void
+finish(
+       int sig
+       )
+{
+       const char *sig_desc;
+
+       intercept_log("event shutdown 0\n");
+       sig_desc = NULL;
+       sig_desc = strsignal(sig);
+       if (sig_desc == NULL)
+               sig_desc = "";
+       msyslog(LOG_NOTICE, "%s exiting on signal %d (%s)", progname,
+               sig, sig_desc);
+       /* See Bug 2513 and Bug 2522 re the unlink of PIDFILE */
+# if defined(HAVE_DNS_SD_H) && defined(ENABLE_MDNS_REGISTRATION)
+       if (mdns != NULL)
+               DNSServiceRefDeallocate(mdns);
+# endif
+       peer_cleanup();
+       exit(0);
+}
+#endif /* !SIM && SIGDIE1 */
+
+
</span> #ifndef SIM
 /*
  * wait_child_sync_if - implements parent side of -w/--wait-sync
</code></pre>

<br>
</li>

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

<br>
<a href="https://gitlab.com/NTPsec/ntpsec/compare/9da2eff0ba84774de3379a26aa8d26c7a8c4c3bd...d96344411cc91969dcc1e742f64f8aba7802804d">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":["merge_requests","issues","commit"],"url":"https://gitlab.com/NTPsec/ntpsec/compare/9da2eff0ba84774de3379a26aa8d26c7a8c4c3bd...d96344411cc91969dcc1e742f64f8aba7802804d"}}</script>
</p>
</div>
</body>
</html>