From 71aa36aa6e5477be5ed9bc97954da19c5885c933 Mon Sep 17 00:00:00 2001 From: Thomas Zajic Date: Tue, 29 Jul 2008 23:35:42 +0100 Subject: [PATCH] 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. --- client.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client.c b/client.c index 85d6e84..66f297f 100644 --- a/client.c +++ b/client.c @@ -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;