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

From: RFC Errata System <[email-masked]>
Date: Mon, 15 May 2017 09:23:44 -0700 (PDT)

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/eid5020

--------------------------------------
Type: Technical
Reported by: Ferenc Wágner <[email-masked]>

Section: 8

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

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

Notes
-----
The corresponding code line in A.5.1.1. agrees with this correction:

offset = (LFP2D(r->rec - r->org) + LFP2D(r->dst - r->xmt)) / 2;

taking Figure 7 into account:

| org       | T1         | origin timestamp      |
| rec       | T2         | receive timestamp     |
| xmt       | T3         | transmit timestamp    |
| dst       | T4         | destination timestamp |

Instructions:
-------------
This erratum 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  
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

---

From: "Ulrich Windl" <[email-masked]>
Date: Fri, 19 May 2017 09:08:51 +0200

Hi!

I found that I had sent this issue to Dave Mills longer time ago, and it seems
the bug was in RFC 1305 (not 1303 as mis-typed in my message) as well:

---quote (20.10.2015 13:18)---
I hope you'll excuse a stupid question, but it seems "I'm sitting on the
wire":
The Offset (theta) as defined per RFC 5905, page 29 (Offset = ((T2 - T1) + (T3
- T4)) / 2) seems to be exactly half of the delay (delta) if the clocks are in
perfect sync. It seems I'm missing something, but I cannot see it! I tried to
visualize the calculations (see attached image), but still I think something is
missing. As RFC 1303 has the same definition, I believe to be wrong, but would
you please teach me?
---end quote---

Regards,
Ulrich

>>> RFC Errata System <[email-masked]> schrieb am 15.05.2017 um
18:23 in

---

From: Tal Mizrahi <[email-masked]>
Date: Fri, 19 May 2017 16:00:37 +0300

Hi Ulrich,

>perfect sync.

Not exactly.

According to RFC 5905, page 29:
The offset theta is given by the following value:
theta=((T2-T1)+(T3-T4))/2
The delay (after slightly rearranging the terms) is: delta=((T2-T1)+(T4-T3))

Not just a factor of 2.

Intuitively, we can observe two things:

- When the offset is zero we will have theta=0 and  thus (T2-T1)=(T4-T3),
which means our delay measurement would appear to be perfectly symmetric.
- If the delay is zero (or delay << offset), then it is clear why (T2-T1)
is one measurement of the offset, and (T3-T4) is another measurement of the
offset, so theta is simply the average between these two measurements.

My two cents...
Tal.

---

From: Daniel Franke <[email-masked]>
Date: Thu, 18 May 2017 10:53:41 -0400

> Original Text

Perhaps the code in the appendix is wrong, but the spec is correct as-is.

Suppose B is 5 seconds ahead of A. At t_1=0, A sends a request which
takes 0.25 seconds to traverse the network. B processes the request
instantly, and sends a reply which again takes 0.25 seconds to cross
the network back to A. This perfectly symmetric latency should give
theta = 5.

In this scenario, we have:

t_1 = 0
t_2 = 5.25
t_3 = 5.25
t_4 = 0.5

In the calculation as specified, we have

theta = (1/2) * [(5.25 - 0) + (5.25 - 0.5)] = 5, as expected

With the proposed change we would have

theta = (1/2) * [(5.25 -0) + (0.5 - 5.25)] = 0.25, which is incorrect.
_______________________________________________
ntpwg mailing list
[email-masked]
http://lists.ntp.org/listinfo/ntpwg

---

From: Tal Mizrahi <[email-masked]>
Date: Thu, 18 May 2017 17:44:57 +0300

Hi,

I do not think this erratum is justified.

I believe the error is actually on this line:
offset = (LFP2D(r->rec - r->org) + LFP2D(r->dst - r->xmt)) / 2;

Looks like this was addressed in the following erratum submission:
https://www.rfc-editor.org/errata_search.php?rfc=5905&eid=3125

Cheers,
Tal.

---

From: [email-masked] (Ferenc Wágner)
Date: Fri, 19 May 2017 01:26:51 +0200

> https://www.rfc-editor.org/errata_search.php?rfc=5905&eid=3125

