Re: [Ntp] Antw: [EXT] Re: New Version Notification for draft‑gruessing‑ntp‑ntpv5‑requirements‑03.txt

Martin Burnicki <martin.burnicki@meinberg.de> Thu, 21 October 2021 10:17 UTC

Return-Path: <martin.burnicki@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 F127D3A14D2 for <ntp@ietfa.amsl.com>; Thu, 21 Oct 2021 03:17:10 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.1
X-Spam-Level:
X-Spam-Status: No, score=-2.1 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, NICE_REPLY_A=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=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 ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8tzQocJZsNuG for <ntp@ietfa.amsl.com>; Thu, 21 Oct 2021 03:17:03 -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 B60CF3A14D9 for <ntp@ietf.org>; Thu, 21 Oct 2021 03:17:03 -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 DB57771C0F80; Thu, 21 Oct 2021 12:16:59 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meinberg.de; s=d2021; t=1634811419; 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: in-reply-to:in-reply-to:references:references; bh=9McQpnU0B6dBM8dxs+v7l4fcb6wDqIljc2shDogsYM8=; b=R/GVRFZVpwfot+ZZUzCYDYLAjQcgKMNnrEnJd3d3ydSoBQBCsgqiZljKYdNdAQFnKH+bfT 29o9BU6wCBx47kM2XN5G1TkhT1D/0r5VLgG9GPtMFxt65oXXYUrWCVy05cdMBDoxVBXqrx 7nvJjl2fkPJqQMtqQhYbK/k5nvs+4YVBLeQXweU3ULsK4G8BHLGDUiV73VkMDu4fdTOl7P cysefcwZMuyjONg31A2Ey1rbZQiBXjWhY22V9ZtPA7RntxJMGTFuYmQjEPabhHhzGIZ+0E CtQTLdfp7pS+/N1UPv+k/ceFXae1tBf7cbKfIpOGeZFmMkWnfxp2EQqJicMV0w==
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; Thu, 21 Oct 2021 12:16:58 +0200 (CEST)
X-Footer: bWVpbmJlcmcuZGU=
Received: from localhost ([127.0.0.1]) by srv-kerioconnect.py.meinberg.de with ESMTPSA (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)); Thu, 21 Oct 2021 12:16:56 +0200
Message-ID: <6847684a-8613-6268-27b5-780b4bc17207@meinberg.de>
Date: Thu, 21 Oct 2021 12:16:55 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0
Content-Language: en-US
To: Hal Murray <halmurray+ietf@sonic.net>, Miroslav Lichvar <mlichvar@redhat.com>
Cc: "ntp@ietf.org" <ntp@ietf.org>
References: <20211021092000.13DDD28C157@107-137-68-211.lightspeed.sntcca.sbcglobal.net>
From: Martin Burnicki <martin.burnicki@meinberg.de>
Organization: Meinberg Funkuhren GmbH & Co. KG, Bad Pyrmont, Germany
In-Reply-To: <20211021092000.13DDD28C157@107-137-68-211.lightspeed.sntcca.sbcglobal.net>
Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="------------0RsrjNIIoy0joLQ0h8wIMzfH"
X-SM-outgoing: yes
Archived-At: <https://mailarchive.ietf.org/arch/msg/ntp/7l1UrRKGt7DUQlfvMVGueAswP-E>
Subject: Re: [Ntp] Antw: [EXT] Re: New Version Notification for draft‑gruessing‑ntp‑ntpv5‑requirements‑03.txt
X-BeenThere: ntp@ietf.org
X-Mailman-Version: 2.1.29
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: Thu, 21 Oct 2021 10:17:11 -0000

Hal Murray wrote:
> mlichvar@redhat.com said:
>>> The time used in time-transfer should be TAI to keep things clean.
>>> No leap. No smear.
> 
>> I'm sure that would look great on paper, but how exactly do you implement it?
>> You cannot convert POSIX time_t to TAI just from the timestamp alone. When
>> you receive a timestamp from the kernel (e.g. in the SO_TIMESTAMP control
>> message), you don't know if it was captured before or after the leap.

Exactly.


