<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/95c15ce471e25d7d442d30e50fff29fbc07c7dd4">95c15ce4</a></strong>
<div>
<span>by Eric S. Raymond</span>
<i>at 2015-12-31T00:30:17Z</i>
</div>
<pre class='commit-message'>Replay - make synchronous lookup an intercept point.</pre>
</li>
</ul>
<h4>3 changed files:</h4>
<ul>
<li class='file-stats'>
<a href='#diff-0'>
ntpd/ntp_config.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-1'>
ntpd/ntp_intercept.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-2'>
ntpd/ntp_intercept.h
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id='diff-0'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/95c15ce471e25d7d442d30e50fff29fbc07c7dd4#diff-0'>
<strong>
ntpd/ntp_config.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/ntpd/ntp_config.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/ntpd/ntp_config.c
</span><span style="color: #aaaaaa">@@ -3688,40 +3688,6 @@ peerflag_bits(
</span>   return peerflags;
 }
 
<span style="color: #000000;background-color: #ffdddd">-static bool sync_lookup(char *hname, sockaddr_u *peeraddrp)
-{
-       int a_info;
-       size_t octets;
-       struct addrinfo         hints, *res;
-
-       ZERO(hints);
-       hints.ai_family = AF_UNSPEC;
-       hints.ai_socktype = SOCK_DGRAM;
-       hints.ai_protocol = IPPROTO_UDP;
-       a_info = getaddrinfo(hname, "ntp", &hints, &res);
-       if (a_info == EAI_NONAME
-#ifdef EAI_NODATA
-           || a_info == EAI_NODATA
-#endif
-          ) {
-               hints.ai_flags = AI_CANONNAME;
-               hints.ai_flags |= AI_ADDRCONFIG;
-               a_info = getaddrinfo(hname, "ntp", &hints, &res);
-       }
-       if (a_info != 0) {
-               msyslog(LOG_ERR,
-                       "hostname %s can not be used (%s), please use IP address.",
-                       hname, gai_strerror(a_info));
-               return false;
-       } else {
-               INSIST(res != NULL);
-               memset(peeraddrp, '\0', sizeof(*peeraddrp));
-               octets = min(sizeof(*peeraddrp), res->ai_addrlen);
-               memcpy(peeraddrp, res->ai_addr, octets);
-               return true;
-       }
-}
-
</span> static void
 config_peers(
        config_tree *ptree
<span style="color: #aaaaaa">@@ -3763,7 +3729,7 @@ config_peers(
</span>                                   0,
                                        NULL);
                } else if (force_synchronous_dns) {
<span style="color: #000000;background-color: #ffdddd">-                        if (sync_lookup(*cmdline_servers, &peeraddr)) {
</span><span style="color: #000000;background-color: #ddffdd">+                   if (intercept_getaddrinfo(*cmdline_servers, &peeraddr)) {
</span>                           peer_config(
                                        &peeraddr,
                                        NULL,
<span style="color: #aaaaaa">@@ -3853,7 +3819,7 @@ config_peers(
</span>            * synchronous lookup may be forced.
                 */
                } else if (force_synchronous_dns) {
<span style="color: #000000;background-color: #ffdddd">-                        if (sync_lookup(curr_peer->addr->address, &peeraddr)) {
</span><span style="color: #000000;background-color: #ddffdd">+                   if (intercept_getaddrinfo(curr_peer->addr->address, &peeraddr)) {
</span>                           peer_config(
                                        &peeraddr,
                                        NULL,
</code></pre>

<br>
</li>
<li id='diff-1'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/95c15ce471e25d7d442d30e50fff29fbc07c7dd4#diff-1'>
<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">@@ -238,6 +238,40 @@ static void file_replay(const char *configfile, char *delimiter, char *tempfile)
</span>     fclose(tfp);
 }
 
<span style="color: #000000;background-color: #ddffdd">+bool intercept_getaddrinfo(char *hname, sockaddr_u *peeraddrp)
+{
+       int a_info;
+       size_t octets;
+       struct addrinfo         hints, *res;
+
+       ZERO(hints);
+       hints.ai_family = AF_UNSPEC;
+       hints.ai_socktype = SOCK_DGRAM;
+       hints.ai_protocol = IPPROTO_UDP;
+       a_info = getaddrinfo(hname, "ntp", &hints, &res);
+       if (a_info == EAI_NONAME
+#ifdef EAI_NODATA
+           || a_info == EAI_NODATA
+#endif
+          ) {
+               hints.ai_flags = AI_CANONNAME;
+               hints.ai_flags |= AI_ADDRCONFIG;
+               a_info = getaddrinfo(hname, "ntp", &hints, &res);
+       }
+       if (a_info != 0) {
+               msyslog(LOG_ERR,
+                       "hostname %s can not be used (%s), please use IP address.",
+                       hname, gai_strerror(a_info));
+               return false;
+       } else {
+               INSIST(res != NULL);
+               memset(peeraddrp, '\0', sizeof(*peeraddrp));
+               octets = min(sizeof(*peeraddrp), res->ai_addrlen);
+               memcpy(peeraddrp, res->ai_addr, octets);
+               return true;
+       }
+}
+
</span> void intercept_getconfig(const char *configfile)
 {
     if (mode == replay) {
</code></pre>

<br>
</li>
<li id='diff-2'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/95c15ce471e25d7d442d30e50fff29fbc07c7dd4#diff-2'>
<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">@@ -17,6 +17,7 @@ intercept_mode intercept_get_mode(void);
</span> void intercept_set_mode(intercept_mode);
 
 void intercept_argparse(int *, char ***);
<span style="color: #000000;background-color: #ddffdd">+bool intercept_getaddrinfo(char *, sockaddr_u *);
</span> void intercept_getconfig(const char *);
 void intercept_get_systime(const char *, l_fp *);
 long intercept_ntp_random(const char *);
</code></pre>

<br>
</li>

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

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