aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2011-08-24 11:56:53 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2011-08-24 11:56:53 +0000
commit7b01fd486c85eee5c5a3c9438fdc879063061af5 (patch)
treeb5c56bac1cb4f55b585b6e7456951470fcc315d7
parent96fe7d3661d0ea57b367d6daad2ea61f82ebeb94 (diff)
downloadalpine_aports-7b01fd486c85eee5c5a3c9438fdc879063061af5.tar.bz2
alpine_aports-7b01fd486c85eee5c5a3c9438fdc879063061af5.tar.xz
alpine_aports-7b01fd486c85eee5c5a3c9438fdc879063061af5.zip
main/chrony: upgrade to 1.26
-rw-r--r--main/chrony/APKBUILD24
-rw-r--r--main/chrony/chrony-1.20-chrony.conf.example-gentoo.diff46
-rw-r--r--main/chrony/chrony-1.20-conf.c-gentoo.diff11
-rw-r--r--main/chrony/chrony-1.21-makefile.diff15
-rw-r--r--main/chrony/chrony-1.23-reply-ip.diff242
-rw-r--r--main/chrony/chrony-1.23-sources.diff56
6 files changed, 7 insertions, 387 deletions
diff --git a/main/chrony/APKBUILD b/main/chrony/APKBUILD
index bfe76062bb..32a74e00fe 100644
--- a/main/chrony/APKBUILD
+++ b/main/chrony/APKBUILD
@@ -1,7 +1,7 @@
1# Maintainer: Natanael Copa <ncopa@alpinelinux.org> 1# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2pkgname=chrony 2pkgname=chrony
3pkgver=1.23 3pkgver=1.26
4pkgrel=8 4pkgrel=0
5pkgdesc="NTP client and server programs" 5pkgdesc="NTP client and server programs"
6url="http://chrony.tuxfamily.org/" 6url="http://chrony.tuxfamily.org/"
7arch="all" 7arch="all"
@@ -10,11 +10,6 @@ depends="logrotate"
10makedepends="texinfo" 10makedepends="texinfo"
11subpackages="$pkgname-doc" 11subpackages="$pkgname-doc"
12source="http://download.tuxfamily.org/chrony/$pkgname-$pkgver.tar.gz 12source="http://download.tuxfamily.org/chrony/$pkgname-$pkgver.tar.gz
13 $pkgname-1.20-conf.c-gentoo.diff
14 $pkgname-1.20-chrony.conf.example-gentoo.diff
15 $pkgname-1.21-makefile.diff
16 $pkgname-1.23-sources.diff
17 $pkgname-1.23-reply-ip.diff
18 chronyd.confd 13 chronyd.confd
19 chronyd.initd 14 chronyd.initd
20 chrony.logrotate 15 chrony.logrotate
@@ -26,9 +21,10 @@ prepare() {
26 local i 21 local i
27 cd "$_builddir" 22 cd "$_builddir"
28 23
29 for i in ../*.diff; do 24 for i in $source; do
30 msg "Applying $i" 25 case $i in
31 patch -p1 < $i || return 1 26 *.diff|*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1
27 esac
32 done 28 done
33 sed -i "s:/etc/chrony:/etc/chrony/chrony:g" \ 29 sed -i "s:/etc/chrony:/etc/chrony/chrony:g" \
34 chrony*.[158] faq.txt chrony.texi || die "sed failed" 30 chrony*.[158] faq.txt chrony.texi || die "sed failed"
@@ -48,7 +44,6 @@ package() {
48 cd "$_builddir" 44 cd "$_builddir"
49 make DESTDIR="$pkgdir" install 45 make DESTDIR="$pkgdir" install
50 46
51 mv "$pkgdir"/usr/doc "$pkgdir"/usr/share/
52 install -D -m644 examples/*.example "$pkgdir"/usr/share/doc/chrony/ 47 install -D -m644 examples/*.example "$pkgdir"/usr/share/doc/chrony/
53 48
54 install -m755 -D "$srcdir"/chronyd.initd "$pkgdir"/etc/init.d/chronyd 49 install -m755 -D "$srcdir"/chronyd.initd "$pkgdir"/etc/init.d/chronyd
@@ -59,12 +54,7 @@ package() {
59 touch "$pkgdir"/etc/chrony/chrony.drift 54 touch "$pkgdir"/etc/chrony/chrony.drift
60 install -m644 "$srcdir"/chrony.conf "$pkgdir"/etc/chrony/chrony.conf 55 install -m644 "$srcdir"/chrony.conf "$pkgdir"/etc/chrony/chrony.conf
61} 56}
62md5sums="ffce77695e55d8efda19ab0b78309c23 chrony-1.23.tar.gz 57md5sums="ad6dd619ff1986e4ff780363c64e2246 chrony-1.26.tar.gz
63bd6bd57363865d3ed0c3187d0c9f7151 chrony-1.20-conf.c-gentoo.diff
64b2a23e02f7af50bebdd5d18bccdedbf0 chrony-1.20-chrony.conf.example-gentoo.diff
65d47015a34b6b2f9eebca77ef939cec72 chrony-1.21-makefile.diff
6639cbce9f66638b67623e1ee6bb0f943f chrony-1.23-sources.diff
67caa6589a1a1cd56f64957e312d1ef84c chrony-1.23-reply-ip.diff
68d62521b4c8837e15262c47ac88359307 chronyd.confd 58d62521b4c8837e15262c47ac88359307 chronyd.confd
69f0c73948224cc1706cf9c94e4d2d7b69 chronyd.initd 59f0c73948224cc1706cf9c94e4d2d7b69 chronyd.initd
70468eaf2b5465d60b3ee021ce3f948ab1 chrony.logrotate 60468eaf2b5465d60b3ee021ce3f948ab1 chrony.logrotate
diff --git a/main/chrony/chrony-1.20-chrony.conf.example-gentoo.diff b/main/chrony/chrony-1.20-chrony.conf.example-gentoo.diff
deleted file mode 100644
index 498b241750..0000000000
--- a/main/chrony/chrony-1.20-chrony.conf.example-gentoo.diff
+++ /dev/null
@@ -1,46 +0,0 @@
1--- a/examples/chrony.conf.example.orig 2003-06-16 11:59:01.000000000 -0400
2+++ b/examples/chrony.conf.example 2003-06-16 12:00:13.000000000 -0400
3@@ -3,5 +3,5 @@
4 #
5 # This is an example chrony configuration file. You should copy it to
6-# /etc/chrony.conf after uncommenting and editing the options that you
7+# /etc/chrony/chrony.conf after uncommenting and editing the options that you
8 # want to enable. I have not included the more obscure options. Refer
9 # to the documentation for these.
10@@ -91,5 +91,5 @@
11 # generally want this, so it is uncommented.
12
13-driftfile /etc/chrony.drift
14+driftfile /etc/chrony/chrony.drift
15
16 # If you want to use the program called chronyc to configure aspects of
17@@ -100,5 +100,5 @@
18 # assumed by default.
19
20-keyfile /etc/chrony.keys
21+keyfile /etc/chrony/chrony.keys
22
23 # Tell chronyd which numbered key in the file is used as the password
24@@ -158,6 +158,6 @@
25 ! log measurements statistics tracking
26
27-If you have real time clock support enabled (see below), you might want
28-this line instead:
29+# If you have real time clock support enabled (see below), you might want
30+# this line instead:
31
32 ! log measurements statistics tracking rtc
33@@ -269,5 +269,5 @@
34 # kernel. (Note, these options apply only to Linux.)
35
36-! rtcfile /etc/chrony.rtc
37+! rtcfile /etc/chrony/chrony.rtc
38
39 # Your RTC can be set to keep Universal Coordinated Time (UTC) or local
40@@ -285,5 +285,5 @@
41 # using devfs), uncomment and edit the following line.
42
43-! rtcdevice /dev/misc/rtc
44+rtcdevice /dev/misc/rtc
45
46 #######################################################################
diff --git a/main/chrony/chrony-1.20-conf.c-gentoo.diff b/main/chrony/chrony-1.20-conf.c-gentoo.diff
deleted file mode 100644
index 4917d445be..0000000000
--- a/main/chrony/chrony-1.20-conf.c-gentoo.diff
+++ /dev/null
@@ -1,11 +0,0 @@
1--- a/conf.c.orig Sun May 12 14:07:31 2002
2+++ b/conf.c Sun May 12 14:07:52 2002
3@@ -45,7 +45,7 @@
4
5 /* ================================================== */
6
7-#define DEFAULT_CONF_FILE "/etc/chrony.conf"
8+#define DEFAULT_CONF_FILE "/etc/chrony/chrony.conf"
9
10 /* ================================================== */
11 /* Forward prototypes */
diff --git a/main/chrony/chrony-1.21-makefile.diff b/main/chrony/chrony-1.21-makefile.diff
deleted file mode 100644
index 2eec4e8428..0000000000
--- a/main/chrony/chrony-1.21-makefile.diff
+++ /dev/null
@@ -1,15 +0,0 @@
1--- a/Makefile.in_old 2006-08-12 17:42:57.000000000 +0200
2+++ b/Makefile.in 2006-08-12 17:44:35.000000000 +0200
3@@ -68,10 +68,10 @@
4 all : chronyd chronyc
5
6 chronyd : $(OBJS) $(EXTRA_OBJS)
7- $(CC) $(OPTFLAGS) -o chronyd $(OBJS) $(EXTRA_OBJS) $(LIBS) $(EXTRA_LIBS)
8+ $(CC) $(OPTFLAGS) $(LDFLAGS) -o chronyd $(OBJS) $(EXTRA_OBJS) $(LIBS) $(EXTRA_LIBS)
9
10 chronyc : $(CLI_OBJS)
11- $(CC) $(OPTFLAGS) -o chronyc $(CLI_OBJS) @READLINE_LINK@ $(LIBS) $(EXTRA_CLI_LIBS)
12+ $(CC) $(OPTFLAGS) $(LDFLAGS) -o chronyc $(CLI_OBJS) @READLINE_LINK@ $(LIBS) $(EXTRA_CLI_LIBS)
13
14 client.o : client.c
15 $(CC) $(CFLAGS) $(DEFS) @READLINE_COMPILE@ -c $<
diff --git a/main/chrony/chrony-1.23-reply-ip.diff b/main/chrony/chrony-1.23-reply-ip.diff
deleted file mode 100644
index f4e5d8eff4..0000000000
--- a/main/chrony/chrony-1.23-reply-ip.diff
+++ /dev/null
@@ -1,242 +0,0 @@
1
2Currently, on multihomed host, when chrony is not bound to a specific
3IP address, a query is sent to an interface and the default source IP
4hint for the back route differs, the reply will have a source IP
5different than where the query was destinied to. This will cause
6problems because connection tracking firewalls will drop the replies
7and most likely the client program will get confused too.
8
9This patch uses the IP_PKTINFO mechanism to get the IP address where
10received packets where targetted to and use that IP address as source
11hint when sending a reply.
12---
13 addressing.h | 1 +
14 broadcast.c | 1 +
15 cmdmon.c | 3 ++
16 conf.c | 1 +
17 ntp_io.c | 92 +++++++++++++++++++++++++++++++++++++++++----------------
18 5 files changed, 72 insertions(+), 26 deletions(-)
19
20diff --git a/addressing.h b/addressing.h
21index aa20ed9..05152f4 100644
22--- a/addressing.h
23+++ b/addressing.h
24@@ -36,6 +36,7 @@
25 typedef struct {
26 unsigned long ip_addr;
27 unsigned short port;
28+ unsigned long local_ip_addr;
29 } NTP_Remote_Address;
30
31 #if 0
32diff --git a/broadcast.c b/broadcast.c
33index be217e7..c979741 100644
34--- a/broadcast.c
35+++ b/broadcast.c
36@@ -146,6 +146,7 @@ BRD_AddDestination(unsigned long addr, unsigned short port, int interval)
37
38 destinations[n_destinations].addr.ip_addr = addr;
39 destinations[n_destinations].addr.port = port;
40+ destinations[n_destinations].addr.local_ip_addr = 0;
41 destinations[n_destinations].interval = interval;
42
43 SCH_AddTimeoutInClass((double) interval, 1.0,
44diff --git a/cmdmon.c b/cmdmon.c
45index 819977c..8affb0b 100644
46--- a/cmdmon.c
47+++ b/cmdmon.c
48@@ -1097,6 +1097,7 @@ handle_add_server(CMD_Request *rx_message, CMD_Reply *tx_message)
49
50 rem_addr.ip_addr = ntohl(rx_message->data.ntp_source.ip_addr);
51 rem_addr.port = (unsigned short)(ntohl(rx_message->data.ntp_source.port));
52+ rem_addr.local_ip_addr = 0;
53 params.minpoll = ntohl(rx_message->data.ntp_source.minpoll);
54 params.maxpoll = ntohl(rx_message->data.ntp_source.maxpoll);
55 params.presend_minpoll = ntohl(rx_message->data.ntp_source.presend_minpoll);
56@@ -1133,6 +1134,7 @@ handle_add_peer(CMD_Request *rx_message, CMD_Reply *tx_message)
57
58 rem_addr.ip_addr = ntohl(rx_message->data.ntp_source.ip_addr);
59 rem_addr.port = (unsigned short)(ntohl(rx_message->data.ntp_source.port));
60+ rem_addr.local_ip_addr = 0;
61 params.minpoll = ntohl(rx_message->data.ntp_source.minpoll);
62 params.maxpoll = ntohl(rx_message->data.ntp_source.maxpoll);
63 params.presend_minpoll = ntohl(rx_message->data.ntp_source.presend_minpoll);
64@@ -1167,6 +1169,7 @@ handle_del_source(CMD_Request *rx_message, CMD_Reply *tx_message)
65
66 rem_addr.ip_addr = ntohl(rx_message->data.del_source.ip_addr);
67 rem_addr.port = 0;
68+ rem_addr.local_ip_addr = 0;
69
70 status = NSR_RemoveSource(&rem_addr);
71 switch (status) {
72diff --git a/conf.c b/conf.c
73index e34927e..ddd13f1 100644
74--- a/conf.c
75+++ b/conf.c
76@@ -949,6 +949,7 @@ CNF_AddSources(void) {
77 for (i=0; i<n_ntp_sources; i++) {
78 server.ip_addr = ntp_sources[i].ip_addr;
79 server.port = ntp_sources[i].port;
80+ server.local_ip_addr = 0;
81
82 switch (ntp_sources[i].type) {
83 case SERVER:
84diff --git a/ntp_io.c b/ntp_io.c
85index afb6ad1..db89758 100644
86--- a/ntp_io.c
87+++ b/ntp_io.c
88@@ -118,6 +118,12 @@ NIO_Initialise(void)
89 LOG(LOGS_ERR, LOGF_NtpIO, "Could not set broadcast socket options");
90 /* Don't quit - we might survive anyway */
91 }
92+ /* We want the local IP info too */
93+ if (setsockopt(sock_fd, IPPROTO_IP, IP_PKTINFO, (char *)&on_off, sizeof(on_off)) < 0) {
94+ LOG(LOGS_ERR, LOGF_NtpIO, "Could not request packet info using socket option");
95+ /* Don't quit - we might survive anyway */
96+ }
97+
98
99 /* Bind the port */
100 my_addr.sin_family = AF_INET;
101@@ -182,22 +188,30 @@ read_from_socket(void *anything)
102
103 int status;
104 ReceiveBuffer message;
105- int message_length;
106 struct sockaddr_in where_from;
107- socklen_t from_length;
108 unsigned int flags = 0;
109 struct timeval now;
110 NTP_Remote_Address remote_addr;
111 double local_clock_err;
112+ char cmsgbuf[256];
113+ struct cmsghdr *cmsg;
114+ struct msghdr msg;
115+ struct iovec iov;
116
117 assert(initialised);
118
119- from_length = sizeof(where_from);
120- message_length = sizeof(message);
121+ iov.iov_base = message.arbitrary;
122+ iov.iov_len = sizeof(message);
123+ msg.msg_name = &where_from;
124+ msg.msg_namelen = sizeof(where_from);
125+ msg.msg_iov = &iov;
126+ msg.msg_iovlen = 1;
127+ msg.msg_control = (void *) cmsgbuf;
128+ msg.msg_controllen = sizeof(cmsgbuf);
129+ msg.msg_flags = 0;
130
131 LCL_ReadCookedTime(&now, &local_clock_err);
132- status = recvfrom(sock_fd, (char *)&message, message_length, flags,
133- (struct sockaddr *)&where_from, &from_length);
134+ status = recvmsg(sock_fd, &msg, flags);
135
136 /* Don't bother checking if read failed or why if it did. More
137 likely than not, it will be connection refused, resulting from a
138@@ -209,6 +223,13 @@ read_from_socket(void *anything)
139 if (status > 0) {
140 remote_addr.ip_addr = ntohl(where_from.sin_addr.s_addr);
141 remote_addr.port = ntohs(where_from.sin_port);
142+ remote_addr.local_ip_addr = 0;
143+
144+ for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
145+ if (cmsg->cmsg_level == IPPROTO_IP && cmsg->cmsg_type == IP_PKTINFO)
146+ remote_addr.local_ip_addr =
147+ ntohl(((struct in_pktinfo *) CMSG_DATA(cmsg))->ipi_spec_dst.s_addr);
148+ }
149
150 if (status == NTP_NORMAL_PACKET_SIZE) {
151
152@@ -229,21 +250,45 @@ read_from_socket(void *anything)
153 }
154
155 /* ================================================== */
156-/* Send an unauthenticated packet to a given address */
157+/* Send a packet to given address */
158
159-void
160-NIO_SendNormalPacket(NTP_Packet *packet, NTP_Remote_Address *remote_addr)
161+static void
162+NIO_SendPacket(NTP_Packet *packet, int packetlen, NTP_Remote_Address *remote_addr)
163 {
164 struct sockaddr_in remote;
165+ struct msghdr msg;
166+ struct iovec iov;
167+ struct {
168+ struct cmsghdr cm;
169+ struct in_pktinfo ipi;
170+ } cmsg;
171
172 assert(initialised);
173
174 remote.sin_family = AF_INET;
175 remote.sin_port = htons(remote_addr->port);
176 remote.sin_addr.s_addr = htonl(remote_addr->ip_addr);
177+ iov.iov_base = (void *) packet;
178+ iov.iov_len = packetlen;
179+ msg.msg_name = &remote;
180+ msg.msg_namelen = sizeof(remote);
181+ msg.msg_iov = &iov;
182+ msg.msg_iovlen = 1;
183+ if (remote_addr->local_ip_addr) {
184+ cmsg.cm.cmsg_len = sizeof(cmsg);
185+ cmsg.cm.cmsg_level = IPPROTO_IP;
186+ cmsg.cm.cmsg_type = IP_PKTINFO;
187+ memset(&cmsg.ipi, 0, sizeof(cmsg.ipi));
188+ cmsg.ipi.ipi_spec_dst.s_addr = htonl(remote_addr->local_ip_addr);
189+ msg.msg_control = (void *) &cmsg;
190+ msg.msg_controllen = sizeof(cmsg);
191+ } else {
192+ msg.msg_control = NULL;
193+ msg.msg_controllen = 0;
194+ }
195+ msg.msg_flags = 0;
196
197- if (sendto(sock_fd, (void *) packet, NTP_NORMAL_PACKET_SIZE, 0,
198- (struct sockaddr *) &remote, sizeof(remote)) < 0) {
199+ if (sendmsg(sock_fd, &msg, 0) < 0) {
200 LOG(LOGS_WARN, LOGF_NtpIO, "Could not send to %s:%d : %s",
201 UTI_IPToDottedQuad(remote_addr->ip_addr), remote_addr->port, strerror(errno));
202 }
203@@ -252,26 +297,21 @@ NIO_SendNormalPacket(NTP_Packet *packet, NTP_Remote_Address *remote_addr)
204 }
205
206 /* ================================================== */
207-/* Send an authenticated packet to a given address */
208+/* Send an unauthenticated packet to a given address */
209
210 void
211-NIO_SendAuthenticatedPacket(NTP_Packet *packet, NTP_Remote_Address *remote_addr)
212+NIO_SendNormalPacket(NTP_Packet *packet, NTP_Remote_Address *remote_addr)
213 {
214- struct sockaddr_in remote;
215-
216- assert(initialised);
217-
218- remote.sin_family = AF_INET;
219- remote.sin_port = htons(remote_addr->port);
220- remote.sin_addr.s_addr = htonl(remote_addr->ip_addr);
221+ NIO_SendPacket(packet, NTP_NORMAL_PACKET_SIZE, remote_addr);
222+}
223
224- if (sendto(sock_fd, (void *) packet, sizeof(NTP_Packet), 0,
225- (struct sockaddr *) &remote, sizeof(remote)) < 0) {
226- LOG(LOGS_WARN, LOGF_NtpIO, "Could not send to %s:%d : %s",
227- UTI_IPToDottedQuad(remote_addr->ip_addr), remote_addr->port, strerror(errno));
228- }
229+/* ================================================== */
230+/* Send an authenticated packet to a given address */
231
232- return;
233+void
234+NIO_SendAuthenticatedPacket(NTP_Packet *packet, NTP_Remote_Address *remote_addr)
235+{
236+ NIO_SendPacket(packet, sizeof(NTP_Packet), remote_addr);
237 }
238
239 /* ================================================== */
240--
2411.5.6.3
242
diff --git a/main/chrony/chrony-1.23-sources.diff b/main/chrony/chrony-1.23-sources.diff
deleted file mode 100644
index 5f39ca3321..0000000000
--- a/main/chrony/chrony-1.23-sources.diff
+++ /dev/null
@@ -1,56 +0,0 @@
1commit 2f2446c7dc074b2d1728a5e3f7a600c10cea2425
2Author: Goswin Brederlow <brederlo@informatik.uni-tuebingen.de>
3Date: Sat Mar 29 20:49:59 2008 +0000
4
5 Fix for chronyc "sources" command on 64 bit machines
6
7 (Taken from
8 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=348412
9 )
10
11 Attached is a patchlet to make the "sources" command of chrony output properly
12 signed numbers. The chronyd code (see e.g. ntp.h) properly uses int32_t and
13 friends to get the right number of bits per datatype while client.c just uses
14 short, int, long. But long will be 64 bit or 32 bit depending on the cpu.
15
16diff --git a/client.c b/client.c
17index b7e5bcb..85d6e84 100644
18--- a/client.c
19+++ b/client.c
20@@ -45,6 +45,12 @@
21 #include <readline/history.h>
22 #endif
23
24+#ifdef HAS_STDINT_H
25+#include <stdint.h>
26+#elif defined(HAS_INTTYPES_H)
27+#include <inttypes.h>
28+#endif
29+
30 /* ================================================== */
31
32 static int sock_fd;
33@@ -1383,16 +1389,16 @@ process_cmd_sources(char *line)
34 int n_sources, i;
35 int verbose = 0;
36
37- long orig_latest_meas, latest_meas, est_offset;
38- unsigned long ip_addr;
39- unsigned long latest_meas_err, est_offset_err;
40- unsigned long latest_meas_ago;
41- unsigned short poll, stratum;
42- unsigned short state, mode;
43+ int32_t orig_latest_meas, latest_meas, est_offset;
44+ uint32_t ip_addr;
45+ uint32_t latest_meas_err, est_offset_err;
46+ uint32_t latest_meas_ago;
47+ uint16_t poll, stratum;
48+ uint16_t state, mode;
49 double resid_freq, resid_skew;
50 const char *dns_lookup;
51 char hostname_buf[32];
52- unsigned short status;
53+ uint16_t status;
54
55 /* Check whether to output verbose headers */
56 verbose = check_for_verbose_flag(line);