Fix IP addressing in chronyc

Thomas wrote:
I found a bug in the chrony client (chronyc) that affects its ability to talk
to remote hosts over the control port (323/udp).

For example, running "chronyc -h 192.168.1.3 sources -v" would just sit there
and hang, and eventually timeout. I found out with tcpdump that chronyc
actually tries to connect to 255.168.1.3 instead of 192.168.1.3.
This commit is contained in:
Thomas Zajic 2008-07-29 23:35:42 +01:00 committed by Richard P. Curnow
parent 2f2446c7dc
commit 71aa36aa6e

View file

@ -163,10 +163,10 @@ get_address(const char *hostname)
exit(1);
} else {
address0 = host->h_addr_list[0];
result = ((((unsigned long) address0[0]) << 24) |
(((unsigned long) address0[1]) << 16) |
(((unsigned long) address0[2]) << 8) |
(((unsigned long) address0[3])));
result = ((((unsigned long) address0[0] & 0xff) << 24) |
(((unsigned long) address0[1] & 0xff) << 16) |
(((unsigned long) address0[2] & 0xff) << 8) |
(((unsigned long) address0[3] & 0xff)));
}
return result;