[Cbor] CBOR tags for IPv4 and IPv6 addresses and prefixes

Michael Richardson <mcr+ietf@sandelman.ca> Mon, 25 January 2021 20:21 UTC

Return-Path: <mcr+ietf@sandelman.ca>
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 248723A1886 for <cbor@ietfa.amsl.com>; Mon, 25 Jan 2021 12:21:21 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 0.001
X-Spam-Level:
X-Spam-Status: No, score=0.001 tagged_above=-999 required=5 tests=[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 EyHCizdkGoT3 for <cbor@ietfa.amsl.com>; Mon, 25 Jan 2021 12:21:18 -0800 (PST)
Received: from tuna.sandelman.ca (tuna.sandelman.ca [IPv6:2607:f0b0:f:3:216:3eff:fe7c:d1f3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 57F493A1884 for <cbor@ietf.org>; Mon, 25 Jan 2021 12:21:18 -0800 (PST)
Received: from localhost (localhost [127.0.0.1]) by tuna.sandelman.ca (Postfix) with ESMTP id 40487389F1 for <cbor@ietf.org>; Mon, 25 Jan 2021 15:23:35 -0500 (EST)
Received: from tuna.sandelman.ca ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with LMTP id dVAgzvZh2CZW for <cbor@ietf.org>; Mon, 25 Jan 2021 15:23:34 -0500 (EST)
Received: from sandelman.ca (obiwan.sandelman.ca [IPv6:2607:f0b0:f:2::247]) by tuna.sandelman.ca (Postfix) with ESMTP id AD0CB389EB for <cbor@ietf.org>; Mon, 25 Jan 2021 15:23:34 -0500 (EST)
Received: from localhost (localhost [IPv6:::1]) by sandelman.ca (Postfix) with ESMTP id F1ADE320 for <cbor@ietf.org>; Mon, 25 Jan 2021 15:21:15 -0500 (EST)
From: Michael Richardson <mcr+ietf@sandelman.ca>
To: cbor@ietf.org
In-Reply-To: <161160506696.8820.4814310513726926040@ietfa.amsl.com>
References: <161160506696.8820.4814310513726926040@ietfa.amsl.com>
X-Mailer: MH-E 8.6+git; nmh 1.7+dev; GNU Emacs 26.1
X-Face: $\n1pF)h^`}$H>Hk{L"x@)JS7<%Az}5RyS@k9X%29-lHB$Ti.V>2bi.~ehC0; <'$9xN5Ub# z!G,p`nR&p7Fz@^UXIn156S8.~^@MJ*mMsD7=QFeq%AL4m<nPbLgmtKK-5dC@#:k
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-="; micalg="pgp-sha512"; protocol="application/pgp-signature"
Date: Mon, 25 Jan 2021 15:21:15 -0500
Message-ID: <13114.1611606075@localhost>
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/j8w8qZje0cltbWOUIJXkkMVyNRI>
Subject: [Cbor] CBOR tags for IPv4 and IPv6 addresses and prefixes
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: Mon, 25 Jan 2021 20:21:21 -0000

I was not satisfied with the semantics of tag 260 and 261.

The IP address type is determined by the length of the item.
Aside from lacking semantic meaning, it forces me to put all the trailing zeros in.
(Also IEEE now has 8-byte MAC addresses)

I'm happy to leave 260 for mac addresses though.
Should the prefix length go first perhaps?

I prefer the encoding given below (oops got my Doc prefix for IPv4 wrong in
document, fixed below):


## IPv6

IANA has allocated tag TBD1 for IPv6 uses.

An IPv6 address is to be encoded as up to sixteen-byte bytestring ({{RFC8949}} section, 3.1, major type 2), prefixed with tag TBD1.  Trailing zero octets may be omitted.

An IPv6 prefix, such as 2001:db8:1234::/48 is to be encoded as a two element array:

~~~~
    TBD1([ h'20010db81234', 24])
~~~~

## IPv4

IANA has allocated tag TBD2 for IPv4 uses.

An IPv4 address is to be encoded as a four-byte bytestring ({{RFC8949}} section, 3.1, major type 2), prefixed with tag TBD2. Trailing zero octets may be omitted.

An IPv4 prefix, such as 192.0.2.1/24 is to be encoded as a two element array:

~~~~
    TBD2([ h'C0000201', 24])
~~~~





internet-drafts@ietf.org wrote:
    > A new version of I-D, draft-richardson-cbor-network-addresses-00.txt
    > has been successfully submitted by Michael Richardson and posted to the
    > IETF repository.

    > Name: draft-richardson-cbor-network-addresses Revision: 00 Title: CBOR
    > tags for IPv4 and IPv6 addresses and prefixes Document date: 2021-01-25
    > Group: Individual Submission Pages: 4 URL:
    > https://www.ietf.org/archive/id/draft-richardson-cbor-network-addresses-00.txt
    > Status:
    > https://datatracker.ietf.org/doc/draft-richardson-cbor-network-addresses/
    > Html:
    > https://www.ietf.org/archive/id/draft-richardson-cbor-network-addresses-00.html
    > Htmlized:
    > https://tools.ietf.org/html/draft-richardson-cbor-network-addresses-00


    > Abstract: This document describes two CBOR Tags to be used with IPv4
    > and IPv6 addresses and prefixes.

    >    RFC-EDITOR-please remove: This work is tracked at
    > https://github.com/mcr/cbor-network-address.git




    > Please note that it may take a couple of minutes from the time of
    > submission until the htmlized version and diff are available at
    > tools.ietf.org.

    > The IETF Secretariat



--
Michael Richardson <mcr+IETF@sandelman.ca>   . o O ( IPv6 IøT consulting )
           Sandelman Software Works Inc, Ottawa and Worldwide