Re: [Cbor] I-D Action: draft-ietf-cbor-network-addresses-02.txt

Carsten Bormann <cabo@tzi.org> Wed, 09 June 2021 11:18 UTC

Return-Path: <cabo@tzi.org>
X-Original-To: cbor@ietfa.amsl.com
Delivered-To: cbor@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 402E63A0E49 for <cbor@ietfa.amsl.com>; Wed, 9 Jun 2021 04:18:29 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.898
X-Spam-Level:
X-Spam-Status: No, score=-1.898 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham 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 BDawWKaNJ2n6 for <cbor@ietfa.amsl.com>; Wed, 9 Jun 2021 04:18:25 -0700 (PDT)
Received: from gabriel-2.zfn.uni-bremen.de (gabriel-2.zfn.uni-bremen.de [134.102.50.19]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id CA4123A0E46 for <cbor@ietf.org>; Wed, 9 Jun 2021 04:18:24 -0700 (PDT)
Received: from [192.168.217.118] (p548dcc89.dip0.t-ipconnect.de [84.141.204.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gabriel-2.zfn.uni-bremen.de (Postfix) with ESMTPSA id 4G0Pjn6J0Tz2xJ0; Wed, 9 Jun 2021 13:18:21 +0200 (CEST)
Content-Type: text/plain; charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\))
From: Carsten Bormann <cabo@tzi.org>
In-Reply-To: <DE9E58FC-13DE-4AD5-B0EC-EBF0DC13153A@tzi.org>
Date: Wed, 9 Jun 2021 13:18:21 +0200
X-Mao-Original-Outgoing-Id: 644930301.127977-4fc520aec5db229c64ed8ed39f10d452
Content-Transfer-Encoding: quoted-printable
Message-Id: <DA4D56A7-E1ED-4247-BFE0-89C85AB42DBE@tzi.org>
References: <161530094514.13640.13557132723821236873@ietfa.amsl.com> <DE9E58FC-13DE-4AD5-B0EC-EBF0DC13153A@tzi.org>
To: cbor@ietf.org
X-Mailer: Apple Mail (2.3608.120.23.2.7)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/vVZAWLinJsUGf1Jz6a7Q9KVFrbg>
Subject: Re: [Cbor] I-D Action: draft-ietf-cbor-network-addresses-02.txt
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Concise Binary Object Representation \(CBOR\)" <cbor.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cbor>, <mailto:cbor-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor/>
List-Post: <mailto:cbor@ietf.org>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cbor>, <mailto:cbor-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 09 Jun 2021 11:18:29 -0000

On 2021-06-09, at 11:29, Carsten Bormann <cabo@tzi.org> wrote:
> 
> Maybe we should supply some CDDL in draft-ietf-cbor-network-addresses so people don’t start to copy the above whenever they need a prefix.

Like this…


start = ipv6-address-or-prefix / ipv4-address-or-prefix

ipv6-address-or-prefix = #6.54(ip-address-or-prefix<128, 16>)
ipv4-address-or-prefix = #6.52(ip-address-or-prefix<32, 4>)

ip-address-or-prefix<L,S> = ip-address<S> / ip-prefix<L, S>

ip-address<S> = bytes .size S
ip-prefix<L, S> = [0..L, bytes .size (uint .le S)]


(I wish we had a .times!  
No I won’t cobble that together out of three .plus — or maybe we should?)

Or, if you like to repeat yourself superfluously saying the same thing twice redundantly again all over:


start = ipv6-address-or-prefix / ipv4-address-or-prefix

ipv6-address-or-prefix = #6.54(ipv6-address / ipv6-prefix)
ipv4-address-or-prefix = #6.52(ipv4-address / ipv4-prefix)

ipv6-prefix = [ipv6-prefix-length, ipv6-prefix-bytes]
ipv4-prefix = [ipv4-prefix-length, ipv4-prefix-bytes]

ipv6-prefix-length = 0..128
ipv4-prefix-length = 0..32

ipv6-prefix-bytes = bytes .size (uint .le 16)
ipv4-prefix-bytes = bytes .size (uint .le 4)

ipv6-address = bytes .size 16
ipv4-address = bytes .size 4



Grüße, Carsten