aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/xntpd/patches/patch.34
blob: a3828895ab86c67f389ac35ea65f84a1e94fc842 (plain) (blame)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303

Received: from louie.udel.edu by huey.udel.edu id aa02155; 25 Mar 94 8:47 EST
Received: from faui45.informatik.uni-erlangen.de by louie.udel.edu id aa05544;
          25 Mar 94 8:45 EST
Received: from faui43.informatik.uni-erlangen.de by uni-erlangen.de with SMTP;
	id AA27199 (5.65c-6/7.3v-FAU); Fri, 25 Mar 1994 14:45:13 +0100
Received: from faui45x.informatik.uni-erlangen.de by immd4.informatik.uni-erlangen.de with SMTP;
	id AA06935 (5.65c-6/7.3m-FAU); Fri, 25 Mar 1994 14:45:11 +0100
From: Frank Kardel <Frank.Kardel@informatik.uni-erlangen.de>
Message-Id: <199403251345.AA06935@faui43.informatik.uni-erlangen.de>
Subject: bugfixes for parse & ntpq enhancements
To: mills@udel.edu
Date: Fri, 25 Mar 94 14:45:05 MET
X-Mailer: ELM [version 2.3 PL11]

Hi Dave,

I have a 2 bug fixes and an ntpq enhancement:
	- parse bitmap initialisation fixed
	- allow for large offsets in refclock_parse (>4 min 8-()
	- decode the flash bits in cooked mode

diff -c ntpq/ntpq.c:1.1.1.21 ntpq/ntpq.c:3.22
*** ntpq/ntpq.c:1.1.1.21	Fri Mar 25 14:32:38 1994
--- ntpq/ntpq.c	Fri Mar 25 14:32:38 1994
***************
*** 75,80 ****
--- 75,81 ----
  #define	OC	12	/* integer, print in octal */
  #define	MD	13	/* mode */
  #define	AR	14	/* array of times */
+ #define TST	15	/* test flags */
  #define	EOV	255	/* end of table */
  
  
***************
*** 145,151 ****
  	{ CP_RECEIVED,	UI,	"received" },	/* 31 */
  	{ CP_SENT,	UI,	"sent" },	/* 32 */
  	{ CP_FILTERROR,	AR,	"filterror" },	/* 33 */
! 	{ CP_FLASH,     ST,	"flash"},	/* 34 */ 
  	{ CP_DISP,      AR,	"disp" },	/* 35 */
  	/*
  	 * These are duplicate entires so that we can
--- 146,152 ----
  	{ CP_RECEIVED,	UI,	"received" },	/* 31 */
  	{ CP_SENT,	UI,	"sent" },	/* 32 */
  	{ CP_FILTERROR,	AR,	"filterror" },	/* 33 */
! 	{ CP_FLASH,     TST,	"flash"},	/* 34 */ 
  	{ CP_DISP,      AR,	"disp" },	/* 35 */
  	/*
  	 * These are duplicate entires so that we can
***************
*** 189,194 ****
--- 190,209 ----
  };
  
  /*
+  * flasher bits
+  */
+ static char *tstflagnames[] = {
+       "DUPLICATE PKT",
+       "BOGUS PKT",
+       "PROTO UNSYNC",
+       "PEER BOUNDS",
+       "BAD AUTH",
+       "PEER CLOCK UNSYNC",
+       "BAD STRATUM",
+       "ROOT BOUNDS"
+ };
+ 
+ /*
   * Leap values
   */
  struct codestring leap_codes[] = {
***************
*** 2836,2842 ****
  	output(fp, name, buf);
  }
  
! 
  
  /*
   * cookedprint - output variables in cooked mode
--- 2851,2895 ----
  	output(fp, name, buf);
  }
  
! static char *
! tstflags(val)
!   	U_LONG val;
! {
!   	register char *cb, *s;
!   	register int i;
!   	register char *sep;
! 
!   	sep = "";
!   	i = 0;
!   	s = cb = &circ_buf[nextcb][0];
!   	if (++nextcb >= NUMCB)
! 	  	nextcb = 0;
! 
!   	sprintf(cb, "0x%x", val);
!   	cb += strlen(cb);
!   	if (val <= ((1<<8)-1)) {
!     		if (!val) {
!       			strcat(cb, "<OK>");
!       			cb += strlen(cb);
!     		} else {
!       			*cb++ = '<';
!       			while (val) {
! 				if (val & 0x1) {
! 	  				sprintf(cb, "%s%s", sep, tstflagnames[i]);
! 	  				sep = ";";
! 	  				cb += strlen(cb);
! 				}
! 				i++;
! 				val >>= 1;
!       			}
!       			*cb++ = '>';
!     		}
!   	} else {
!     		*cb++ = '?';
!   	}
!   	*cb = '\0';
!   	return s;
! }
  
  /*
   * cookedprint - output variables in cooked mode
***************
*** 2994,2999 ****
--- 3047,3059 ----
  					outputarr(fp, name, narr, lfparr);
  				break;
  
+ 			case TST:
+ 				if (!decodeuint(value, &uval))
+ 					output_raw = '?';
+ 				else
+ 					output(fp, name, tstflags(uval));
+ 				break;
+ 			
  			default:
  				(void) fprintf(stderr,
  			"Internal error in cookedprint, %s=%s, fmt %d\n",
diff -c parse/parse.c:1.1.1.10 parse/parse.c:3.23
*** parse/parse.c:1.1.1.10	Fri Mar 25 14:33:02 1994
--- parse/parse.c	Fri Mar 25 14:33:02 1994
***************
*** 1,8 ****
  #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS))
  /*
!  * /src/NTP/REPOSITORY/v3/parse/parse.c,v 3.22 1994/02/25 12:34:49 kardel Exp
   *  
!  * parse.c,v 3.22 1994/02/25 12:34:49 kardel Exp
   *
   * Parser module for reference clock
   *
--- 1,8 ----
  #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS))
  /*
!  * /src/NTP/REPOSITORY/v3/parse/parse.c,v 3.23 1994/03/25 13:09:02 kardel Exp
   *  
!  * parse.c,v 3.23 1994/03/25 13:09:02 kardel Exp
   *
   * Parser module for reference clock
   *
***************
*** 178,183 ****
--- 178,187 ----
      {
        fmt = clockformats[i];
  
+       if (!(parseio->parse_flags & PARSE_FIXED_FMT) &&
+ 	   (fmt->flags & CVT_FIXEDONLY))
+ 	continue;
+       
        if (fmt->flags & F_START)
  	{
  	  index = fmt->startsym / 8;
***************
*** 1158,1163 ****
--- 1162,1170 ----
   * History:
   *
   * parse.c,v
+  * Revision 3.23  1994/03/25  13:09:02  kardel
+  * considering FIXEDONLY entries only in FIXEDONLY mode
+  *
   * Revision 3.22  1994/02/25  12:34:49  kardel
   * allow for converter generated utc times
   *
diff -c xntpd/refclock_parse.c:1.1.1.13 xntpd/refclock_parse.c:3.53
*** xntpd/refclock_parse.c:1.1.1.13	Fri Mar 25 14:35:07 1994
--- xntpd/refclock_parse.c	Fri Mar 25 14:35:08 1994
***************
*** 1,8 ****
  #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS))
  /*
!  * /src/NTP/REPOSITORY/v3/xntpd/refclock_parse.c,v 3.51 1994/03/03 09:49:54 kardel Exp
   *
!  * refclock_parse.c,v 3.51 1994/03/03 09:49:54 kardel Exp
   *
   * generic reference clock driver for receivers
   *
--- 1,8 ----
  #if defined(REFCLOCK) && (defined(PARSE) || defined(PARSEPPS))
  /*
!  * /src/NTP/REPOSITORY/v3/xntpd/refclock_parse.c,v 3.53 1994/03/25 13:07:39 kardel Exp
   *
!  * refclock_parse.c,v 3.53 1994/03/25 13:07:39 kardel Exp
   *
   * generic reference clock driver for receivers
   *
***************
*** 129,135 ****
  #include "parse.h"
  
  #if !defined(NO_SCCSID) && !defined(lint) && !defined(__GNUC__)
! static char rcsid[]="refclock_parse.c,v 3.51 1994/03/03 09:49:54 kardel Exp";
  #endif
  
  /**===========================================================================
--- 129,135 ----
  #include "parse.h"
  
  #if !defined(NO_SCCSID) && !defined(lint) && !defined(__GNUC__)
! static char rcsid[]="refclock_parse.c,v 3.53 1994/03/25 13:07:39 kardel Exp";
  #endif
  
  /**===========================================================================
***************
*** 2824,2830 ****
        sprintf(tt, "refclock_iomode=\"%s\"", parse->binding->bd_description);
  
        tt = add_var(&out->kv_list, 128, RO);
!       sprintf(tt, "refclock_driver_version=\"refclock_parse.c,v 3.51 1994/03/03 09:49:54 kardel Exp\"");
  
        out->lencode       = strlen(outstatus);
        out->lastcode      = outstatus;
--- 2824,2830 ----
        sprintf(tt, "refclock_iomode=\"%s\"", parse->binding->bd_description);
  
        tt = add_var(&out->kv_list, 128, RO);
!       sprintf(tt, "refclock_driver_version=\"refclock_parse.c,v 3.53 1994/03/25 13:07:39 kardel Exp\"");
  
        out->lencode       = strlen(outstatus);
        out->lastcode      = outstatus;
***************
*** 3103,3109 ****
        L_ADD(&off, &offset);
        rectime = off;		/* this makes org time and xmt time somewhat artificial */
      
!       if (parse->flags & PARSE_STAT_FILTER)
  	{
  	  struct timeval usecerror;
  	  /*
--- 3103,3113 ----
        L_ADD(&off, &offset);
        rectime = off;		/* this makes org time and xmt time somewhat artificial */
      
!       L_SUB(&off, &parsetime->parse_stime.fp);
! 
!       if ((parse->flags & PARSE_STAT_FILTER) &&
! 	  (off.l_i > -60) &&
! 	  (off.l_i <  60))				/* take usec error only if within +- 60 secs */
  	{
  	  struct timeval usecerror;
  	  /*
***************
*** 3115,3124 ****
  	  sTVTOTS(&usecerror, &off);
  	  L_ADD(&off, &offset);
  	}
-       else
- 	{
- 	  L_SUB(&off, &parsetime->parse_stime.fp);
- 	}
      }
  
    if (PARSE_PPS(parsetime->parse_state) && CL_PPS(parse->unit))
--- 3119,3124 ----
***************
*** 3409,3414 ****
--- 3409,3420 ----
   * History:
   *
   * refclock_parse.c,v
+  * Revision 3.53  1994/03/25  13:07:39  kardel
+  * fixed offset calculation for large (>4 Min) offsets
+  *
+  * Revision 3.52  1994/03/03  09:58:00  kardel
+  * stick -kv in cvs is no fun
+  *
   * Revision 3.49  1994/02/20  13:26:00  kardel
   * rcs id cleanup
   *
-- 
	   Frank Kardel (kardel@informatik.uni-erlangen.de)
    All SCSI disks will from now on be required to send an email
         notice 24 hours prior to complete hardware failure!