I agree.  I got lost with the notation and misidentified the problem.
Erratum 3125 seems to cover this issue fully.  I'd like to withdraw my
erratum submission (5020).  Sorry for the noise.
-- 
Kind regards,
Ferenc Wágner
_______________________________________________
ntpwg mailing list
[email-masked]
http://lists.ntp.org/listinfo/ntpwg

---

From: "Ulrich Windl" <[email-masked]>
Date: Mon, 22 May 2017 11:41:27 +0200

>>> Tal Mizrahi <[email-masked]> schrieb am 19.05.2017 um 15:00 in
Nachricht
> The delay (after slightly rearranging the terms) is:
delta=((T2-T1)+(T4-T3))

The above is the rejected errata formula, right?

> Not just a factor of 2.

If I rearrange terms, I (who may be wrong) get:
Delay = T4-T3 + (T2-T1) [from (T4 - T1) - (T3 - T2)]
Offset = (T2-T1 - (T4-T3)) / 2 [from ((T2 - T1) + (T3 - T4)) / 2]

So the offset is half of the difference between transmit and receive delay?
The assumption is that any asymmetry is solely caused by a clock offset (and
not by the network). I don't understand why half of the value is taken. Can
some one explain?

Regards,
Ulrich

---

From: Tal Mizrahi <[email-masked]>
Date: Mon, 22 May 2017 13:24:12 +0300

Ulrich,

>not by the network). I don't understand why half of the value is taken. Can

First, this is further discussed in Dave Mill's NTP paper (see below [1]).
Basically, the *estimated* offset is indeed half the difference between the
*measured* one-way-delays. In the paper there is also a discussion about an
upper bound and a lower bound of the *true* offset.
As always, there is an underlying assumption that the delay is symmetric
(because NTP has no way of measuring any asymmetries).

The offset is denoted by theta, and the one-way-delay by delta.

By definition of delta and theta, we expect that
(T2-T1)=delta+theta
Similarly, we also expect that
(T4-T3)=delta-theta

So we have two equations with two unknowns (delta, and theta). Based on
these two equations we can isolate delta and theta, and get the two
equations given in RFC 5905, page 29:

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

Tal.

[1] Mills, David L. "Internet time synchronization: the network time
protocol." IEEE Transactions on communications 39.10 (1991): 1482-1493.

On Mon, May 22, 2017 at 12:41 PM, Ulrich Windl <
[email-masked]> wrote:

> >>The Offset (theta) as defined per RFC 5905, page 29 (Offset = ((T2 - T1)
> +
> > (T3
> >> The Offset (theta) as defined per RFC 5905, page 29 (Offset = ((T2 -
> T1) +
> >> (T3
> >> perfect sync. It seems I'm missing something, but I cannot see it! I
> tried
> >> to

---

From: Tal Mizrahi <[email-masked]>
Date: Mon, 22 May 2017 13:29:25 +0300

Correction: delta is the two-way-delay, and not as written below. Thus, the
one-way-delay is delta/2.
So the two equations with two unknowns are actually:

(T2-T1) = delta/2 + theta
(T4-T3) = delta/2 - theta

and from here we get:

Cheers,
Tal.

On Mon, May 22, 2017 at 1:24 PM, Tal Mizrahi <[email-masked]>
wrote:

> Basically, the *estimated* offset is indeed half the difference between
> the *measured* one-way-delays. In the paper there is also a discussion
> about an upper bound and a lower bound of the *true* offset.
> On Mon, May 22, 2017 at 12:41 PM, Ulrich Windl <[email-masked]
> regensburg.de> wrote:
>
>> >> I found that I had sent this issue to Dave Mills longer time ago, and
>> it
>> >> seems
>> >> missing. As RFC 1303 has the same definition, I believe to be wrong,
>> but
>> >> would
>> >> you please teach me?
>> >> ---end quote---
>> >>
>> >> Regards,
>> >> Ulrich
>> >>

---

From: "Ulrich Windl" <[email-masked]>
Date: Mon, 22 May 2017 12:29:43 +0200

>>> Tal Mizrahi <[email-masked]> schrieb am 22.05.2017 um 12:24 in
Nachricht
>>not by the network). I don't understand why half of the value is taken. Can

Thanks!

Soon after having sent my message, my brain got a little break, and instantly
the light went on, and I realized what I had missed before ;-)

Ulrich

it
but