<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>
Hal Murray 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/fecbe68c35db3853ae06ba376e2ea03dee88e2ce">fecbe68c</a></strong>
<div>
<span>by Hal Murray</span>
<i>at 2016-01-16T18:44:54-08:00</i>
</div>
<pre class='commit-message'>Fix misleading error mesages from ./waf check</pre>
</li>
</ul>
<h4>4 changed files:</h4>
<ul>
<li class='file-stats'>
<a href='#diff-0'>
tests/common/sockaddrtest.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-1'>
tests/common/sockaddrtest.h
</a>
</li>
<li class='file-stats'>
<a href='#diff-2'>
tests/libntp/decodenetnum.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-3'>
tests/libntp/socktoa.c
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id='diff-0'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/fecbe68c35db3853ae06ba376e2ea03dee88e2ce#diff-0'>
<strong>
tests/common/sockaddrtest.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/tests/common/sockaddrtest.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/tests/common/sockaddrtest.c
</span><span style="color: #aaaaaa">@@ -35,6 +35,36 @@ bool IsEqualS(const sockaddr_u *expected, const sockaddr_u *actual) {
</span>   }
 }
 
<span style="color: #000000;background-color: #ddffdd">+/* Similar to IsEqualS, but doesn't print misleading messages */
+bool IsDiffS(const sockaddr_u *expected, const sockaddr_u *actual) {
+       if (expected->sa.sa_family != actual->sa.sa_family) {
+               return true;
+       }
+
+       if (actual->sa.sa_family == AF_INET) { // IPv4
+               if (expected->sa4.sin_port == actual->sa4.sin_port &&
+                       memcmp(&expected->sa4.sin_addr, &actual->sa4.sin_addr,
+                                  sizeof(in_addr_t)) == 0) {
+                       printf("IPv4 address matches: %u (%s)\n", expected->sa4.sin_addr.s_addr, socktoa(expected));
+                       return false;
+               } else {
+                       return true;
+               }
+       } else if (actual->sa.sa_family == AF_INET6) { //IPv6
+               if (expected->sa6.sin6_port == actual->sa6.sin6_port &&
+                       memcmp(&expected->sa6.sin6_addr, &actual->sa6.sin6_addr,
+                                  sizeof(struct in6_addr)) == 0) {
+                       printf("IPv6 address matches\n");
+                       return false;
+               } else {
+                       return true;
+               }
+       } else { // Unknown family
+               printf("Can't compare unknown address family\n");
+               return false;
+       }
+}
+
</span> sockaddr_u CreateSockaddr4(const char* address, unsigned int port) {
        sockaddr_u s;
        s.sa4.sin_family = AF_INET;
</code></pre>

<br>
</li>
<li id='diff-1'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/fecbe68c35db3853ae06ba376e2ea03dee88e2ce#diff-1'>
<strong>
tests/common/sockaddrtest.h
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/tests/common/sockaddrtest.h
</span><span style="color: #000000;background-color: #ddffdd">+++ b/tests/common/sockaddrtest.h
</span><span style="color: #aaaaaa">@@ -4,6 +4,7 @@
</span> #include "ntp.h"
 
 bool IsEqualS(const sockaddr_u *expected, const sockaddr_u *actual);
<span style="color: #000000;background-color: #ddffdd">+bool IsDiffS(const sockaddr_u *expected, const sockaddr_u *actual);
</span> sockaddr_u CreateSockaddr4(const char* address, unsigned int port);
 
 
</code></pre>

<br>
</li>
<li id='diff-2'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/fecbe68c35db3853ae06ba376e2ea03dee88e2ce#diff-2'>
<strong>
tests/libntp/decodenetnum.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/tests/libntp/decodenetnum.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/tests/libntp/decodenetnum.c
</span><span style="color: #aaaaaa">@@ -99,7 +99,7 @@ TEST(decodenetnum, IllegalCharInPort) {
</span>   SET_PORT(&expected, NTP_PORT);
 
        TEST_ASSERT_FALSE(decodenetnum(str, &actual));
<span style="color: #000000;background-color: #ffdddd">-        TEST_ASSERT_FALSE(IsEqualS(&expected, &actual));
</span><span style="color: #000000;background-color: #ddffdd">+   TEST_ASSERT_TRUE(IsDiffS(&expected, &actual));
</span> }
 
 TEST_GROUP_RUNNER(decodenetnum) {
</code></pre>

<br>
</li>
<li id='diff-3'>
<a href='https://gitlab.com/NTPsec/ntpsec/commit/fecbe68c35db3853ae06ba376e2ea03dee88e2ce#diff-3'>
<strong>
tests/libntp/socktoa.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/tests/libntp/socktoa.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/tests/libntp/socktoa.c
</span><span style="color: #aaaaaa">@@ -82,7 +82,7 @@ TEST(socktoa, HashNotEqual) {
</span>   sockaddr_u input1 = CreateSockaddr4("192.0.2.1", 123);
        sockaddr_u input2 = CreateSockaddr4("192.0.2.2", 123);
 
<span style="color: #000000;background-color: #ffdddd">-        TEST_ASSERT_FALSE(IsEqualS(&input1, &input2));
</span><span style="color: #000000;background-color: #ddffdd">+   TEST_ASSERT_TRUE(IsDiffS(&input1, &input2));
</span>   TEST_ASSERT_NOT_EQUAL(sock_hash(&input1), sock_hash(&input2));
 }
 
</code></pre>

<br>
</li>

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

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