[Ntp] NTPv5 Loop Detection without Stratum

Heiko Gerstung <heiko.gerstung@meinberg.de> Tue, 23 August 2022 10:21 UTC

Return-Path: <heiko.gerstung@meinberg.de>
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 78A40C1522AC for <ntp@ietfa.amsl.com>; Tue, 23 Aug 2022 03:21:29 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.107
X-Spam-Level:
X-Spam-Status: No, score=-7.107 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=meinberg.de
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 DuClV-gyhxLv for <ntp@ietfa.amsl.com>; Tue, 23 Aug 2022 03:21:25 -0700 (PDT)
Received: from server1a.meinberg.de (server1a.meinberg.de [176.9.44.212]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id E6132C14CF1D for <ntp@ietf.org>; Tue, 23 Aug 2022 03:21:23 -0700 (PDT)
Received: from seppmail.py.meinberg.de (unknown [193.158.22.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by server1a.meinberg.de (Postfix) with ESMTPSA id 032F571C01A7; Tue, 23 Aug 2022 12:21:21 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meinberg.de; s=d2021; t=1661250081; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=YOYyii1d56dxWfNl+RVnpRj7QUUbQ/9Kdwa5afJQUTI=; b=ofEm95t18E+F2iRd7KZqY4+O9MlbY8MhOWs10joYQr6Wrl6Copp0tu95gm0VZM9sCpnHVJ ToCacHw0TS4tNY+9/gd9LDEqy5OWYry33Rk0xnYkT0LMY3VfmUKaHvdJ5OX3VQt2egPg+W 5r8NUm7O38x0HaY8jEWCHK/xlOboaAItcBpSiwu3xBWHeLMizNLGZDv0ZojT0iHBLbJVxM n7TFnb3046nqrW+3jkC2mbAv+HFNbXaxJVT5oblah4u53olDXvDNDp44rXDLHgs8ZRyYhx 5eyYr10kqqs08SvaGLH8uqLshv4SGbebtUAWQOzMGvtoE8rNkAa2sUn/g0GSQQ==
Received: from srv-kerioconnect.py.meinberg.de (srv-kerioconnect.py.meinberg.de [172.16.3.65]) (using TLSv1.3 with cipher AEAD-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by seppmail.py.meinberg.de (Postfix) with ESMTPS; Tue, 23 Aug 2022 12:21:20 +0200 (CEST)
X-Footer: bWVpbmJlcmcuZGU=
User-Agent: Microsoft-MacOutlook/16.63.22070801
Date: Tue, 23 Aug 2022 12:21:19 +0200
Message-ID: <DA1F1664-8A84-4197-844A-CA7E8DAA36B8@meinberg.de>
Thread-Topic: NTPv5 Loop Detection without Stratum
Importance: Normal
X-Priority: 3
Thread-Index: AZ2x3tU+NGFjNWQyYTM5YTZiNmY4ZQ==
From: Heiko Gerstung <heiko.gerstung@meinberg.de>
To: Miroslav Lichvar <mlichvar@redhat.com>, Ulrich Windl <ulrich.windl@rz.uni-regensburg.de>
Cc: "ntp@ietf.org" <ntp@ietf.org>
X-SM-outgoing: yes
MIME-Version: 1.0
Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg="sha-256"; boundary="----7B0B9131C836F1C044FFDCFFE2D522B6"
Archived-At: <https://mailarchive.ietf.org/arch/msg/ntp/KxsijKCyYz6UfT0jty_q8yzYUk4>
Subject: [Ntp] NTPv5 Loop Detection without Stratum
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, 23 Aug 2022 10:21:29 -0000

One way of avoiding/detecting loops:
- upon startup, an NTPv5 instance creates a random 64bit ID
- we add a loop detection EF that can include n IDs (or we use n EFs)
- a stratum one server, when ask for his "sync trace", responds with only his ID
- a stratum two server would add its own ID to the ID of its upstream server, responding with a sync trace of two IDs
- a stratum 1+n server would respond with the sync trace of its upstream source(s) plus its own ID 
- if you use more than one upstream source, you can respond with a list of all IDs from the sync trace of all your upstream sources (removing duplicates)
- by checking if your own ID is in the sync trace of your upstream source(s), you can find out if there is a loop

Maybe smaller IDs (32 bit, 16 bit) would be OK as well. 10 IDs would be 80 octets on the wire. No question that we would have to find a way to avoid amplification attacks (hello monlist!). Maybe by making it mandatory to send a request (with padding bytes) that is as big as the worst case response. 

Regards,
  Heiko

--
Heiko Gerstung | Managing Director
T: +49 (0)5281 9309-404 | LinkedIn Profile <https://www.linkedin.com/in/heikogerstung/> | Twitter <https://twitter.com/hgerstung>
heiko.gerstung@meinberg.de

MEINBERG® The Synchronization Experts
 
Meinberg Funkuhren GmbH & Co. KG
Lange Wand 9 | 31812 Bad Pyrmont | Germany
Web: http://www.meinberg.de | http://www.meinbergglobal.com | LinkedIn  <https://www.linkedin.com/company/meinberg-funkuhren-gmbh-&-co--kg>

Amtsgericht Hannover 17HRA 100322
Geschäftsführer/Management: Günter Meinberg, Werner Meinberg, Andre Hartmann, Heiko Gerstung

Do not miss our Time Synchronization Blog:
http://blog.meinbergglobal.com
 
 

Am 23.08.22, 12:07 schrieb "ntp im Auftrag von Miroslav Lichvar" <ntp-bounces@ietf.org im Auftrag von mlichvar@redhat.com>:

    On Tue, Aug 23, 2022 at 11:30:44AM +0200, Ulrich Windl wrote:
    > So my conclusion still is that the "ping pong" style of time exchange between
    > peers is in accordance with the protocol specification.

    If the protocol cannot prevent the loop, there is no other option :).

    If NTPv5 can detect all loops, the client can decide to ignore the
    measurements of the source to avoid the loop.

    > (However if those peer have no other time source, the quality should become
    > worse over time, eventually declaring them unsynchronized)

    If they have no other time source, the protocol will block the
    synchronization by ignoring sources with larger stratum (NTPv3) or
    ignoring sources with matching refid (NTPv4).

    > > It causes oscillations, which has a negative impact on stability of
    > > the clocks. If you remove the symmetric associations, it performs
    > > better. You can easily verify that.
    > 
    > It may be, but would it be in the spirit of the protocol specification?

    I'm not sure what you mean by this.

    -- 
    Miroslav Lichvar

    _______________________________________________
    ntp mailing list
    ntp@ietf.org
    https://www.ietf.org/mailman/listinfo/ntp