> Good point.  What does the current code do?
> 
> I don't have a simple/clean answer.
> 
> A short term hack would be to drop all packets where a time stamp is ambigious.

How do you find out which timestamp is ambiguous, and which is not?

I think that if you want SO_TIMESTAMPING to return a TAI timestamp you 
have to introduce another mode which requests that.

> A long term solution would be for the kernel to keep time in TAI and the
> library to translate all the old APIs to UTC.
> 
> A medium term fix for SO_TIMESTAMP and friends would add the TAI-UTC offset to
> the time stamp or a leap-in-progress flag.  That's a few lines of code in the
> kernel.

This would mean that  each time a packet is timestamped, the 
timestamping code would have to grab the timestamp and check and collect 
the status in an atomic way.

I bet this is too expensive, with regard to the execution time.

The same problem has been discussed before about letting user space 
programs retrieve the current time plus status from the kernel, which 
would fix lots of leap second problems.

>> The other important issue is that the TAI-UTC offset is not always known.
> 
> Yes.  I think requiring the client to know the TAI offset is reasonable.  They
> can get it from a leap-seconds type file or from a simple UDP exchange.  It's
> the same as knowing about the next leap second.
> 
> We could put it in every packet, but that seems ugly to me.  It makes things
> slightly simpler for the simple/dumb client (1 packet vs 2) at the cost of
> complicating the packet on the wire.
> 
> Maybe we should have a separate packet format for simple clients.  How dumb
> are current dumb clients?  Would they be happy with only a single time stamp
> from the server?  Do they even care about fractions of a second?
> 
> 
>> NTP is a simple protocol for exchanging timestamps. It shouldn't enforce what
>> kind of timestamps are exchanged.
> 
> We either have to pick one and hence enforce that, or put the type of
> timestamp in the packet.  I think it's cleaner to have only one on the wire.
> 
> ------
> 
> The root of the problem is smearing.  The current implementation hides it from
> the client software.

This was exactly the intention when smearing was introduced. Hiding leap 
seconds from clients so that they all have the same time but don't even 
notice there's a leap second.

We've had customers that had to stick with certain, certified software 
versions on the client systems. They weren't even allowed to update the 
kernel which had a known leap second bug, and they wouldn't be able to 
install a cool new NTP client which can do the smearing locally.

Instead, letting the server provide smeared time fixed the problem.


Clients that can do the smearing themselves don't necessarily need 
smearing info from a server.

In fact this has already been done, e.g. following the Markus Kuhn's 
UTC-SLS proposal from 2005:
https://www.cl.cam.ac.uk/~mgk25/time/utc-sls/

If I remember correctly this is at least supported in Pearl.

Similarly, you could let the kernel smear the time if it has received a 
leap second warning.


> Unless we change that, we have to continue with 2 NTP worlds: one set of
> servers that returns smeared time and another set that returns non-smeared
> time.

Yes. In any case you have to take care about the configuration:

If you have smearing servers, you have to configure clients so that they 
either use only servers that smear in the same way, or only servers that 
don't smear.

If you have smearing clients and non-smearing servers, you have to take 
care to configure each client whether and how it shall smear the time 
when a leap second is approaching.

> My suggestion of TAI only on the wire requires that the client implementation
> know about smearing.  The we-want-smearing information moves from hidden in
> the list of servers to an explicit flag in a config file (or whatever).

My preferred solution (in general) would still be to use UTC for the 
timestamps in the packets, and also provide a UTC/TAI offset so that 
systems that only need UTC can use that, and systems that need/want TAI 
can apply the offset to get TAI.


Martin
-- 
Martin Burnicki

Senior Software Engineer

MEINBERG Funkuhren GmbH & Co. KG
Email: martin.burnicki@meinberg.de
Phone: +49 5281 9309-414
Linkedin: https://www.linkedin.com/in/martinburnicki/

Lange Wand 9, 31812 Bad Pyrmont, Germany
Amtsgericht Hannover 17HRA 100322
Geschäftsführer/Managing Directors: Günter Meinberg, Werner Meinberg, 
Andre Hartmann, Heiko Gerstung
Websites: https://www.meinberg.de  https://www.meinbergglobal.com
Training: https://www.meinberg.academy