Re: [GROW] On LC for draft-ietf-grow-bmp-tlv (ends December 1st 2021)
Jeffrey Haas <jhaas@pfrc.org> Wed, 08 December 2021 16:44 UTC
Return-Path: <jhaas@slice.pfrc.org>
X-Original-To: grow@ietfa.amsl.com
Delivered-To: grow@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1])
by ietfa.amsl.com (Postfix) with ESMTP id A86373A0433
for <grow@ietfa.amsl.com>; Wed, 8 Dec 2021 08:44:13 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.901
X-Spam-Level:
X-Spam-Status: No, score=-1.901 tagged_above=-999 required=5
tests=[BAYES_00=-1.9, SPF_PASS=-0.001]
autolearn=unavailable autolearn_force=no
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 8MfuOljIuq2G for <grow@ietfa.amsl.com>;
Wed, 8 Dec 2021 08:44:09 -0800 (PST)
Received: from slice.pfrc.org (slice.pfrc.org [67.207.130.108])
by ietfa.amsl.com (Postfix) with ESMTP id 86E123A02C1
for <grow@ietf.org>; Wed, 8 Dec 2021 08:44:09 -0800 (PST)
Received: by slice.pfrc.org (Postfix, from userid 1001)
id A23311E2FA; Wed, 8 Dec 2021 11:44:08 -0500 (EST)
Date: Wed, 8 Dec 2021 11:44:08 -0500
From: Jeffrey Haas <jhaas@pfrc.org>
To: Ben Maddison <benm=40workonline.africa@dmarc.ietf.org>
Cc: Paolo Lucente <paolo@ntt.net>, grow@ietf.org
Message-ID: <20211208164408.GC19663@pfrc.org>
References: <d7828b07-8f2d-1642-4a12-ea0606b68343@ntt.net>
<YZPZUdnQN3BC5CgN@vurt.sobornost.net>
<ZRAP278MB0176E2FD40048FFCAC59B1FE89999@ZRAP278MB0176.CHEP278.PROD.OUTLOOK.COM>
<Yajh8yO+qBRwqG6X@snel>
<20211208134021.dfhosulotmictqwz@benm-laptop>
<f84de5b6-8911-c665-0303-d82be96143de@ntt.net>
<20211208160044.44dyabjt5g3lcf6y@benm-laptop>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20211208160044.44dyabjt5g3lcf6y@benm-laptop>
User-Agent: Mutt/1.5.21 (2010-09-15)
Archived-At: <https://mailarchive.ietf.org/arch/msg/grow/H_7tD9nMGN7IX1Zdzu3TtpaRn-I>
Subject: Re: [GROW] On LC for draft-ietf-grow-bmp-tlv (ends December 1st
2021)
X-BeenThere: grow@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Grow Working Group Mailing List <grow.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/grow>,
<mailto:grow-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/grow/>
List-Post: <mailto:grow@ietf.org>
List-Help: <mailto:grow-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/grow>,
<mailto:grow-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 08 Dec 2021 16:44:14 -0000
Ben,
On Wed, Dec 08, 2021 at 06:00:44PM +0200, Ben Maddison wrote:
> > While a bit pedantic, I strongly suggest "TLVs SHOULD be sorted by their
> > code point.".
[...]
> That makes sense, thanks.
> Having never written a routine that does this, I am slightly surprised
> that it is still cheaper, even if the implementation cannot *require* that
> it will arrive sorted - but I am more than happy to take yours and Jeff's
> word for it!
Since it's not a state secret and a very common strategy for building
canonicalized collections:
1. Syntactically and semantically verify the contents of the received
TLV set.
2. Presuming step 1 passes, determine if for those rules whether there are
places in the data that should be cleaned/stripped. As an example, an NLRI
MAY be encoded with trailing bits after the prefix length. (This causes fun
bugs elsewhere in the code in many cases!) Step 2 might be done in tandem
with step 1 depending on whether the buffer in question is yours to do with
as you please or whether you're dealing with a shared buffer.
3. Presuming step 2 is done and is sorted in a canonical order[1], you can
simply take the memory in question and use it as a long key in a collection
to find an object with the same contents. The collection in question is
usually some nice bit of work appropriate to the key properties, but
anything that's efficient will work. Some implementations are partial to
height balanced trees, others to radix tables or similar like PATRICIA.
There is significant room for optimizations in step 3.
Why does sorted matter? Because if it's not, you need to insert a step
between 2 and 3 to canonicalize the data prior to the lookup step.
Otherwise you'll happily find an object (or not) in your collection that
matches the bit pattern but duplicates the semantics of the object.
E.g. {1,2,3} and {1,3,2} may be the same state, but you now have two objects
representing it. Having a common object means you can now link state
together from that canonicalized object and use it to find related things as
another key.
-- Jeff
[1] The BMP TLV draft somewhat frustratingly permits multiple instances of
the same type in a TLV set. Repetitions breed ambiguityin canonicalization.
A result of this is that when "pick one" is an answer, sometimes you get
behavior that depends on the implementation's sorting choice in this
instance.
- [GROW] On LC for draft-ietf-grow-bmp-tlv Paolo Lucente
- Re: [GROW] On LC for draft-ietf-grow-bmp-tlv (end… Job Snijders
- Re: [GROW] On LC for draft-ietf-grow-bmp-tlv (end… Thomas.Graf
- Re: [GROW] On LC for draft-ietf-grow-bmp-tlv (end… Job Snijders
- Re: [GROW] On LC for draft-ietf-grow-bmp-tlv (end… Matthias.Arnold
- Re: [GROW] On LC for draft-ietf-grow-bmp-tlv (end… Zhuangshunwan
- Re: [GROW] On LC for draft-ietf-grow-bmp-tlv (end… Zhuangshunwan
- Re: [GROW] On LC for draft-ietf-grow-bmp-tlv (end… Jared Mauch
- Re: [GROW] On LC for draft-ietf-grow-bmp-tlv (end… Chenshuanglong
- Re: [GROW] On LC for draft-ietf-grow-bmp-tlv (end… Aijun Wang
- Re: [GROW] On LC for draft-ietf-grow-bmp-tlv (end… 刘毅松
- Re: [GROW] On LC for draft-ietf-grow-bmp-tlv (end… duzongpeng@foxmail.com
- Re: [GROW] On LC for draft-ietf-grow-bmp-tlv (end… Wanghaibo (Rainsword)
- Re: [GROW] On LC for draft-ietf-grow-bmp-tlv (end… Dongjie (Jimmy)
- Re: [GROW] On LC for draft-ietf-grow-bmp-tlv (end… Ben Maddison
- Re: [GROW] On LC for draft-ietf-grow-bmp-tlv (end… Paolo Lucente
- Re: [GROW] On LC for draft-ietf-grow-bmp-tlv (end… Ben Maddison
- Re: [GROW] On LC for draft-ietf-grow-bmp-tlv (end… Jeffrey Haas
- Re: [GROW] On LC for draft-ietf-grow-bmp-tlv (end… Jeffrey Haas
- Re: [GROW] On LC for draft-ietf-grow-bmp-tlv (end… Jeffrey Haas
- Re: [GROW] On LC for draft-ietf-grow-bmp-tlv (end… Paolo Lucente
- Re: [GROW] On LC for draft-ietf-grow-bmp-tlv (end… Paolo Lucente
- Re: [GROW] On LC for draft-ietf-grow-bmp-tlv (end… Jeffrey Haas
- Re: [GROW] On LC for draft-ietf-grow-bmp-tlv (end… Paolo Lucente
- Re: [GROW] On LC for draft-ietf-grow-bmp-tlv (end… Job Snijders
- Re: [GROW] On LC for draft-ietf-grow-bmp-tlv (end… Paolo Lucente
- Re: [GROW] On LC for draft-ietf-grow-bmp-tlv (end… Paolo Lucente