Subject: TIOCDCDTIMESTAMP: potential lossage on refclocks.
To: None <current-users@NetBSD.ORG>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: current-users
Date: 03/26/1998 17:40:18
If you arent' using a referenceclock with NTP on current, or planning
to, please ignore the rest of this message....

Some bad news with the recent addition of TIOCDCDTIMESTAMP.  If
TIOCDCDTIMESTAMP is defined at compile-time, the older xntpd userlevel
timestamping methods are #ifdef'ed out.

If the TIOCDCDTIMESTAMP is defined at compile-time, but not
implemented at runtime in the chipset-level serial-port driver to
which the refclock is attached xntpd's timestamping of recevied
reclock timecodes is completely broken.

There will be some delay getting the DCD code into *all* the serial
drivers on *all* ports.  Not to mention binary-distributions.

For now, i'm proposing the following fix.  Anyone running xntpd on
-current with a refclock should apply this before rebuilding xntpd.
If you've already done so, please apply the patch ASAP.  I've posted
the patch to comp.protocols.time.ntp and i'll be pulling it into our
source (xntpd2netbsd script) after allowing for feedback.

Sigh. Sorry about this, folks. But it really does only affect people
with refclocks, and AFAIK, no-one is using NetBSD for that, due to the
absence (till now) of PPS support.

Index: xntpd/ntp_refclock.c
RCS file: /cvsroot/src/usr.sbin/xntp/xntpd/ntp_refclock.c,v
retrieving revision 1.3
diff -c -r1.3 ntp_refclock.c
*** ntp_refclock.c	1998/03/06 18:17:22	1.3
--- ntp_refclock.c	1998/03/27 01:10:05
*** 722,729 ****
  		} else
  			trtmp = rbufp->recv_time;
  	if (dpend >= dpt + 8) {
  		if (buftvtots(dpend - 8, &tstmp)) {
  			L_SUB(&trtmp, &tstmp);
--- 722,730 ----
  		} else
  			trtmp = rbufp->recv_time;
! 	else
! 	/* XXX fallback to old method if kernel refuses TIOCDCDTIMESTAMP */
! #endif  /* TIOCDCDTIMESTAMP */
  	if (dpend >= dpt + 8) {
  		if (buftvtots(dpend - 8, &tstmp)) {
  			L_SUB(&trtmp, &tstmp);
*** 746,752 ****
  				trtmp = rbufp->recv_time;
  	 * Edit timecode to remove control chars. Don't monkey with the
--- 747,752 ----