summaryrefslogtreecommitdiffstats
path: root/main/openntpd
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2015-04-30 12:32:56 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2015-04-30 12:32:56 +0000
commit89ec07746225ae1f45cb7582198340ffd1891f25 (patch)
tree7bc186417991947b74fb6d20384f441769d9f7d8 /main/openntpd
parent0abd7848ce2b314efe1684443b080882a5d80a4f (diff)
downloadaports-89ec07746225ae1f45cb7582198340ffd1891f25.tar.bz2
aports-89ec07746225ae1f45cb7582198340ffd1891f25.tar.xz
main/openntpd: upgrade to 5.7_p1
Diffstat (limited to 'main/openntpd')
-rw-r--r--main/openntpd/APKBUILD42
-rw-r--r--main/openntpd/adjtimex.patch29
-rw-r--r--main/openntpd/fix-cdecls.patch56
-rw-r--r--main/openntpd/openntpd-3.9p1_reconnect_on_sendto_EINVAL.diff43
4 files changed, 111 insertions, 59 deletions
diff --git a/main/openntpd/APKBUILD b/main/openntpd/APKBUILD
index d8c57965e..70c9a847b 100644
--- a/main/openntpd/APKBUILD
+++ b/main/openntpd/APKBUILD
@@ -1,37 +1,44 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=openntpd
-pkgver=3.9_p1
-_myver=3.9p1
-pkgrel=12
+pkgver=5.7_p1
+_myver=${pkgver/_/}
+pkgrel=0
pkgdesc="Lightweight NTP server ported from OpenBSD"
url=http://www.openntpd.org/
install="$pkgname.pre-install $pkgname.pre-upgrade $pkgname.post-upgrade"
subpackages="openntpd-doc"
depends=
-makedepends="openssl-dev"
+makedepends="openssl-dev linux-headers bsd-compat-headers"
arch="all"
license=BSD
source="
ftp://ftp.openbsd.org/pub/OpenBSD/OpenNTPD/openntpd-$_myver.tar.gz
- openntpd-3.9p1_reconnect_on_sendto_EINVAL.diff
+ fix-cdecls.patch
+ adjtimex.patch
openntpd.confd
openntpd.initd
"
+_builddir="$srcdir"/openntpd-$_myver
prepare() {
- cd "$srcdir/$pkgname-$_myver"
- patch -p1 < ../openntpd-3.9p1_reconnect_on_sendto_EINVAL.diff
+ local i
+ cd "$_builddir"
+ for i in $source; do
+ case $i in
+ *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+ esac
+ done
sed -i '/NTPD_USER/s:_ntp:ntp:' ntpd.h || return 1
- update_config_sub || return 1
}
build() {
- cd "$srcdir/$pkgname-$_myver"
+ cd "$_builddir"
./configure \
--build=$CBUILD \
--host=$CHOST \
--prefix=/usr \
+ --localstatedir=/var \
--mandir=/usr/share/man \
--sysconfdir=/etc \
|| return 1
@@ -39,21 +46,24 @@ build() {
}
package() {
- cd "$srcdir/$pkgname-$_myver"
+ cd "$_builddir"
make install DESTDIR="$pkgdir"
install -Dm755 ../openntpd.initd "$pkgdir/etc/init.d/$pkgname"
install -Dm644 ../openntpd.confd "$pkgdir/etc/conf.d/$pkgname"
}
-md5sums="afc34175f38d08867c1403d9008600b3 openntpd-3.9p1.tar.gz
-ae2f708b860975b64126bb316aeb6641 openntpd-3.9p1_reconnect_on_sendto_EINVAL.diff
+md5sums="800c5d3ef2b8e3ac403698fdf0c54c2a openntpd-5.7p1.tar.gz
+4d18d6b30d33ccc1f7edaddef380b50b fix-cdecls.patch
+8b1acd9ba6f9ff71af0bda7111f1d91f adjtimex.patch
e3eee9eb2ea092dfdf9d887cd6df5795 openntpd.confd
e7856ad0eef420922f1d501d9ccac117 openntpd.initd"
-sha256sums="83dd7c1e8ec8b4567afe49af539271b5a73562fb7a3ca51df73eccba89ec8c49 openntpd-3.9p1.tar.gz
-97043f4a19468bc275326e6cd1b8aee8dfe6123746a8e857a5b1fa63f7f9a044 openntpd-3.9p1_reconnect_on_sendto_EINVAL.diff
+sha256sums="071cfdcfc179c481568a2b8262945243a3123abfc7fa8831da1bbff3729b8307 openntpd-5.7p1.tar.gz
+2c218a8ca4bce116136599f8183db4687fed30c7db4428e9b7db62147037cdce fix-cdecls.patch
+f83fc039e99376a2952956ecfa649eb050e621307202166c7636fc2a1ff18391 adjtimex.patch
a1cb9dc8fbbaf6f439d6547bce9d59e86e7e13855b037d33bad1f789fb7050f3 openntpd.confd
42987f19f2fc54455c8aeed0e9bc586ceafae85762cb20e33858139208ab6c79 openntpd.initd"
-sha512sums="e19e7242b67c8d12fbf0a78cd29dae4248afff5b5308069b190b663a9f9426666aad20f8c9ec70fabf8d2e5c2a2e61052191fe4ccc132c62a7decd8c498c2a13 openntpd-3.9p1.tar.gz
-89862cd1a20961c7c009b50c853770924e852eba6719bb4c3532c2ea193d93d63a2d494f7bee774e33b76e449c6e2c19cb5717ffb2c998326ecce594f6bd3509 openntpd-3.9p1_reconnect_on_sendto_EINVAL.diff
+sha512sums="2fe6f7daae147eca616bbc76bbcc9d0d2d03cb705f1437a3fa21c98114ce9b78eabbbcbf9ed38d4d7752936a9bf2ee2cabe0a75dfa8f00980088dc2d9f8ac4df openntpd-5.7p1.tar.gz
+123315d157017962c5838ed7dcf227c5e442330a0676fe9a96f099211118b525f8b15d0eaac8f466836bcbfaed3b469b9740966566e96b3dfef2e99f4d93677f fix-cdecls.patch
+1538062645a675cd7b30dbe5be31be7bf06353fe8730dcc45f62d7273b3daf0e90bf377312e7681df3257fd99238cb6fb4d8220c6502179604bded2ea8816d6c adjtimex.patch
a80de3a07eadebeb67b2a3532713df34f1c2113965001f50bdad90f66df6fe57af08e9fba7afac9c5f0afb52d2318c120cd4eb428255f8bc5ef748cefd7e106a openntpd.confd
0cdead06e4b359ecedb1065c929ddd66ef3bc5d321bd96e462abf1f55ab289c36793ee5e8f4262c0b7ef7e3532f3613fa66ca22e88f742814f357310465b7d99 openntpd.initd"
diff --git a/main/openntpd/adjtimex.patch b/main/openntpd/adjtimex.patch
new file mode 100644
index 000000000..6dbf52976
--- /dev/null
+++ b/main/openntpd/adjtimex.patch
@@ -0,0 +1,29 @@
+--- ./compat/adjfreq_linux.c.orig
++++ ./compat/adjfreq_linux.c
+@@ -37,20 +37,20 @@
+ txc.modes = ADJ_FREQUENCY;
+ txc.freq = *freq / 1e3 / (1LL << 16);
+
+- if ((ntp_adjtime(&txc)) == -1)
+- log_warn("ntp_adjtime (2) failed");
++ if ((adjtimex(&txc)) == -1)
++ log_warn("adjtimex (2) failed");
+
+- log_debug("ntp_adjtime adjusted frequency by %fppm",
++ log_debug("adjtimex adjusted frequency by %fppm",
+ ((txc.freq * 1e3) * (1LL<<16) / 1e3 / (1LL << 32)));
+ }
+ if (oldfreq != NULL) {
+ txc.modes = 0;
+- if ((ntp_adjtime(&txc)) == -1) {
+- log_warn("ntp_adjtime (1) failed");
++ if ((adjtimex(&txc)) == -1) {
++ log_warn("adjtimex (1) failed");
+ return -1;
+ }
+ newfreq = (txc.freq * 1e3) * (1LL<<16);
+- log_debug("ntp_adjtime returns frequency of %fppm",
++ log_debug("adjtimex returns frequency of %fppm",
+ newfreq / 1e3 / (1LL << 32));
+ *oldfreq = newfreq;
+ }
diff --git a/main/openntpd/fix-cdecls.patch b/main/openntpd/fix-cdecls.patch
new file mode 100644
index 000000000..be3d08148
--- /dev/null
+++ b/main/openntpd/fix-cdecls.patch
@@ -0,0 +1,56 @@
+--- ./include/sha2_openbsd.h.orig
++++ ./include/sha2_openbsd.h
+@@ -63,7 +63,10 @@
+ u_int8_t buffer[SHA512_BLOCK_LENGTH];
+ } SHA2_CTX;
+
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ void SHA224Init(SHA2_CTX *);
+ void SHA224Transform(u_int32_t state[8], const u_int8_t [SHA224_BLOCK_LENGTH]);
+ void SHA224Update(SHA2_CTX *, const u_int8_t *, size_t)
+@@ -131,6 +134,8 @@
+ char *SHA512Data(const u_int8_t *, size_t, char *)
+ __attribute__((__bounded__(__string__,1,2)))
+ __attribute__((__bounded__(__minbytes__,3,SHA512_DIGEST_STRING_LENGTH)));
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+
+ #endif /* _SHA2_H */
+--- ./include/md5_openbsd.h.orig
++++ ./include/md5_openbsd.h
+@@ -15,6 +15,8 @@
+ #ifndef _MD5_H_
+ #define _MD5_H_
+
++#include <sys/types.h>
++
+ #define MD5_BLOCK_LENGTH 64
+ #define MD5_DIGEST_LENGTH 16
+ #define MD5_DIGEST_STRING_LENGTH (MD5_DIGEST_LENGTH * 2 + 1)
+@@ -25,7 +27,9 @@
+ u_int8_t buffer[MD5_BLOCK_LENGTH]; /* input buffer */
+ } MD5_CTX;
+
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ void MD5Init(MD5_CTX *);
+ void MD5Update(MD5_CTX *, const u_int8_t *, size_t)
+ __attribute__((__bounded__(__string__,2,3)));
+@@ -44,6 +48,8 @@
+ char *MD5Data(const u_int8_t *, size_t, char *)
+ __attribute__((__bounded__(__string__,1,2)))
+ __attribute__((__bounded__(__minbytes__,3,MD5_DIGEST_STRING_LENGTH)));
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+
+ #endif /* _MD5_H_ */
diff --git a/main/openntpd/openntpd-3.9p1_reconnect_on_sendto_EINVAL.diff b/main/openntpd/openntpd-3.9p1_reconnect_on_sendto_EINVAL.diff
deleted file mode 100644
index adca55614..000000000
--- a/main/openntpd/openntpd-3.9p1_reconnect_on_sendto_EINVAL.diff
+++ /dev/null
@@ -1,43 +0,0 @@
-diff -Naur openntpd-3.9p1/client.c openntpd-3.9p1-fixed/client.c
---- openntpd-3.9p1/client.c 2006-05-14 07:29:21.000000000 +0200
-+++ openntpd-3.9p1-fixed/client.c 2006-10-11 02:41:44.000000000 +0200
-@@ -116,6 +116,7 @@
- client_query(struct ntp_peer *p)
- {
- int tos = IPTOS_LOWDELAY;
-+ int result;
-
- if (p->addr == NULL && client_nextaddr(p) == -1) {
- set_next(p, error_interval());
-@@ -163,9 +164,17 @@
- p->query->msg.xmttime.fractionl = arc4random();
- p->query->xmttime = gettime();
-
-- if (ntp_sendmsg(p->query->fd, NULL, &p->query->msg,
-- NTP_MSGSIZE_NOAUTH, 0) == -1) {
-+ if ((result = ntp_sendmsg(p->query->fd, NULL, &p->query->msg,
-+ NTP_MSGSIZE_NOAUTH, 0)) < 0) {
- set_next(p, INTERVAL_QUERY_PATHETIC);
-+ if (result == -2) {
-+ /*
-+ * got EINVAL in sendto(), probably the local socket
-+ * address got invalidated -> force re-connect()
-+ */
-+ close(p->query->fd);
-+ p->query->fd = -1;
-+ }
- return (-1);
- }
-
-diff -Naur openntpd-3.9p1/ntp_msg.c openntpd-3.9p1-fixed/ntp_msg.c
---- openntpd-3.9p1/ntp_msg.c 2006-05-14 07:29:21.000000000 +0200
-+++ openntpd-3.9p1-fixed/ntp_msg.c 2006-10-11 02:41:49.000000000 +0200
-@@ -98,6 +98,8 @@
- return (-1);
- }
- log_warn("sendto");
-+ if (errno == EINVAL)
-+ return (-2);
- return (-1);
- }
-