[Ntp] Antw: [EXT] Handling of future versions in historic implementations

Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de> Fri, 23 September 2022 07:28 UTC

Return-Path: <Ulrich.Windl@rz.uni-regensburg.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 1F8BDC1524AF for <ntp@ietfa.amsl.com>; Fri, 23 Sep 2022 00:28:42 -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, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01] 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 3DlwXTezS28d for <ntp@ietfa.amsl.com>; Fri, 23 Sep 2022 00:28:37 -0700 (PDT)
Received: from mx3.uni-regensburg.de (mx3.uni-regensburg.de [IPv6:2001:638:a05:137:165:0:4:4e79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 5FBA0C15EB3B for <ntp@ietf.org>; Fri, 23 Sep 2022 00:27:55 -0700 (PDT)
Received: from mx3.uni-regensburg.de (localhost [127.0.0.1]) by localhost (Postfix) with SMTP id 2911F6000051 for <ntp@ietf.org>; Fri, 23 Sep 2022 09:27:49 +0200 (CEST)
Received: from gwsmtp.uni-regensburg.de (gwsmtp1.uni-regensburg.de [132.199.5.51]) by mx3.uni-regensburg.de (Postfix) with ESMTP id 10B69600004D for <ntp@ietf.org>; Fri, 23 Sep 2022 09:27:43 +0200 (CEST)
Received: from uni-regensburg-smtp1-MTA by gwsmtp.uni-regensburg.de with Novell_GroupWise; Fri, 23 Sep 2022 09:27:44 +0200
Message-Id: <632D5FEE020000A10004E0D9@gwsmtp.uni-regensburg.de>
X-Mailer: Novell GroupWise Internet Agent 18.4.1
Date: Fri, 23 Sep 2022 09:27:42 +0200
From: Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de>
To: "ntp@ietf.org" <ntp@ietf.org>, mlichvar@redhat.com
References: <Yyx+VOkuFCAuBBYb@localhost>
In-Reply-To: <Yyx+VOkuFCAuBBYb@localhost>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
Archived-At: <https://mailarchive.ietf.org/arch/msg/ntp/5USBRVfd5KaXMAaqazuoVjrx1T4>
Subject: [Ntp] Antw: [EXT] Handling of future versions in historic implementations
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: Fri, 23 Sep 2022 07:28:42 -0000

>>> Miroslav Lichvar <mlichvar@redhat.com> schrieb am 22.09.2022 um 17:25 in
Nachricht <Yyx+VOkuFCAuBBYb@localhost>:
> I did a bit of archeology to see how the older NTP implementations
> handled future versions, now that there are some concerns about NTPv5
> making incompatible changes.

Thanks for the work!

...
> The NTPv1 implementation (ntpd) was written by Louis A. Mamakos and Mike
> Petry in C. In the code I found (from May 1989) in the main() function
> there is:
> 
> 	if ((pkt‑>status & VERSIONMASK) != NTPVERSION_1)
> 		continue;
> 
> 	receive(dst, pkt, &tv, i);
> 
> That is, future versions were ignored.

...and "older versions"...

> 
> The NTPv2 implementation seems to be a new implementation written from
...
> Again, future versions were ignored.
> 
> The NTPv3 implementation was based on the NTPv2 xntpd and the NTPv3
...
> This seems to be intentionally handling future versions as compatible
> with NTPv3.

A bad idea as the version was not defined at the time of writing
...

> 
> The NTPv4 support was implemented in xntpd by David Mills and it was
> renamed to ntpd. In the current version of the code there is:
> 
> 	if (hisversion == NTP_VERSION) {
> 		sys_newversion++;		/* new version */
> 	} else if (   !(restrict_mask & RES_VERSION)
> 		   && hisversion >= NTP_OLDVERSION) {
> 		sys_oldversion++;		/* previous version */

I think the assumption was (at the time of writing) that there won't be a
version > NTP_VERSION, so the oldversion test would apply to the interval
[NTP_OLDVERSION...NTP_VERSION-1].

As obvious in all example code, a comment explaining what the code is supposed
to do would have been helpful.

...

> The future versions are accepted as "previous version". This might
> seem like a bug, but from what we have heard on this list recently,
> it was intended.

I think that's just a "postmortem interpretation", but it never was the
intention.

> 
> So, it seems this idea of future versions being compatible with older
> versions started with NTPv3, but for some reason it wasn't specified
> in RFC 1305 or RFC 5905.

As stated before, I think "it's a bad idea".

Regards,
Ulrich