summaryrefslogtreecommitdiff
path: root/package/openntpd
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2010-07-02 15:36:48 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2010-07-02 15:36:48 +0200
commit489d5453e0ed06d3567b39afb481e55a29ab7f88 (patch)
treedc39fc1c9edbe90a0ab423c351e5230b14b39af8 /package/openntpd
parent3fc7c024cf716efa0d2d70fc33412b70b870146b (diff)
implement a dumb mode for offline servers
use -i to activate.
Diffstat (limited to 'package/openntpd')
-rw-r--r--package/openntpd/patches/patch-ntpd_c27
-rw-r--r--package/openntpd/patches/patch-ntpd_h12
-rw-r--r--package/openntpd/patches/patch-server_c40
3 files changed, 77 insertions, 2 deletions
diff --git a/package/openntpd/patches/patch-ntpd_c b/package/openntpd/patches/patch-ntpd_c
new file mode 100644
index 000000000..0841ca4e9
--- /dev/null
+++ b/package/openntpd/patches/patch-ntpd_c
@@ -0,0 +1,27 @@
+--- openntpd-3.9p1.orig/ntpd.c 2006-05-14 07:29:23.000000000 +0200
++++ openntpd-3.9p1/ntpd.c 2010-07-02 14:21:47.473356095 +0200
+@@ -73,7 +73,7 @@ usage(void)
+ {
+ extern char *__progname;
+
+- fprintf(stderr, "usage: %s [-dSs] [-f file]\n", __progname);
++ fprintf(stderr, "usage: %s [-diSs] [-f file]\n", __progname);
+ exit(1);
+ }
+
+@@ -100,11 +100,14 @@ main(int argc, char *argv[])
+ log_init(1); /* log to stderr until daemonized */
+ res_init(); /* XXX */
+
+- while ((ch = getopt(argc, argv, "df:sS")) != -1) {
++ while ((ch = getopt(argc, argv, "dif:sS")) != -1) {
+ switch (ch) {
+ case 'd':
+ conf.debug = 1;
+ break;
++ case 'i':
++ conf.ignore = 1;
++ break;
+ case 'f':
+ conffile = optarg;
+ break;
diff --git a/package/openntpd/patches/patch-ntpd_h b/package/openntpd/patches/patch-ntpd_h
index 9189d6204..6cf64776c 100644
--- a/package/openntpd/patches/patch-ntpd_h
+++ b/package/openntpd/patches/patch-ntpd_h
@@ -28,8 +28,8 @@ $Id$
use settimeofday() instead of adjtime(), in order to provide
a faster time setting at start, since adjusting can take ages
---- openntpd-3.9p1.orig/ntpd.h Sun May 14 05:28:58 2006
-+++ openntpd-3.9p1/ntpd.h Mon Oct 8 12:17:58 2007
+--- openntpd-3.9p1.orig/ntpd.h 2006-05-14 07:29:21.000000000 +0200
++++ openntpd-3.9p1/ntpd.h 2010-07-02 14:13:10.357356688 +0200
@@ -55,8 +55,12 @@
#define QSCALE_OFF_MAX 0.50
@@ -45,3 +45,11 @@ $Id$
#define SETTIME_TIMEOUT 15 /* max seconds to wait with -s */
#define LOG_NEGLIGEE 128 /* negligible drift to not log (ms) */
+@@ -131,6 +135,7 @@ struct ntpd_conf {
+ u_int8_t listen_all;
+ u_int8_t settime;
+ u_int8_t debug;
++ u_int8_t ignore;
+ u_int32_t scale;
+ };
+
diff --git a/package/openntpd/patches/patch-server_c b/package/openntpd/patches/patch-server_c
new file mode 100644
index 000000000..ae1614afa
--- /dev/null
+++ b/package/openntpd/patches/patch-server_c
@@ -0,0 +1,40 @@
+--- openntpd-3.9p1.orig/server.c 2006-05-14 07:29:21.000000000 +0200
++++ openntpd-3.9p1/server.c 2010-07-02 15:33:05.061342638 +0200
+@@ -150,21 +150,33 @@ server_dispatch(int fd, struct ntpd_conf
+ version = (query.status & VERSIONMASK) >> 3;
+
+ bzero(&reply, sizeof(reply));
+- if (conf->status.synced)
++ if (conf->status.synced || conf->ignore)
+ reply.status = conf->status.leap;
+ else
+ reply.status = LI_ALARM;
++
+ reply.status |= (query.status & VERSIONMASK);
+ if ((query.status & MODEMASK) == MODE_CLIENT)
+ reply.status |= MODE_SERVER;
+ else
+ reply.status |= MODE_SYM_PAS;
+
+- reply.stratum = conf->status.stratum;
++ if (conf->ignore) {
++ reply.stratum = 1;
++ reply.precision = -20;
++ } else {
++ reply.stratum = conf->status.stratum;
++ reply.precision = conf->status.precision;
++ }
++
+ reply.ppoll = query.ppoll;
+- reply.precision = conf->status.precision;
+ reply.rectime = d_to_lfp(rectime);
+- reply.reftime = d_to_lfp(conf->status.reftime);
++
++ if (conf->ignore)
++ reply.reftime = d_to_lfp(gettime());
++ else
++ reply.reftime = d_to_lfp(conf->status.reftime);
++
+ reply.xmttime = d_to_lfp(gettime());
+ reply.orgtime = query.xmttime;
+ reply.rootdelay = d_to_sfp(conf->status.rootdelay);