Re: [Ntp] Drafts on interleaved modes and correction field

Tal Mizrahi <tal.mizrahi.phd@gmail.com> Tue, 31 October 2017 14:59 UTC

Return-Path: <tal.mizrahi.phd@gmail.com>
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 9A18013F72A for <ntp@ietfa.amsl.com>; Tue, 31 Oct 2017 07:59:56 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.699
X-Spam-Level:
X-Spam-Status: No, score=-2.699 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
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 FfQUQMHw9jnU for <ntp@ietfa.amsl.com>; Tue, 31 Oct 2017 07:59:54 -0700 (PDT)
Received: from mail-oi0-x230.google.com (mail-oi0-x230.google.com [IPv6:2607:f8b0:4003:c06::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id DE1CD13F6DB for <ntp@ietf.org>; Tue, 31 Oct 2017 07:59:53 -0700 (PDT)
Received: by mail-oi0-x230.google.com with SMTP id g125so27021257oib.12 for <ntp@ietf.org>; Tue, 31 Oct 2017 07:59:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=lHCmTSawHsxxADLgCLPmS79NkYxhSuJDtW9dCv7euIY=; b=a+OVK3rp8m5ZOUTO11gF7FCGYqIyS3aYNOxVI9YFNzUA4vU5bURCfihCdiBVCmsZfx 1ZE4HUActxcIDmc317O+hTvR11OCOS3DGb9GCLVrcsaXzWoRtJsEJ5oJwnvWUC8x5fAT Z++lmWnVn6NacGN0aGKt1UfaOZEpUFEGSWOvL6WFYsfN7n/Qyk+5ROQPA4wJGDJwST+H AIY2K38EyUN0DmbsHPzDb95pbMvh48XXxmbOHz7IpZFKIOj7NGLdQGfxZ1+5Q0LUToep ez5jljvfty8C6calASW1Y1UPOvXnsOLz57nMA19Js7IkEPmW6W5+1cNOFuvoL9XMizVG 88uQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=lHCmTSawHsxxADLgCLPmS79NkYxhSuJDtW9dCv7euIY=; b=oMsYxGebLYaiU/yK9EmT2x/EqEeCPtSohTD0888TbWcbd/ouwLg8qAOaxN2SKknEQU H6P4llYVu2JufsTW0P6y8BRh2TRlv8L3gqg/9qKMQ1f56Wm3yDdTGLKvZ0ZGqBg4vZ+c KcOeFu1RLVqoQFl2IeJys8+SmCI3wRPkQtZiIM8uWG+nDjAUc0AK2bnzxlqgaIc73oE8 pl6WYCCsLdm757dg9bKr7mEqqyHweqvtzy2pWQkSxOnUhMdF9q668x6FFugDdhJd5vig 69xX4UVlhMYiC7jIKdYw4gfglENYpK8tECXPZ1oc1wA0l26/FnmYhVCOBA3hiScCg6Ct zZ1A==
X-Gm-Message-State: AMCzsaWn8m8rlOBVCjXpP8Q8Ar6l42hTSlkJJXoFWQmu4PY0STwevNiq FyEqbZhGH51XQgUoAgp73nh9dCiQPJ23mlyK3gU=
X-Google-Smtp-Source: ABhQp+TVz7vtDyWba9eLmPDfl81CuteQAsrn2GFSF/mcKA6ewAa4nKkwoubhMY+EVf7Bx+8r+GEjMNrsHRolV3FVlzo=
X-Received: by 10.202.81.16 with SMTP id f16mr1078848oib.157.1509461993216; Tue, 31 Oct 2017 07:59:53 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.168.25.194 with HTTP; Tue, 31 Oct 2017 07:59:52 -0700 (PDT)
In-Reply-To: <20171031135247.GB7648@localhost>
References: <20171031090139.GD15597@localhost> <CABUE3XmV1sUvq0KAJVrQv1sZ8vK6R8GwR+qeO1huTUgnOdujfQ@mail.gmail.com> <20171031135247.GB7648@localhost>
From: Tal Mizrahi <tal.mizrahi.phd@gmail.com>
Date: Tue, 31 Oct 2017 16:59:52 +0200
Message-ID: <CABUE3X=pDEL9mcfoTGJw3PbwzHKnDTddr7Aqk71PyEBY77kzSw@mail.gmail.com>
To: Miroslav Lichvar <mlichvar@redhat.com>
Cc: ntp@ietf.org, Aanchal Malhotra <aanchal4@bu.edu>
Content-Type: multipart/alternative; boundary="001a113d77d4e86147055cd9011b"
Archived-At: <https://mailarchive.ietf.org/arch/msg/ntp/ANjfumFIDMLYYgtm7G0R_3_hTbA>
Subject: Re: [Ntp] Drafts on interleaved modes and correction field
X-BeenThere: ntp@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: <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, 31 Oct 2017 14:59:56 -0000

Hi Miroslav,

Thanks for the quick response.


>With NTP there is generally no HW support, so clients and servers
>should use trailer RX timestamps and preamble TX timestamps to avoid
>an asymmetric delay with different link speeds. The following document
>explains the issue nicely.
>
>https://www.eecis.udel.edu/~mills/stamp.html
>
>Do you think it will be difficult to implement? If the link speed and
>length of the packet is known, the timestamp can be transposed.

The link speed is not necessarily known to the end points. Furthermore, the
link speed may change several times along the path.
Maybe I am missing something, but it appears that when measuring
last-bit-in-to-first-bit-out we are ignoring the packet reception time; it
seems to make sense to include the packet reception time in the residence
time.

Moreover, we never know which nodes along the path use store-and-forward,
and which nodes use cut-through. In cut-through forwarding the packet
transmission may start before the last bit is received, so it certainly
makes more sense to measure the first-bit-in-to-first-bit-out.


>The reason for a separate transmit correction is to support the
>interleaved modes. The receive correction might not be necessary. If
>you have a better use for the 2 octets, I think it could be dropped
>and included in the origin correction instead.

So it looks like two correction fields would suffice: one for the forward
direction, and one for the reverse direction. Right?

Thanks,
Tal.





On Tue, Oct 31, 2017 at 3:52 PM, Miroslav Lichvar <mlichvar@redhat.com>
wrote:

> On Tue, Oct 31, 2017 at 01:53:52PM +0200, Tal Mizrahi wrote:
> > Regarding the correction field draft: very interesting draft.
> >
> > A few comments:
>
> Thanks for the comments, Tal.
>
> > 1. Section 3 says that the delay is the time difference between the end
> of
> > reception until the beginning of transmission.
> >
> >   It seems to make more sense to measure the delay as the beginning of
> > reception until the beginning of transmission, because that is the actual
> > delay of the packet in practice. BTW, this is also the way IEEE 1588
> > measures the correctionField.
>
> I think it should to be the same as what the clients and servers use,
> otherwise it would create an asymmetric correction when switching
> between different link speeds.
>
> As I understand it, PTP assumes that all devices in the network
> support PTP (as BC or TC), so it can take the simpler approch using
> preamble timestamps for both TX and RX.
>
> With NTP there is generally no HW support, so clients and servers
> should use trailer RX timestamps and preamble TX timestamps to avoid
> an asymmetric delay with different link speeds. The following document
> explains the issue nicely.
>
> https://www.eecis.udel.edu/~mills/stamp.html
>
> Do you think it will be difficult to implement? If the link speed and
> length of the packet is known, the timestamp can be transposed.
>
> In any case, I guess this should be explained in the draft.
>
> > 2. "TBD: Requirements on frequency accuracy of the clock."
> >
> >    NTP does not define accuracy requirements, and I would suggest to
> > refrain from defining these here as well.
>
> Ok, I was not really sure how it would be specified.
>
> > 3. "Delay Correction" - please consider using a format that is identical
> to
> > the one defined in IEEE 1588.
>
> Do you think it will be easier to implement that way? Using a
> nanosecond field in NTP packets feels dirty to me :).
>
> > 4. Section 2 - it would be great if you could clarify the fields "Receive
> > Correction", "Transmit Correction", and "Origin Correction". Having read
> > this section a couple of times, I could not figure out the units of these
> > fields, how they are used, and the rationale of why these fields are
> > required.
>
> All these fields are in 1/(2^48) of a second. The receive and transmit
> corrections are just extensions of the receive and transmit
> timestamps. When put together they make fixed point numbers with 32
> integer bits and 32 + 16 fractional bits.
>
> The reason for a separate origin field is to allow the client to check
> both values before they are applied. If the server adjusted its
> timestamp instead, the client wouldn't know by how much and couldn't
> limit the impact of a MITM attack.
>
> The reason for a separate transmit correction is to support the
> interleaved modes. The receive correction might not be necessary. If
> you have a better use for the 2 octets, I think it could be dropped
> and included in the origin correction instead.
>
> > 5. "The device MAY update the checksum complement field in order to keep
> > the UDP checksum valid."
> >    Since this is a "MAY", please clarify the alternatives: either clear
> the
> > UDP Checksum field (in IPv4 only), or recompute the UDP Checksum.
>
> Good point.
>
> > 6. Security considerations - I would point out that an attacker that
> > tampers with the correction extension is (roughly) equivalent to a delay
> > attacker in terms of the potential damage. Therefore, arguably there is
> no
> > point in securing the correction extension. I would recommend to leave
> the
> > correction extension out of the integrity protection. This possibility is
> > mentioned on the second par of Section 7, but I would suggest to rephrase
> > it to "this is what we recommend".
>
> Ok, I'll do that.
>
> > 7. Finally, one may consider a slightly different approach, where each
> hop
> > along the path adds a separate extension field, representing the
> residence
> > time of the current hop. Obviously this approach has some disadvantages,
> > but the advantage is that it provides detailed information about the
> delay
> > and delay variation in each hop. There is also potential to secure each
> > extension field separately using its own HMAC. Something to consider...
>
> I did briefly consider an approach like that, but it seemed to me
> there are at least two issues:
> - It may allow traffic amplification.
> - The growing length of the packet may create an asymmetric delay,
>   which I suspect could be completely avoided only in the case where
>   all devices on the path support the correction field and preamble
>   timestamps are used everywhere.
>
> --
> Miroslav Lichvar
>