]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 2072] Orphan parent selection metric needs ntohl().
authorDave Hart <hart@ntp.org>
Sun, 27 Nov 2011 00:39:11 +0000 (00:39 +0000)
committerDave Hart <hart@ntp.org>
Sun, 27 Nov 2011 00:39:11 +0000 (00:39 +0000)
bk: 4ed186af4FZG9_UE-EyiYs3bSV7f2g

ChangeLog
libntp/a_md5encrypt.c
ntpd/ntp_proto.c

index b81fa6d8d8dc6d37141b1d53731da0db2b11e459..ce47bd3d46db4a680be80ebbe05ca0e33d2af824 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 ---
 
 * [Bug 2050] Orphan mode stratum counting to infinity.
+* [Bug 2072] Orphan parent selection metric needs ntohl().
 
 ---
 (4.2.6p5-RC1) 2011/10/18 Released by Harlan Stenn <stenn@ntp.org>
index 05c109a9ff175758335d1691639bc6fdd392a290..fe5dbb0d464ad7af31aac209dcf287df73e45f41 100644 (file)
@@ -87,6 +87,7 @@ MD5authdecrypt(
  * Calculate the reference id from the address. If it is an IPv4
  * address, use it as is. If it is an IPv6 address, do a md5 on
  * it and use the bottom 4 bytes.
+ * The result is in network byte order.
  */
 u_int32
 addr2refid(sockaddr_u *addr)
index 55177915daf61052a9e1aef9a5a3ca5df9c0852f..82ca05e4a2ba02874937badf437ae9bae10ddaaf 100644 (file)
@@ -2291,10 +2291,10 @@ clock_select(void)
                         */
                        if (peer->stratum == sys_orphan) {
                                u_int32 localmet;
-                               u_int32 peermet;
+                               u_int32 peermet;
 
-                               localmet = peer->dstadr->addr_refid;
-                               peermet = addr2refid(&peer->srcadr);
+                               localmet = ntohl(peer->dstadr->addr_refid);
+                               peermet = ntohl(addr2refid(&peer->srcadr));
                                if (peermet < localmet &&
                                    peermet < orphmet) {
                                        typeorphan = peer;