aboutsummaryrefslogtreecommitdiff
path: root/net/openntpd
diff options
context:
space:
mode:
authorChristian Weisgerber <naddy@FreeBSD.org>2009-11-24 14:55:52 +0000
committerChristian Weisgerber <naddy@FreeBSD.org>2009-11-24 14:55:52 +0000
commit2bc38c4ec13badffdf05ee1ebcde244985583352 (patch)
tree16e81d60db991d1a9066d02dddd4b2475e29e13c /net/openntpd
parente4f3d2c40de23061a9c2e766e87147267b04a7e0 (diff)
downloadports-2bc38c4ec13badffdf05ee1ebcde244985583352.tar.gz
ports-2bc38c4ec13badffdf05ee1ebcde244985583352.zip
Notes
Diffstat (limited to 'net/openntpd')
-rw-r--r--net/openntpd/Makefile3
-rw-r--r--net/openntpd/distinfo6
-rw-r--r--net/openntpd/files/patch-Makefile12
-rw-r--r--net/openntpd/files/patch-ntp.c65
-rw-r--r--net/openntpd/files/patch-ntpd.812
-rw-r--r--net/openntpd/files/patch-ntpd.c12
-rw-r--r--net/openntpd/files/patch-ntpd.conf.552
-rw-r--r--net/openntpd/files/patch-ntpd.h9
8 files changed, 98 insertions, 73 deletions
diff --git a/net/openntpd/Makefile b/net/openntpd/Makefile
index 5c6f2978eb90..ca37d49a03e0 100644
--- a/net/openntpd/Makefile
+++ b/net/openntpd/Makefile
@@ -6,8 +6,7 @@
#
PORTNAME= openntpd
-PORTVERSION= 4.4
-PORTREVISION= 1
+PORTVERSION= 4.6
PORTEPOCH= 2
CATEGORIES= net
MASTER_SITES= ${MASTER_SITE_OPENBSD}
diff --git a/net/openntpd/distinfo b/net/openntpd/distinfo
index 7e06ec18385a..3e33a74c4951 100644
--- a/net/openntpd/distinfo
+++ b/net/openntpd/distinfo
@@ -1,3 +1,3 @@
-MD5 (openntpd-4.4.tgz) = 407d1818ad2d5f1c970baa91fa68d2e3
-SHA256 (openntpd-4.4.tgz) = b7b788e28ebbaafa89784978c02ea499dc65fb8db91a969152e73e3004c21741
-SIZE (openntpd-4.4.tgz) = 27262
+MD5 (openntpd-4.6.tgz) = a188c9d32995c0235cc298472ae04fdb
+SHA256 (openntpd-4.6.tgz) = 724164736f8489a64aedfbc5f8fceaa5eef69c9b8cb26c75a711cfa1b6bab6d7
+SIZE (openntpd-4.6.tgz) = 30472
diff --git a/net/openntpd/files/patch-Makefile b/net/openntpd/files/patch-Makefile
index c78ef017030e..bdf6f9a4aee1 100644
--- a/net/openntpd/files/patch-Makefile
+++ b/net/openntpd/files/patch-Makefile
@@ -1,16 +1,16 @@
$FreeBSD$
---- Makefile.orig 2009-08-01 17:38:53.000000000 +0200
-+++ Makefile 2009-08-01 18:21:05.000000000 +0200
-@@ -4,7 +4,7 @@
+--- Makefile.orig 2009-11-23 20:27:18.000000000 +0100
++++ Makefile 2009-11-23 20:29:05.000000000 +0100
+@@ -2,7 +2,7 @@
PROG= ntpd
SRCS= ntpd.c buffer.c log.c imsg.c ntp.c ntp_msg.c parse.y config.c \
-- server.c client.c sensors.c util.c
-+ server.c client.c util.c adjfreq.c arc4random.c
+- server.c client.c sensors.c util.c ntp_dns.c
++ server.c client.c util.c ntp_dns.c adjfreq.c arc4random.c
CFLAGS+= -Wall -I${.CURDIR}
CFLAGS+= -Wstrict-prototypes -Wmissing-prototypes
CFLAGS+= -Wmissing-declarations
-@@ -13,4 +13,7 @@ CFLAGS+= -Wsign-compare
+@@ -11,4 +11,7 @@ CFLAGS+= -Wsign-compare
YFLAGS=
MAN= ntpd.8 ntpd.conf.5
diff --git a/net/openntpd/files/patch-ntp.c b/net/openntpd/files/patch-ntp.c
index 819f7439768f..5da3b5d907c1 100644
--- a/net/openntpd/files/patch-ntp.c
+++ b/net/openntpd/files/patch-ntp.c
@@ -1,32 +1,34 @@
$FreeBSD$
---- ntp.c.orig 2009-08-01 20:12:43.000000000 +0200
-+++ ntp.c 2009-08-01 20:26:44.000000000 +0200
-@@ -34,8 +34,12 @@
+--- ntp.c.orig 2009-11-23 20:47:16.000000000 +0100
++++ ntp.c 2009-11-23 20:55:59.000000000 +0100
+@@ -34,9 +34,14 @@
#include "ntpd.h"
#define PFD_PIPE_MAIN 0
+#ifdef HAVE_SENSORS
#define PFD_HOTPLUG 1
- #define PFD_MAX 2
+ #define PFD_PIPE_DNS 2
+ #define PFD_MAX 3
+#else
-+#define PFD_MAX 1
++#define PFD_PIPE_DNS 1
++#define PFD_MAX 2
+#endif
volatile sig_atomic_t ntp_quit = 0;
volatile sig_atomic_t ntp_report = 0;
-@@ -69,7 +73,10 @@ pid_t
+@@ -72,7 +77,10 @@ pid_t
ntp_main(int pipe_prnt[2], struct ntpd_conf *nconf, struct passwd *pw)
{
int a, b, nfds, i, j, idx_peers, timeout;
-- int hotplugfd, nullfd;
+- int hotplugfd, nullfd, pipe_dns[2];
+#ifdef HAVE_SENSORS
+ int hotplugfd;
+#endif
-+ int nullfd;
++ int nullfd, pipe_dns[2];
u_int pfd_elms = 0, idx2peer_elms = 0;
u_int listener_cnt, new_cnt, sent_cnt, trial_cnt;
- pid_t pid;
-@@ -78,10 +85,15 @@ ntp_main(int pipe_prnt[2], struct ntpd_c
+ pid_t pid, dns_pid;
+@@ -81,10 +89,15 @@ ntp_main(int pipe_prnt[2], struct ntpd_c
struct listen_addr *la;
struct ntp_peer *p;
struct ntp_peer **idx2peer = NULL;
@@ -43,7 +45,7 @@ $FreeBSD$
void *newp;
switch (pid = fork()) {
-@@ -105,7 +117,9 @@ ntp_main(int pipe_prnt[2], struct ntpd_c
+@@ -108,7 +121,9 @@ ntp_main(int pipe_prnt[2], struct ntpd_c
if ((nullfd = open(_PATH_DEVNULL, O_RDWR, 0)) == -1)
fatal(NULL);
@@ -51,9 +53,9 @@ $FreeBSD$
hotplugfd = sensor_hotplugfd();
+#endif
- if (stat(pw->pw_dir, &stb) == -1)
- fatal("stat");
-@@ -168,7 +182,9 @@ ntp_main(int pipe_prnt[2], struct ntpd_c
+ if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, pipe_dns) == -1)
+ fatal("socketpair");
+@@ -179,7 +194,9 @@ ntp_main(int pipe_prnt[2], struct ntpd_c
conf->status.precision = a;
conf->scale = 1;
@@ -63,7 +65,7 @@ $FreeBSD$
log_info("ntp engine ready");
-@@ -210,8 +226,10 @@ ntp_main(int pipe_prnt[2], struct ntpd_c
+@@ -221,8 +238,10 @@ ntp_main(int pipe_prnt[2], struct ntpd_c
nextaction = getmonotime() + 3600;
pfd[PFD_PIPE_MAIN].fd = ibuf_main->fd;
pfd[PFD_PIPE_MAIN].events = POLLIN;
@@ -71,10 +73,10 @@ $FreeBSD$
pfd[PFD_HOTPLUG].fd = hotplugfd;
pfd[PFD_HOTPLUG].events = POLLIN;
+#endif
+ pfd[PFD_PIPE_DNS].fd = ibuf_dns->fd;
+ pfd[PFD_PIPE_DNS].events = POLLIN;
- i = PFD_MAX;
- TAILQ_FOREACH(la, &conf->listen_addrs, entry) {
-@@ -265,6 +283,7 @@ ntp_main(int pipe_prnt[2], struct ntpd_c
+@@ -278,6 +297,7 @@ ntp_main(int pipe_prnt[2], struct ntpd_c
}
}
@@ -82,7 +84,7 @@ $FreeBSD$
if (last_sensor_scan == 0 ||
last_sensor_scan + SENSOR_SCAN_INTERVAL < getmonotime()) {
sensors_cnt = sensor_scan();
-@@ -273,7 +292,9 @@ ntp_main(int pipe_prnt[2], struct ntpd_c
+@@ -286,7 +306,9 @@ ntp_main(int pipe_prnt[2], struct ntpd_c
if (!TAILQ_EMPTY(&conf->ntp_conf_sensors) && sensors_cnt == 0 &&
nextaction > last_sensor_scan + SENSOR_SCAN_INTERVAL)
nextaction = last_sensor_scan + SENSOR_SCAN_INTERVAL;
@@ -92,7 +94,7 @@ $FreeBSD$
TAILQ_FOREACH(s, &conf->ntp_sensors, entry) {
if (conf->settime && s->offsets[0].offset)
priv_settime(s->offsets[0].offset);
-@@ -281,6 +302,7 @@ ntp_main(int pipe_prnt[2], struct ntpd_c
+@@ -294,6 +316,7 @@ ntp_main(int pipe_prnt[2], struct ntpd_c
if (s->next > 0 && s->next < nextaction)
nextaction = s->next;
}
@@ -100,7 +102,7 @@ $FreeBSD$
if (conf->settime &&
((trial_cnt > 0 && sent_cnt == 0) ||
-@@ -312,10 +334,12 @@ ntp_main(int pipe_prnt[2], struct ntpd_c
+@@ -339,10 +362,12 @@ ntp_main(int pipe_prnt[2], struct ntpd_c
ntp_quit = 1;
}
@@ -111,9 +113,9 @@ $FreeBSD$
}
+#endif
- for (j = 1; nfds > 0 && j < idx_peers; j++)
+ for (j = PFD_MAX; nfds > 0 && j < idx_peers; j++)
if (pfd[j].revents & (POLLIN|POLLERR)) {
-@@ -332,12 +356,14 @@ ntp_main(int pipe_prnt[2], struct ntpd_c
+@@ -359,12 +384,14 @@ ntp_main(int pipe_prnt[2], struct ntpd_c
ntp_quit = 1;
}
@@ -128,7 +130,7 @@ $FreeBSD$
report_peers(ntp_report);
ntp_report = 0;
}
-@@ -511,7 +537,9 @@ int
+@@ -574,7 +601,9 @@ int
priv_adjtime(void)
{
struct ntp_peer *p;
@@ -138,7 +140,7 @@ $FreeBSD$
int offset_cnt = 0, i = 0, j;
struct ntp_offset **offsets;
double offset_median;
-@@ -524,11 +552,13 @@ priv_adjtime(void)
+@@ -587,11 +616,13 @@ priv_adjtime(void)
offset_cnt += p->weight;
}
@@ -152,7 +154,7 @@ $FreeBSD$
if (offset_cnt == 0)
return (1);
-@@ -543,12 +573,14 @@ priv_adjtime(void)
+@@ -606,12 +637,14 @@ priv_adjtime(void)
offsets[i++] = &p->update;
}
@@ -167,7 +169,7 @@ $FreeBSD$
qsort(offsets, offset_cnt, sizeof(struct ntp_offset *), offset_compare);
-@@ -585,11 +617,13 @@ priv_adjtime(void)
+@@ -648,11 +681,13 @@ priv_adjtime(void)
p->reply[i].offset -= offset_median;
p->update.good = 0;
}
@@ -181,7 +183,7 @@ $FreeBSD$
return (0);
}
-@@ -679,16 +713,20 @@ report_peers(int always)
+@@ -734,16 +769,20 @@ report_peers(int always)
u_int badpeers = 0;
u_int badsensors = 0;
struct ntp_peer *p;
@@ -200,9 +202,9 @@ $FreeBSD$
}
+#endif
- now = time(NULL);
+ now = getmonotime();
if (!always) {
-@@ -718,6 +756,7 @@ report_peers(int always)
+@@ -773,6 +812,7 @@ report_peers(int always)
}
}
}
@@ -210,10 +212,9 @@ $FreeBSD$
if (sensors_cnt > 0) {
log_warnx("%u out of %u sensors valid",
sensors_cnt - badsensors, sensors_cnt);
-@@ -726,5 +765,6 @@ report_peers(int always)
+@@ -781,4 +821,5 @@ report_peers(int always)
log_warnx("bad sensor %s", s->device);
}
}
+#endif
}
-
diff --git a/net/openntpd/files/patch-ntpd.8 b/net/openntpd/files/patch-ntpd.8
index 53e763992ac0..d9a5fdda7b23 100644
--- a/net/openntpd/files/patch-ntpd.8
+++ b/net/openntpd/files/patch-ntpd.8
@@ -1,6 +1,6 @@
$FreeBSD$
---- ntpd.8.orig 2009-08-01 21:32:41.000000000 +0200
-+++ ntpd.8 2009-08-01 21:40:29.000000000 +0200
+--- ntpd.8.orig 2009-02-12 02:33:37.000000000 +0100
++++ ntpd.8 2009-11-23 21:36:02.000000000 +0100
@@ -29,8 +29,7 @@
.Sh DESCRIPTION
The
@@ -44,8 +44,12 @@ $FreeBSD$
for more information on the boot process
and enabling daemons.
.Pp
-@@ -123,19 +122,19 @@ receives a
- signal, it writes its peer and sensor status to
+@@ -120,22 +119,22 @@ When
+ .Nm
+ receives a
+ .Dv SIGINFO
+-signal, it writes its peer and sensor status to
++signal, it writes its peer status to
.Xr syslog 3 .
.Sh FILES
-.Bl -tag -width "/var/db/ntpd.driftXXX" -compact
diff --git a/net/openntpd/files/patch-ntpd.c b/net/openntpd/files/patch-ntpd.c
index 92cefab02d39..e47d20c1ac33 100644
--- a/net/openntpd/files/patch-ntpd.c
+++ b/net/openntpd/files/patch-ntpd.c
@@ -2,18 +2,18 @@ $FreeBSD$
Drift file in ppm for compatibility with reference ntpd.
---- ntpd.c.orig 2009-08-01 22:17:42.000000000 +0200
-+++ ntpd.c 2009-08-01 22:18:51.000000000 +0200
-@@ -449,7 +449,7 @@ readfreq(void)
+--- ntpd.c.orig 2009-11-23 20:34:47.000000000 +0100
++++ ntpd.c 2009-11-23 20:36:38.000000000 +0100
+@@ -457,7 +457,7 @@ readfreq(void)
log_warn("adjfreq failed");
else if (current == 0) {
if (fscanf(fp, "%le", &d) == 1)
- ntpd_adjfreq(d, 0);
+ ntpd_adjfreq(d / 1e6, 0);
+ else
+ log_warnx("can't read %s", DRIFTFILE);
}
- fclose(fp);
- }
-@@ -470,7 +470,7 @@ writefreq(double d)
+@@ -480,7 +480,7 @@ writefreq(double d)
return 0;
}
diff --git a/net/openntpd/files/patch-ntpd.conf.5 b/net/openntpd/files/patch-ntpd.conf.5
index c323ed28e76e..94600766d98d 100644
--- a/net/openntpd/files/patch-ntpd.conf.5
+++ b/net/openntpd/files/patch-ntpd.conf.5
@@ -1,16 +1,7 @@
$FreeBSD$
---- ntpd.conf.5.orig 2009-08-01 21:41:54.000000000 +0200
-+++ ntpd.conf.5 2009-08-01 21:47:49.000000000 +0200
-@@ -28,7 +28,7 @@ configuration file.
- The optional
- .Ic weight
- keyword permits finer control over the relative importance
--of time sources (servers or sensor devices).
-+of time sources.
- Weights are specified in the range 1 to 10;
- if no weight is given,
- the default is 1.
-@@ -70,51 +70,6 @@ or
+--- ntpd.conf.5.orig 2009-11-23 21:03:30.000000000 +0100
++++ ntpd.conf.5 2009-11-23 21:12:27.000000000 +0100
+@@ -59,62 +59,6 @@ or
listen on 127.0.0.1
listen on ::1
.Ed
@@ -36,18 +27,29 @@ $FreeBSD$
-For example:
-.Bd -literal -offset indent
-sensor *
--sensor udcf0
+-sensor nmea0
-.Ed
-.Pp
-An optional correction in microseconds can be given to compensate
-for the sensor's offset.
-The maximum correction is 127 seconds.
--For example, if a DCF77 receiver is lagging 15ms behind
+-For example, if a DCF77 receiver is lagging 70ms behind
-actual time:
-.Bd -literal -offset indent
--sensor udcf0 correction 15000
+-sensor udcf0 correction 70000
-.Ed
-.Pp
+-The optional
+-.Ic weight
+-keyword permits finer control over the relative importance
+-of time sources (servers or sensor devices).
+-Weights are specified in the range 1 to 10;
+-if no weight is given,
+-the default is 1.
+-A server with a weight of 5, for example,
+-will have five times more influence on time offset calculation
+-than a server with a weight of 1.
+-.Pp
-An optional reference ID string - up to 4 ASCII characters - can be
-given to publish the sensor type to clients.
-RFC 2030 suggests some common reference identifiers, but new identifiers
@@ -57,11 +59,29 @@ $FreeBSD$
-will use a generic reference ID.
-For example:
-.Bd -literal -offset indent
--sensor msts0 refid GPS
+-sensor nmea0 refid GPS
-.Ed
.It Xo Ic server Ar address
.Op Ic weight Ar weight-value
.Xc
+@@ -139,6 +83,17 @@ server ntp.example.org weight 1
+ To provide redundancy, it is good practice to configure multiple servers.
+ In general, best accuracy is obtained by using servers that have a low
+ network latency.
++.Pp
++The optional
++.Ic weight
++keyword permits finer control over the relative importance
++of time sources.
++Weights are specified in the range 1 to 10;
++if no weight is given,
++the default is 1.
++A server with a weight of 5, for example,
++will have five times more influence on time offset calculation
++than a server with a weight of 1.
+ .It Xo Ic servers Ar address
+ .Op Ic weight Ar weight-value
+ .Xc
@@ -157,15 +112,14 @@ servers pool.ntp.org
.Ed
.El
diff --git a/net/openntpd/files/patch-ntpd.h b/net/openntpd/files/patch-ntpd.h
index 3bec8635593b..717694aa4130 100644
--- a/net/openntpd/files/patch-ntpd.h
+++ b/net/openntpd/files/patch-ntpd.h
@@ -1,16 +1,17 @@
$FreeBSD$
---- ntpd.h.orig 2009-01-16 15:03:38.000000000 +0100
-+++ ntpd.h 2009-08-01 22:31:40.000000000 +0200
-@@ -29,10 +29,11 @@
+--- ntpd.h.orig 2009-11-23 20:37:40.000000000 +0100
++++ ntpd.h 2009-11-23 20:38:12.000000000 +0100
+@@ -29,11 +29,12 @@
#include <pwd.h>
#include <stdarg.h>
+#include "compat.h"
#include "ntp.h"
+ #include <imsg.h>
#define NTPD_USER "_ntp"
-#define CONFFILE "/etc/ntpd.conf"
+#define CONFFILE "%%PREFIX%%/etc/ntpd.conf"
#define DRIFTFILE "/var/db/ntpd.drift"
- #define READ_BUF_SIZE 8192
+ #define INTERVAL_QUERY_NORMAL 30 /* sync to peers every n secs */