Subject: [ntpwg] [Technical Errata Reported] RFC5905 (3125)

From: RFC Errata System <[email-masked]>
Date: Thu, 16 Feb 2012 17:12:53 -0800 (PST)

The following errata report has been submitted for RFC5905,
"Network Time Protocol Version 4: Protocol and Algorithms Specification".

--------------------------------------
You may review the report below and at:
http://www.rfc-editor.org/errata_search.php?rfc=5905&eid=3125

--------------------------------------
Type: Technical
Reported by: Richard Walters <[email-masked]>

Section: A.5.1.1

Original Text
-------------
        /*

         * Calculate offset, delay and dispersion, then pass to the

         * clock filter.  Note carefully the implied processing.  The

         * first-order difference is done directly in 64-bit arithmetic,

         * then the result is converted to floating double.  All further

         * processing is in floating-double arithmetic with rounding

         * done by the hardware.  This is necessary in order to avoid

         * overflow and preserve precision.

         *

         * The delay calculation is a special case.  In cases where the

         * server and client clocks are running at different rates and

         * with very fast networks, the delay can appear negative.  In

         * order to avoid violating the Principle of Least Astonishment,

         * the delay is clamped not less than the system precision.

         */

        if (p->pmode == M_BCST) {

                offset = LFP2D(r->xmt - r->dst);

                delay = BDELAY;

                disp = LOG2D(r->precision) + LOG2D(s.precision) + PHI *

                    2 * BDELAY;

        } else {

                offset = (LFP2D(r->rec - r->org) + LFP2D(r->dst -

                    r->xmt)) / 2;

                delay = max(LFP2D(r->dst - r->org) - LFP2D(r->rec -

                    r->xmt), LOG2D(s.precision));

                disp = LOG2D(r->precision) + LOG2D(s.precision) + PHI *

                    LFP2D(r->dst - r->org);

        }

        clock_filter(p, offset, delay, disp);

Corrected Text
--------------
        /*

         * Calculate offset, delay and dispersion, then pass to the

         * clock filter.  Note carefully the implied processing.  The

         * first-order difference is done directly in 64-bit arithmetic,

         * then the result is converted to floating double.  All further

         * processing is in floating-double arithmetic with rounding

         * done by the hardware.  This is necessary in order to avoid

         * overflow and preserve precision.

         *

         * The delay calculation is a special case.  In cases where the

         * server and client clocks are running at different rates and

         * with very fast networks, the delay can appear negative.  In

         * order to avoid violating the Principle of Least Astonishment,

         * the delay is clamped not less than the system precision.

         */

        if (p->pmode == M_BCST) {

                offset = LFP2D(r->xmt - r->dst);

                delay = BDELAY;

                disp = LOG2D(r->precision) + LOG2D(s.precision) + PHI *

                    2 * BDELAY;

        } else {

                offset = (LFP2D(r->rec - r->org) + LFP2D(r->xmt -

                    r->dst)) / 2;

                delay = max(LFP2D(r->dst - r->org) - LFP2D(r->xmt -

                    r->rec), LOG2D(s.precision));

                disp = LOG2D(r->precision) + LOG2D(s.precision) + PHI *

                    LFP2D(r->dst - r->org);

        }

        clock_filter(p, offset, delay, disp);

Notes
-----
Calculations of 'offset' and 'delay' have terms that are incorrectly swapped.  In the calculation of 'offset', term 'r->dst' should be 'r->xmt', and term 'r->xmt' should be 'r->dst'.  In the calculation of 'delay', term 'r->rec' should be 'r->xmt', and term 'r->xmt' should be 'r->rec'.

See the text from section 8:

   "In the figure, the first packet transmitted by A contains only the

   origin timestamp t1, which is then copied to T1.  B receives the

   packet at t2 and copies t1 to T1 and the receive timestamp t2 to T2.

   At this time or some time later at t3, B sends a packet to A

   containing t1 and t2 and the transmit timestamp t3.  All three

   timestamps are copied to the corresponding state variables.  A

   receives the packet at t4 containing the three timestamps t1, t2, and

   t3 and the destination timestamp t4.  These four timestamps are used

   to compute the offset and delay of B relative to A, as described

   below.

...

   "The four most recent timestamps, T1 through T4, are used to compute

   the offset of B relative to A

   theta = T(B) - T(A) = 1/2 * [(T2-T1) + (T3-T4)]

   and the round-trip delay

   delta = T(ABA) = (T4-T1) - (T3-T2)."

Noting that, from the perspective of A at time t4:

T1 = t1 = origin timestamp (r->org)

T2 = t2 = receive timestamp (r->rec)

T3 = t3 = transmit timestamp (r->xmt)

T4 = t4 = destination timestamp (r->dst)

An alternative correction would be to change the '+' to a '-' in the calculation of 'offset', and change the '-' to a '+' in the calculation of 'delay'.  However, this would deviate from the operators used in the formulas from section 8.

Instructions:
-------------
This errata is currently posted as "Reported". If necessary, please
use "Reply All" to discuss whether it should be verified or
rejected. When a decision is reached, the verifying party (IESG)
can log in to change the status and edit the report, if necessary. 

--------------------------------------
RFC5905 (draft-ietf-ntp-ntpv4-proto-13)
--------------------------------------
Title               : Network Time Protocol Version 4: Protocol and Algorithms Specification
Publication Date    : June 2010
Author(s)           : D. Mills, J. Martin, Ed., J. Burbank, W. Kasch
Category            : PROPOSED STANDARD
Source              : Network Time Protocol
Area                : Internet
Stream              : IETF
Verifying Party     : IESG
_______________________________________________
ntpwg mailing list
[email-masked]
http://lists.ntp.org/listinfo/ntpwg