summaryrefslogtreecommitdiff
path: root/package/openntpd/patches/patch-server_c
blob: ae1614afacf9bed93207dbf60a8958e025f9dbcb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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);