Bug 75558 - ntpd incorrectly requires an option for -x parameter
ntpd incorrectly requires an option for -x parameter
Product: Red Hat Enterprise Linux 2.1
Classification: Red Hat
Component: ntp (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Harald Hoyer
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2002-10-09 17:33 EDT by Need Real Name
Modified: 2007-11-30 17:06 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-02-14 16:02:09 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
fix ntpd -x skew bug (8.79 KB, patch)
2003-01-16 21:18 EST, Yoshihide Sonoda
no flags Details | Diff

  None (edit)
Description Need Real Name 2002-10-09 17:33:43 EDT
ntpd should take a -x parameter w/out an option. The version distributed says -x
requires an argument incorrectly.

The bug came from the droproot patch to ntpd. The patch below is what needs to
change to get the -x to operate correctly. This is against the cmd_args.c file
in ntp/ntpd. The : following the option indicates the option requires an
argument. The droproot patch mistakenly added a : after the x when appending the
new options.

This problem exists in at least 2.1AS and 8.0. I was working with the 8.0 SRPM.
It should be very similar if not identical for the 2.1AS.

--- cmd_args.c.orig     2002-10-09 16:23:31.000000000 -0500
+++ cmd_args.c  2002-10-09 16:23:13.000000000 -0500
@@ -15,7 +15,7 @@
 extern char const *progname;
 int    listen_to_virtual_ips = 0;

-static const char *ntp_options = "aAbc:dD:f:gk:l:LmnN:p:P:qr:s:t:v:V:x:U:T:";
+static const char *ntp_options = "aAbc:dD:f:gk:l:LmnN:p:P:qr:s:t:v:V:xU:T:";

 /* Drop root patch */
 extern char *server_user;
Comment 1 Harald Hoyer 2002-10-10 06:34:49 EDT
good point... dooh..
Comment 2 Harald Hoyer 2002-10-10 10:33:06 EDT
there will be an erratum
Comment 3 Larry Woodman 2002-11-06 15:20:49 EST
Is this available in an errata yet?

Larry Woodman
Comment 4 Harald Hoyer 2002-11-07 01:55:35 EST
waiting in the QA queue... sorry
Comment 5 Jennifer E. Lamb 2002-11-18 11:56:45 EST
Will the anticipated errata also keep ntp from slightly skewing the time when
using the -x option?  

The recommended -g parameter in addition to the step tickers file to correct the
drift has no effect.  The clock continues to slew out of sync.  Ntp produced the
same results.  Once ntp begins to slew the clock, it will never slew the time
back into sync and ntp continues to adjust the time futher out of sync. 
Regardless of the time source, ntp works correctly if it is set to step time. 
ntp fails miserably if it slews the time.

Also, ntp-4.1.1a-8.AS21.1 still has the same problem as the prior versions.

Comment 6 Joshua Jensen 2002-11-18 12:09:46 EST
We are seeing many customers with this problem.  Please, please fix.
Comment 7 Harald Hoyer 2002-11-18 12:24:03 EST
hmm, ntp uses adjtime, maybe the error is there??
Ulrich, Jakub? Any known issues? Also, should ntp use ntp_adjtime??
Comment 8 Ulrich Drepper 2002-11-18 14:14:11 EST
All adjtime is doing is converting the time back and forth from and to struct
timeval format and then it calls ntp_adjtime.  ntp_adjtime takes the time as an
integer in 5sec.  It should make much of a difference to call ntp_adjtime directly.
Comment 9 Harald Hoyer 2002-11-19 10:51:03 EST
you may want to try

This version uses ntp_adjtime vs. __adjtime in the old version.
Please give it the -x slew test..
Comment 10 Harald Hoyer 2002-11-19 10:51:45 EST
that is... sorry
Comment 11 Harald Hoyer 2002-11-20 11:54:27 EST
is with minimal changes... erratum is in the queue
Comment 12 Yoshihide Sonoda 2003-01-16 21:18:59 EST
Created attachment 89416 [details]
fix ntpd -x skew bug

This patch is to fix ntpd -x skewing bug.
Apply to "/usr/src/linux-2.4/kernel/time.c".
Comment 13 Yoshihide Sonoda 2003-01-16 21:22:23 EST
This problem causes kernel bug.
The do_adjtimex() function in /usr/src/linux-2.4/kernel/time.c is wrong
implementation. When the time difference of a server and a client becames
0.512 or more, ntpd stop skewing.
Since a clock is set by "step" with a difference for 0.128 seconds while not
using -x options, this is happend only while using -x option.

This implementation is very strange in comparison with other OS's,
such as FreeBSD, Solaris and HP-UX.
Then, I corrected Linux kernel to reference for the source code of FreeBSD.
(see http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/kern/kern_ntptime.c?

Try my patch.
Comment 14 John Flanagan 2003-02-14 16:02:09 EST
An errata has been issued which should help the problem described in this bug report. 
This report is therefore being closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files, please follow the link below. You may reopen 
this bug report if the solution does not work for you.


Note You need to log in before you can comment on or make changes to this bug.