Re: [Ntp] NTPv5 Loop Detection without Stratum

Paul Gear <ntp@libertysys.com.au> Tue, 23 August 2022 22:36 UTC

Return-Path: <ntp@libertysys.com.au>
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 4ABC4C152586 for <ntp@ietfa.amsl.com>; Tue, 23 Aug 2022 15:36:01 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.105
X-Spam-Level:
X-Spam-Status: No, score=-2.105 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_BLOCKED=0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, 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 (1024-bit key) header.d=libertysys.com.au
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 zHaFtrgwIUJk for <ntp@ietfa.amsl.com>; Tue, 23 Aug 2022 15:35:55 -0700 (PDT)
Received: from mail.libertysys.com.au (2001-44b8-2100-3f00-0000-0000-0000-0019.static.ipv6.internode.on.net [IPv6:2001:44b8:2100:3f00::19]) (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 5BDDFC152578 for <ntp@ietf.org>; Tue, 23 Aug 2022 15:35:55 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1]) by mail.libertysys.com.au (Postfix) with ESMTP id 9E0201804C6 for <ntp@ietf.org>; Wed, 24 Aug 2022 08:35:47 +1000 (AEST)
X-Virus-Scanned: Debian amavisd-new at mail2.gear.dyndns.org
Received: from mail.libertysys.com.au ([150.101.186.52]) by localhost (mail.gear.dyndns.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oZJSMMvr3OAA for <ntp@ietf.org>; Wed, 24 Aug 2022 08:35:40 +1000 (AEST)
Received: from [IPV6:2001:44b8:2100:3f40:3fc3:8f17:f88a:63be] (unknown [IPv6:2001:44b8:2100:3f40:3fc3:8f17:f88a:63be]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.libertysys.com.au (Postfix) with ESMTPSA id 57ADB1804B5 for <ntp@ietf.org>; Wed, 24 Aug 2022 08:35:40 +1000 (AEST)
Authentication-Results: mail.libertysys.com.au; dmarc=fail (p=quarantine dis=none) header.from=libertysys.com.au
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=libertysys.com.au; s=2016; t=1661294140; bh=gJE/TqfRnb3IqhaEvRw268wPpIw7P7vD2FbjJRCUv9c=; h=Date:Subject:To:References:From:In-Reply-To:From; b=fTDCw0fg5rrkeGJ2RKUtYjQ2iUO5XRROroNurzh+7YVfBYwaDwEvp36PxPhLwy64x TenPp48sv3KZV6jUgbmlCNi4PTnCLdIxwBlgFUB+po3m5PAP8oA4yAMu9plYsI/R5U AonEVJgxTo3LX34he9tckgBLM7SEKed/1V79LXO4=
Message-ID: <526dbee6-baff-bc40-d0e7-baadd71f438b@libertysys.com.au>
Date: Wed, 24 Aug 2022 08:35:39 +1000
MIME-Version: 1.0
Content-Language: en-AU
To: ntp@ietf.org
References: <DA1F1664-8A84-4197-844A-CA7E8DAA36B8@meinberg.de> <YwSszVA+ABO+3Tt3@localhost>
From: Paul Gear <ntp@libertysys.com.au>
In-Reply-To: <YwSszVA+ABO+3Tt3@localhost>
Content-Type: text/plain; charset="UTF-8"; format="flowed"
Content-Transfer-Encoding: 8bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/ntp/iG4uEwV3rffbSV9x0lNMRfk30ig>
Subject: Re: [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 22:36:01 -0000

On 23/8/22 20:32, Miroslav Lichvar wrote:
> On Tue, Aug 23, 2022 at 12:21:19PM +0200, Heiko Gerstung wrote:
>> 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
> That was the original idea before Daniel Franke suggested to use a
> bloom filter instead of a simple list. This makes the amount of
> exchanged data constant and it can contain a very large number of
> reference IDs before collisions can be expected.


I'm far from an expert on bloom filters, but they can have false 
positives, which would result in a source which was not part of a 
client's upstreams being erroneously flagged as being so.  Would this 
not require a trace (like what Heiko has described above) to detect?

In some cases, false positives would be inconsequential (e.g. when the 
client is using a well-served zone in the public pool and can easily ask 
for another source), but in private networks where the number of sources 
may be more limited discarding an upstream source may be more problematic.

Are these concerns warranted?  Some (all?) bloom filter implementations 
allow one to tune the desired false positive level; could we set that 
level low enough that it wouldn't be significant?

The fixed size of a bloom filter makes it simple to avoid traffic 
amplification, but with a trace this would be trickier, because if it 
required more than one UDP packet to transfer it would require holding 
state on the server, opening the server to resource exhaustion attacks also.

Regards,
Paul