Re: [Ntp] NTPv5 Loop Detection without Stratum - Why do we want this?

Danny Mayer <mayer@pdmconsulting.net> Tue, 20 September 2022 13:37 UTC

Return-Path: <mayer@pdmconsulting.net>
X-Original-To: ntp@ietfa.amsl.com
Delivered-To: ntp@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id F3975C1524AE for <ntp@ietfa.amsl.com>; Tue, 20 Sep 2022 06:37:51 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.909
X-Spam-Level:
X-Spam-Status: No, score=-1.909 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, NICE_REPLY_A=-0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BpikyAZm1yKc for <ntp@ietfa.amsl.com>; Tue, 20 Sep 2022 06:37:48 -0700 (PDT)
Received: from chessie.everett.org (chessie.everett.org [66.220.13.234]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 56CB1C14CF06 for <ntp@ietf.org>; Tue, 20 Sep 2022 06:37:44 -0700 (PDT)
Received: from [192.168.1.156] (pool-108-26-202-2.bstnma.fios.verizon.net [108.26.202.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by chessie.everett.org (Postfix) with ESMTPSA id 4MX2fY70RQzMP8V; Tue, 20 Sep 2022 13:37:41 +0000 (UTC)
Message-ID: <23f26126-c39e-16ea-d862-c8ac706e37d5@pdmconsulting.net>
Date: Tue, 20 Sep 2022 09:37:40 -0400
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.13.0
Content-Language: en-US
To: Miroslav Lichvar <mlichvar@redhat.com>
Cc: kristof.teichel=40ptb.de@dmarc.ietf.org, "ntp@ietf.org" <ntp@ietf.org>, Heiko Gerstung <heiko.gerstung=40meinberg.de@dmarc.ietf.org>
References: <DA1F1664-8A84-4197-844A-CA7E8DAA36B8@meinberg.de> <OF43150191.DABAA331-ONC12588B5.00362DC0-C12588B5.003861AF@ptb.de> <YxckOm2+TD3tTPN4@localhost> <7d7f0656-2fd2-b781-4913-526a4be8cb62@pdmconsulting.net> <Yxg4Cba58hI/aPKw@localhost> <aba44bbc-2204-735e-daff-a29a59dac9da@pdmconsulting.net> <YxmKlSVTzOQah/nc@localhost> <10b1b402-9386-4fb3-4297-38d31bdc5c96@pdmconsulting.net> <Yx8I6sTGKTLKJr8c@localhost> <796c33e6-02dc-0665-c8a2-a143f9100bdd@pdmconsulting.net> <Yygb4pt5JdyIszWU@localhost>
From: Danny Mayer <mayer@pdmconsulting.net>
In-Reply-To: <Yygb4pt5JdyIszWU@localhost>
Content-Type: text/plain; charset="UTF-8"; format="flowed"
Content-Transfer-Encoding: 7bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/ntp/2oN9Gx_My431mh1WQSrXs5pTg8c>
Subject: Re: [Ntp] NTPv5 Loop Detection without Stratum - Why do we want this?
X-BeenThere: ntp@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: Network Time Protocol <ntp.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/ntp>, <mailto:ntp-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/ntp/>
List-Post: <mailto:ntp@ietf.org>
List-Help: <mailto:ntp-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ntp>, <mailto:ntp-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 20 Sep 2022 13:37:52 -0000

On 9/19/22 3:36 AM, Miroslav Lichvar wrote:
> On Sun, Sep 18, 2022 at 12:07:50PM -0400, Danny Mayer wrote:
>> NTP looks at the selected candidates and chooses what it considers the best
>> at that time. Only one source is the chosen system which as you note is
>> marked as the one with the asterisk (*). You can only find that out with
>> ntpq (mode 6) queries. That becomes the reference ID for any downstream NTP
>> servers. I'm not sure what you are trying to point out.
> The discussion started about synchronization loops and how can they be
> detected and prevented. It's still in the subject.
>
> An NTP client selects multiple sources for synchronization (in ntpq
> marked as * and +). Loops can be happen over the * source and also the
> + sources.
>
> You seem to be focused on the selection of the system peer (*), from
> which is inherited stratum and other things. You are right that there
> is only one system peer, but there are other sources which can form
> synchronization loops.
I have no idea what point you are trying to make. The other potential 
sources would already have been eliminated if a loop was detected.
>>>> That's irrelevant. You are polling a server for time, what you do with it
>>>> depends on the analysis done on the packets.
>>> Right. So can you explain where measurements made in symmetric mode
>>> are handled differently than in client/server mode? A pointer to the
>>> RFC or code is sufficient.
>> The NTP reference implementation does this.
> I'm quite familiar with the "reference implementation", more than I'd
> like actually, but I have not seen what you are suggesting.
>
> Can you please tell us in which file and on what line we can see that
> difference in handling of measurements made in client/server mode and
> symmetric mode?

It's in there. If you don't want to read code you can read some of Dave 
Mills's papers. Here's one document reference and I'm sure that you can 
search for others. His book also talks about it.

https://doc.ntp.org/reflib/onwire/

>>> In symmetric mode each packet is a request and response at the same
>>> time, i.e. the number of messages is halved when compared to two
>>> client/server associations.
>> No. See the source code.
> Which file and line in the source code?
>
>>> As the responses follow the polling interval and are not send
>>> immediately when the request is received, this makes the symmetric
>>> mode susceptible to replay attacks. In client/server mode each request
>>> has its own response, independently from the polling of the other
>>> client/server association.
>> Not true. You misunderstand how symmetric mode works.
> Which part do you think I misunderstood?
>
>> A stratum-1 server that decides that it's reference clock is not reliable,
>> or unavailable, is no longer a stratum-1 server, it's just a downstream
>> server from it's selected server and is a stratum lower than that server.
>> I'm not sure what your question is since it's very basic to NTP.
> There was no question. I said clients of a stratum-1 server with a
> poor reference clock would prefer another server, possibly with a
> higher stratum, i.e. stratum doesn't indicate accuracy. You said it
> would no longer be considered a stratum-1 server. I disagree.

Sorry but the definition of a stratum-1 server is that it gets its 
preferred time from a refclock, whether it's an atomic clock or GPS or 
something else. You don't get to choose the definition on your own. If 
it doesn't get it from there then it needs to add 1 to the stratum 
number of the server it does get it's time from. If you are not doing 
that you have a broken application server.

Danny